Included Modules

Class/Module Index [+]

Quicksearch

Sequel::DB2::Database

Constants

TEMPORARY

Public Instance Methods

connect(server) click to toggle source

check_error(rc, “Could not allocate DB2 environment”)

# File lib/sequel/adapters/db2.rb, line 15
def connect(server)
  opts = server_opts(server)
  rc, dbc = SQLAllocHandle(SQL_HANDLE_DBC, @@env) 
  check_error(rc, "Could not allocate database connection")
  
  rc = SQLConnect(dbc, opts[:database], opts[:user], opts[:password]) 
  check_error(rc, "Could not connect to database")
  
  dbc
end
dataset(opts = nil) click to toggle source
# File lib/sequel/adapters/db2.rb, line 31
def dataset(opts = nil)
  DB2::Dataset.new(self, opts)
end
do(sql, opts={}) click to toggle source
Alias for: execute
execute(sql, opts={}) click to toggle source
# File lib/sequel/adapters/db2.rb, line 35
def execute(sql, opts={})
  synchronize(opts[:server]) do |conn|
    rc, sth = SQLAllocHandle(SQL_HANDLE_STMT, @handle) 
    check_error(rc, "Could not allocate statement")

    begin
      rc = log_yield(sql){SQLExecDirect(sth, sql)}
      check_error(rc, "Could not execute statement")
      
      yield(sth) if block_given?

      rc, rpc = SQLRowCount(sth)
      check_error(rc, "Could not get RPC") 
      rpc
    ensure
      rc = SQLFreeHandle(SQL_HANDLE_STMT, sth)
      check_error(rc, "Could not free statement")
    end
  end
end
Also aliased as: do
test_connection(server=nil) click to toggle source
# File lib/sequel/adapters/db2.rb, line 26
def test_connection(server=nil)
  synchronize(server){|conn|}
  true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.