| Short description: |
Builds safe SQL query. Covers almost all common operations. |
| Category: |
Library/Database |
| Status: |
stable |
| Created: |
2005-08-15 15:58:56 GMT |
| Last update: |
2005-08-30 10:08:46 GMT |
| Owner: |
Jan Molič
(Projects of this owner) |
| Homepage: |
http://simplypowerful.1984.cz/safequery/3.2005.8.28/doc |
| Download: |
http://simplypowerful.1984.cz/safequery/3.2005.8.28/safequery3.tgz
|
| License: |
Ruby's |
| Dependency: |
|
| Description: |
# == Changes
# Version 3 comes with real parser and improved syntax. But, unfortunately, is incompatible with versions < 3.*
#
# == Description
# Build sql query from a query template and a data hash.
# You don't have to escape values by hand or iterate over arrays
# to produce dynamic lists anymore. No sql injections. Simple and powerful ;-)
#
# == Usage
#
# 1. Create a template query.
# safequery = 'UPDATE TABLE #:tblname# (# keys of :mydata except nil values #) VALUES (# values of :mydata except nil #)'
#
# 2. Create a source data hash.
# hsh = {
# :tblname => 'my_foo_table',
# :mydata => {
# :a => 'AAA',
# :b => '',
# :c => nil,
# :d => 'DDD',
# :e => false
# }
# }
#
# 3. Get result (FooDB is used because of the 'escape' method. You can specify another name of the method as the second parameter).
#
# sq = SafeQuery3.new( FooDB.new )
# p sq.get( safequery, hsh )
#
# 4. The result is:
#
# "UPDATE TABLE my_foo_table (d, e, a, b) VALUES ('DDD', false, 'AAA', '')"
#
|
| Versions: |
[4.2006.05.26 (2006-05-26)]
[4.2006.04.19 (2006-05-25)]
[4.2006.03.23 (2006-03-23)]
[4.2006.03.15 (2006-03-15)]
[4.2006.03.14 (2006-03-14)]
[3.2005.8.28 (2005-08-30)]
[2.2005.8.16 (2005-08-16)]
[2.2005.8.15 (2005-08-15)]
[1.2005.8.8 (2005-08-15)]
[2.2005.8.8 (2005-08-15)]
|