Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Jun 12 14:15:20 -0700 2009 | |
| |
History.txt | Tue Jun 09 08:59:57 -0700 2009 | |
| |
Manifest.txt | Wed Jul 01 08:20:34 -0700 2009 | |
| |
README.rdoc | Sat Jun 06 08:00:08 -0700 2009 | |
| |
Rakefile | Wed Jul 01 08:20:34 -0700 2009 | |
| |
lib/ | Thu Oct 15 07:03:06 -0700 2009 | |
| |
old_QueryBuilder.rb | Fri Jun 12 14:15:20 -0700 2009 | |
| |
querybuilder.gemspec | Wed Jul 01 08:20:34 -0700 2009 | |
| |
script/ | Mon Jan 26 04:39:18 -0800 2009 | |
| |
tasks/ | Tue Jun 16 07:17:23 -0700 2009 | |
| |
test/ | Thu Oct 15 07:03:06 -0700 2009 |
QueryBuilder
DESCRIPTION:
QueryBuilder is an interpreter for the "pseudo sql" language. This language can be used for two purposes:
1. protect your database from illegal SQL by securing queries 2. ease writing complex relational queries by abstracting table internals
SYNOPSIS:
# Create your own query class (DummyQuery) to parse your specific models (see test/mock).
# Compile a query:
query = DummyQuery.new("images where name like '%flower%' from favorites")
# Get compilation result:
query.to_s
=> "['SELECT ... FROM ... WHERE links.source_id = ?', @node.id]"
# Evaluate bind variables (produces executable SQL):
query.sql(binding)
=> "SELECT ... FROM ... WHERE links.source_id = 1234"
# Compile to get count instead of records:
query.to_s(:count)
=> "['SELECT COUNT(*) ... WHERE links.source_id = ?', @node.id]"
query.sql(binding, :count)
=> "SELECT COUNT(*) ... WHERE links.source_id = 1234"
REQUIREMENTS:
- yamltest
INSTALL:
sudo gem install querybuilder
LICENSE:
(The MIT License)
Copyright © 2008-2009 Gaspard Bucher
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.







