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
# File lib/sequel/adapters/db2.rb, line 31 def dataset(opts = nil) DB2::Dataset.new(self, opts) end
# 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
Generated with the Darkfish Rdoc Generator 2.