Class/Module Index [+]

Quicksearch

Sequel::Swift::Postgres::DatabaseMethods

Methods to add to Database instances that access PostgreSQL via Swift.

Public Class Methods

extended(db) click to toggle source

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
def self.extended(db)
  db.instance_eval do
    @primary_keys = {}
    @primary_key_sequences = {}
  end
end

Public Instance Methods

execute(sql, opts={}) click to toggle source

Run the SELECT SQL on the database and yield the rows

# File lib/sequel/adapters/swift/postgres.rb, line 45
def execute(sql, opts={})
  synchronize(opts[:server]) do |conn|
    begin
      res = conn.execute(sql)
      yield res if block_given?
      nil
    rescue SwiftError => e
      raise_error(e)
    end
  end
end
execute_dui(sql, opts={}) click to toggle source

Run the DELETE/UPDATE SQL on the database and return the number of matched rows.

# File lib/sequel/adapters/swift/postgres.rb, line 59
def execute_dui(sql, opts={})
  synchronize(opts[:server]) do |conn|
    begin
      conn.execute(sql).rows
    rescue SwiftError => e
      raise_error(e)
    end
  end
end
execute_insert(sql, opts={}) click to toggle source

Run the INSERT SQL on the database and return the primary key for the record.

# File lib/sequel/adapters/swift/postgres.rb, line 71
def execute_insert(sql, opts={})
  synchronize(opts[:server]) do |conn|
    begin
      conn.execute(sql)
      insert_result(conn, opts[:table], opts[:values])
    rescue SwiftError => e
      raise_error(e)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.