Module: Sequel::Postgres::AutoParameterize::DatabaseMethods
- Defined in:
- lib/sequel/extensions/pg_auto_parameterize.rb
Class Method Summary collapse
-
.extended(db) ⇒ Object
Extend the database’s datasets with the necessary code.
Instance Method Summary collapse
-
#execute(sql, opts = {}) ⇒ Object
If the sql string has an embedded parameter array, extract the arguments from that.
-
#execute_insert(sql, opts = {}) ⇒ Object
If the sql string has an embedded parameter array, extract the arguments from that.
Class Method Details
.extended(db) ⇒ Object
Extend the database’s datasets with the necessary code.
89 90 91 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 89 def self.extended(db) db.extend_datasets(DatasetMethods) end |
Instance Method Details
#execute(sql, opts = {}) ⇒ Object
If the sql string has an embedded parameter array, extract the arguments from that.
95 96 97 98 99 100 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 95 def execute(sql, opts={}) if sql.is_a?(StringWithArray) && (args = sql.args) opts = opts.merge(:arguments=>args) end super end |
#execute_insert(sql, opts = {}) ⇒ Object
If the sql string has an embedded parameter array, extract the arguments from that.
104 105 106 107 108 109 |
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 104 def execute_insert(sql, opts={}) if sql.is_a?(StringWithArray) && (args = sql.args) opts = opts.merge(:arguments=>args) end super end |