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

Inherits:
BaseStatement
  • Object
show all
Includes:
Util
Defined in:
lib/dbd/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.



329
330
331
# File 'lib/dbd/OCI8.rb', line 329

def initialize(cursor)
  @cursor = cursor
end

Instance Method Details

#__bind_value(param) ⇒ Object



400
401
402
# File 'lib/dbd/OCI8.rb', line 400

def __bind_value(param)
  @cursor[param]
end

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



395
396
397
398
# File 'lib/dbd/OCI8.rb', line 395

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

#__rowidObject



391
392
393
# File 'lib/dbd/OCI8.rb', line 391

def __rowid
  @cursor.rowid
end

#bind_param(param, value, attribs) ⇒ Object



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/dbd/OCI8.rb', line 333

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



371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/dbd/OCI8.rb', line 371

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



353
354
355
356
357
# File 'lib/dbd/OCI8.rb', line 353

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

#fetchObject



365
366
367
368
369
# File 'lib/dbd/OCI8.rb', line 365

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

#finishObject



359
360
361
362
363
# File 'lib/dbd/OCI8.rb', line 359

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

#rowsObject



385
386
387
388
389
# File 'lib/dbd/OCI8.rb', line 385

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