module Sequel::Postgres::AutoParameterize::DatabaseMethods
Public Class Methods
extended(db)
click to toggle source
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 199 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
Public Instance Methods
execute(sql, opts={})
click to toggle source
If the sql string has an embedded parameter array, extract the parameter values from that.
Calls superclass method
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 208 def execute(sql, opts={}) if sql.is_a?(QueryString) && (args = sql.args) opts = opts.merge(:arguments=>args) end super end
Private Instance Methods
_no_auto_parameterize(table)
click to toggle source
Disable automatic parameterization for the given table if supported.
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 236 def _no_auto_parameterize(table) if table.is_a?(DatasetMethods) table.no_auto_parameterize else table end end
copy_table_sql(table, opts=OPTS)
click to toggle source
Disable auto_parameterization during COPY TABLE.
Calls superclass method
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 218 def copy_table_sql(table, opts=OPTS) table = _no_auto_parameterize(table) super end
create_table_as(name, sql, options)
click to toggle source
Disable auto_parameterization during CREATE TABLE AS.
Calls superclass method
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 224 def create_table_as(name, sql, options) sql = _no_auto_parameterize(sql) super end
create_view_sql(name, source, options)
click to toggle source
Disable auto_parameterization during CREATE VIEW.
Calls superclass method
# File lib/sequel/extensions/pg_auto_parameterize.rb, line 230 def create_view_sql(name, source, options) source = _no_auto_parameterize(source) super end