Module: Sequel::Postgres::AutoParameterize::DatabaseMethods

Defined in:
lib/sequel/extensions/pg_auto_parameterize.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(db) ⇒ Object



200
201
202
203
204
205
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 200

def self.extended(db)
  unless (db.adapter_scheme == :postgres && USES_PG) || (db.adapter_scheme == :mock && db.database_type == :postgres)
    raise Error, "pg_auto_parameterize is only supported when using the postgres adapter with the pg driver"
  end
  db.extend_datasets(DatasetMethods)
end

Instance Method Details

#execute(sql, opts = {}) ⇒ Object

If the sql string has an embedded parameter array, extract the parameter values from that.



209
210
211
212
213
214
# File 'lib/sequel/extensions/pg_auto_parameterize.rb', line 209

def execute(sql, opts={})
  if sql.is_a?(QueryString) && (args = sql.args)
    opts = opts.merge(:arguments=>args)
  end
  super
end