Class: DBI::DBD::OCI8::Statement

Inherits:
BaseStatement
  • Object
show all
Includes:
Util
Defined in:
lib/DBD/OCI8/OCI8.rb

Constant Summary

Constants included from Util

Util::ERROR_MAP

Instance Method Summary collapse

Methods included from Util

#raise_dbierror

Constructor Details

#initialize(cursor) ⇒ Statement

Returns a new instance of Statement.



302
303
304
# File 'lib/DBD/OCI8/OCI8.rb', line 302

def initialize(cursor)
  @cursor = cursor
end

Instance Method Details

#__bind_value(param) ⇒ Object



373
374
375
# File 'lib/DBD/OCI8/OCI8.rb', line 373

def __bind_value(param)
  @cursor[param]
end

#__define(pos, type, length = nil) ⇒ Object



368
369
370
371
# File 'lib/DBD/OCI8/OCI8.rb', line 368

def __define(pos, type, length = nil)
  @cursor.define(pos, type, length)
  self
end

#__rowidObject



364
365
366
# File 'lib/DBD/OCI8/OCI8.rb', line 364

def __rowid
  @cursor.rowid
end

#bind_param(param, value, attribs) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/DBD/OCI8/OCI8.rb', line 306

def bind_param( param, value, attribs)
  if attribs.nil? || attribs['type'].nil?
    if value.nil?
	@cursor.bind_param(param, nil, String, 1)
    else
	@cursor.bind_param(param, value)
    end
  else
    case attribs['type']
    when SQL_BINARY
	type = OCI_TYPECODE_RAW
    else
	type = attribs['type']
    end
    @cursor.bind_param(param, value, type)
  end
rescue OCIException => err
  raise_dbierror(err)
end

#column_infoObject



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/DBD/OCI8/OCI8.rb', line 344

def column_info
  # minimum implementation.
  @cursor..collect do |md|
    col = (md)
    col['indexed']   = nil
    col['primary']   = nil
    col['unique']    = nil
    col['default']   = nil
    col
  end
rescue OCIException => err
  raise_dbierror(err)
end

#executeObject



326
327
328
329
330
# File 'lib/DBD/OCI8/OCI8.rb', line 326

def execute
  @cursor.exec
rescue OCIException => err
  raise_dbierror(err)
end

#fetchObject



338
339
340
341
342
# File 'lib/DBD/OCI8/OCI8.rb', line 338

def fetch
  @cursor.fetch
rescue OCIException => err
  raise_dbierror(err)
end

#finishObject



332
333
334
335
336
# File 'lib/DBD/OCI8/OCI8.rb', line 332

def finish
  @cursor.close
rescue OCIException => err
  raise_dbierror(err)
end

#rowsObject



358
359
360
361
362
# File 'lib/DBD/OCI8/OCI8.rb', line 358

def rows
  @cursor.row_count
rescue OCIException => err
  raise_dbierror(err)
end