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

#initialize(stmt) ⇒ Statement

Hold the given statement.



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

def initialize(stmt)
  @stmt = stmt
end

Instance Method Details

#affectedObject

Return the number of rows affected.



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

def affected
  IBM_DB.num_rows(@stmt)
end

#execute(*values) ⇒ Object

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



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

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

#fetch_arrayObject

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



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

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

#field_name(ind) ⇒ Object

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



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

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

#field_precision(key) ⇒ Object

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



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

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

#field_type(key) ⇒ Object

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



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

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

#freeObject

Free the memory related to this statement.



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

def free
  IBM_DB.free_stmt(@stmt)
end

#free_resultObject

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



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

def free_result
  IBM_DB.free_result(@stmt)
end

#num_fieldsObject

Return the number of fields in the result set.



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

def num_fields
  IBM_DB.num_fields(@stmt)
end