Module: DB2::DB2Util

Includes:
DB2CLI
Included in:
Connection, Environment, Statement
Defined in:
lib/active_record/vendor/db2.rb

Instance Method Summary collapse

Instance Method Details

#check_rc(rc) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_record/vendor/db2.rb', line 10

def check_rc(rc)
  if ![SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND].include?(rc)
    rec = 1
    msg = ''
    loop do
      a = SQLGetDiagRec(@handle_type, @handle, rec, 500)
      break if a[0] != SQL_SUCCESS
      msg << a[3] if !a[3].nil? and a[3] != '' # Create message.
      rec += 1
    end
    raise "DB2 error: #{msg}"
  end
end

#freeObject



7
# File 'lib/active_record/vendor/db2.rb', line 7

def free() SQLFreeHandle(@handle_type, @handle); end

#handleObject



8
# File 'lib/active_record/vendor/db2.rb', line 8

def handle() @handle; end