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: res = conn.execute(sql) 54: yield res if block_given? 55: nil 56: rescue SwiftError => e 57: raise_error(e) 58: end 59: end 60: end
Run the DELETE/UPDATE SQL on the database and return the number of matched rows.
# File lib/sequel/adapters/swift/postgres.rb, line 64 64: def execute_dui(sql, opts={}) 65: synchronize(opts[:server]) do |conn| 66: begin 67: conn.execute(sql).rows 68: rescue SwiftError => e 69: raise_error(e) 70: end 71: end 72: end
Run the INSERT SQL on the database and return the primary key for the record.
# File lib/sequel/adapters/swift/postgres.rb, line 76 76: def execute_insert(sql, opts={}) 77: synchronize(opts[:server]) do |conn| 78: begin 79: conn.execute(sql) 80: insert_result(conn, opts[:table], opts[:values]) 81: rescue SwiftError => e 82: raise_error(e) 83: end 84: end 85: end