Module: Sequel::Postgres::HStore::DatabaseMethods

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(db) ⇒ Object


131
132
133
134
135
136
# File 'lib/sequel/extensions/pg_hstore.rb', line 131

def self.extended(db)
  db.instance_exec do
    add_named_conversion_proc(:hstore, &HStore.method(:parse))
    @schema_type_classes[:hstore] = HStore
  end
end

Instance Method Details

#bound_variable_arg(arg, conn) ⇒ Object

Handle hstores in bound variables


139
140
141
142
143
144
145
146
147
148
# File 'lib/sequel/extensions/pg_hstore.rb', line 139

def bound_variable_arg(arg, conn)
  case arg
  when HStore
    arg.unquoted_literal
  when Hash
    HStore.new(arg).unquoted_literal
  else
    super
  end
end