Class: DBI::DBD::OCI8::BindType::DBIStatementHandle
- Inherits:
-
OCI8::BindType::Cursor
- Object
- OCI8::BindType::Cursor
- DBI::DBD::OCI8::BindType::DBIStatementHandle
- Defined in:
- lib/dbd/OCI8.rb
Overview
helper class to bind ref cursor as DBI::StatementHandle.
# Create package
dbh.execute(<<EOS)
create or replace package test_pkg is
type ref_cursor is ref cursor;
procedure tab_table(csr out ref_cursor);
end;
EOS
# Create package body
dbh.execute(<<EOS)
create or replace package body test_pkg is
procedure tab_table(csr out ref_cursor) is
begin
open csr for select * from tab;
end;
end;
EOS
# Execute test_pkg.tab_table.
# The first parameter is bound as DBI::StatementHandle.
plsql = dbh.execute("begin test_pkg.tab_table(?); end;", DBI::StatementHandle)
# Get the first parameter, which is a DBI::StatementHandle.
sth = plsql.func(:bind_value, 1)
# fetch column data.
sth.fetch_all
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.decorate(b) ⇒ Object
569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/dbd/OCI8.rb', line 569 def decorate(b) def b.set(val) raise NotImplementedError end def b.get() val = super return val if val.nil? cur = ::OCI8::Cursor.new(@env, @svc, @ctx, val) stmt = DBI::DBD::OCI8::Statement.new(cur) DBI::StatementHandle.new(stmt, *DBI_STMT_NEW_ARGS) end end |