Class: Sequel::IBMDB::Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/adapters/ibmdb.rb

Overview

Wraps results returned by queries on IBM_DB.

Instance Method Summary (collapse)

Constructor Details

- (Statement) initialize(stmt)

Hold the given statement.



124
125
126
# File 'lib/sequel/adapters/ibmdb.rb', line 124

def initialize(stmt)
  @stmt = stmt
end

Instance Method Details

- (Object) affected

Return the number of rows affected.



129
130
131
# File 'lib/sequel/adapters/ibmdb.rb', line 129

def affected
  IBM_DB.num_rows(@stmt)
end

- (Object) execute(*values)

If this statement is a prepared statement, execute it on the database with the given values.



135
136
137
# File 'lib/sequel/adapters/ibmdb.rb', line 135

def execute(*values)
  IBM_DB.execute(@stmt, values)
end

- (Object) fetch_array

Return the results of a query as an array of values.



140
141
142
# File 'lib/sequel/adapters/ibmdb.rb', line 140

def fetch_array
  IBM_DB.fetch_array(@stmt) if @stmt
end

- (Object) field_name(ind)

Return the field name at the given column in the result set.



145
146
147
# File 'lib/sequel/adapters/ibmdb.rb', line 145

def field_name(ind)
  IBM_DB.field_name(@stmt, ind)
end

- (Object) field_precision(key)

Return the field precision for the given field name in the result set.



155
156
157
# File 'lib/sequel/adapters/ibmdb.rb', line 155

def field_precision(key)
  IBM_DB.field_precision(@stmt, key)
end

- (Object) field_type(key)

Return the field type for the given field name in the result set.



150
151
152
# File 'lib/sequel/adapters/ibmdb.rb', line 150

def field_type(key)
  IBM_DB.field_type(@stmt, key)
end

- (Object) free

Free the memory related to this statement.



160
161
162
# File 'lib/sequel/adapters/ibmdb.rb', line 160

def free
  IBM_DB.free_stmt(@stmt)
end

- (Object) free_result

Free the memory related to this result set, only useful for prepared statements which have a different result set on every call.



166
167
168
# File 'lib/sequel/adapters/ibmdb.rb', line 166

def free_result
  IBM_DB.free_result(@stmt)
end

- (Object) num_fields

Return the number of fields in the result set.



171
172
173
# File 'lib/sequel/adapters/ibmdb.rb', line 171

def num_fields
  IBM_DB.num_fields(@stmt)
end