Every repository with this icon (
Every repository with this icon (
tree 320450fe74971d678667077ca1bd5d7692091ad4
parent 4280cef38e980ef662ca0f3fe5392aa62cae90b3
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
History.txt | ||
| |
Manifest.txt | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
lib/ | ||
| |
script/ | ||
| |
test/ |
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.








