Module | Sequel::Swift::Postgres::DatabaseMethods |
In: |
lib/sequel/adapters/swift/postgres.rb
|
Add the primary_keys and primary_key_sequences instance variables, so we can get the correct return values for inserted rows.
# File lib/sequel/adapters/swift/postgres.rb, line 37 37: def self.extended(db) 38: db.instance_eval do 39: @primary_keys = {} 40: @primary_key_sequences = {} 41: end 42: end
Return instance of Sequel::Swift::Postgres::Dataset with the given opts.
# File lib/sequel/adapters/swift/postgres.rb, line 45 45: def dataset(opts=nil) 46: Sequel::Swift::Postgres::Dataset.new(self, opts) 47: end
Run the SELECT SQL on the database and yield the rows
# File lib/sequel/adapters/swift/postgres.rb, line 50 50: def execute(sql, opts={}) 51: synchronize(opts[:server]) do |conn| 52: begin 53: conn.execute(sql) 54: res = conn.results 55: yield res if block_given? 56: rescue SwiftError => e 57: raise_error(e) 58: ensure 59: res.finish if res 60: end 61: end 62: end
Run the DELETE/UPDATE SQL on the database and return the number of matched rows.
# File lib/sequel/adapters/swift/postgres.rb, line 66 66: def execute_dui(sql, opts={}) 67: synchronize(opts[:server]) do |conn| 68: begin 69: conn.execute(sql) 70: rescue SwiftError => e 71: raise_error(e) 72: end 73: end 74: end
Run the INSERT SQL on the database and return the primary key for the record.
# File lib/sequel/adapters/swift/postgres.rb, line 78 78: def execute_insert(sql, opts={}) 79: synchronize(opts[:server]) do |conn| 80: begin 81: conn.execute(sql) 82: insert_result(conn, opts[:table], opts[:values]) 83: rescue SwiftError => e 84: raise_error(e) 85: end 86: end 87: end