class Sequel::Swift::Database

  1. lib/sequel/adapters/swift.rb
Parent: Swift

Attributes

swift_class [RW]

The Swift adapter class being used by this database. Connections in this database’s connection pool will be instances of this class.

Public Instance methods

connect (server)

Create an instance of #swift_class for the given options.

[show source]
# File lib/sequel/adapters/swift.rb, line 41
def connect(server)
  opts = server_opts(server)
  opts[:pass] = opts[:password]
  setup_connection(swift_class.new(opts))
end
execute (sql, opts=OPTS)

Execute the given SQL, yielding a Swift::Result if a block is given.

[show source]
# File lib/sequel/adapters/swift.rb, line 48
def execute(sql, opts=OPTS)
  synchronize(opts[:server]) do |conn|
    begin
      res = log_yield(sql){conn.execute(sql)}
      yield res if block_given?
      nil
    rescue ::Swift::Error => e
      raise_error(e)
    end
  end
end
execute_dui (sql, opts=OPTS)

Execute the SQL on the this database, returning the number of affected rows.

[show source]
# File lib/sequel/adapters/swift.rb, line 62
def execute_dui(sql, opts=OPTS)
  synchronize(opts[:server]) do |conn|
    begin
      log_yield(sql){conn.execute(sql).affected_rows}
    rescue ::Swift::Error => e
      raise_error(e)
    end
  end
end
execute_insert (sql, opts=OPTS)

Execute the SQL on this database, returning the primary key of the table being inserted to.

[show source]
# File lib/sequel/adapters/swift.rb, line 74
def execute_insert(sql, opts=OPTS)
  synchronize(opts[:server]) do |conn|
    begin
      log_yield(sql){conn.execute(sql).insert_id}
    rescue ::Swift::Error => e
      raise_error(e)
    end
  end
end