Method: Sequel::IBMDB::Connection#prepare

Defined in:
lib/sequel/adapters/ibmdb.rb

#prepare(sql, ps_name) ⇒ Object

Prepare a statement with the given sql on the database, and cache the prepared statement value by name.



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/sequel/adapters/ibmdb.rb', line 104

def prepare(sql, ps_name)
  if stmt = IBM_DB.prepare(@conn, sql)
    ps_name = ps_name.to_sym
    stmt = Statement.new(stmt)
    @prepared_statements[ps_name] = [sql, stmt]
  else
    err = error_msg
    err = "Error preparing #{ps_name} with SQL: #{sql}" if error_msg.nil? || error_msg.empty?
    raise Error.new(err, error_sqlstate)
  end
end