K
KUBO Takehiro
Hi,
I've released ruby-oci8 0.1.10.
This is a Oracle module using OCI8 API.
URL:http://rubyforge.org/projects/ruby-oci8/
What's new:
1. bind a ref cursor as an OCI8::Cursor or a DBI::StatementHandle.
(requested by Stephen Flinter and Jason Sweat.)
Example:
# parse PL/SQL
plsql = conn.parse("BEGIN OPEN :cursor FOR SELECT * FROM emp; END;")
# bind :cursor as OCI8::Cursor
plsql.bind_param(':cursor', OCI8::Cursor)
# execute
plsql.exec
# get a bind value, which is an OCI8::Cursor.
cursor = plsql[':cursor']
# fetch results from the cursor.
while r = cursor.fetch()
puts r.join(',')
end
or
# parse/bind/execute PL/SQL
sth1 = dbh.execute("BEGIN OPEN ? FOR SELECT * FROM emp; END;", DBI::StatementHandle)
# get a bind value, which is a DBI::StatementHandle.
sth2 = sth1.funcbind_value, 1)
# fetch results from the statement handle.
while r = sth2.fetch()
puts r.join(',')
end
Restriction:
* bind a ref cursor as output, but not as input.
That means you can get it from a pl/sql block, can't pass it to
the block.
2. bind LONG / LONG RAW as 65535-byte String.
(suggested by Graham Jenkins.)
Restriction:
* If the length is longer than 65535, I don't know what happen.
I haven't tested yet. (Sorry)
3. customizable default column data type of select statements.
Many people (Dmitry Maksyoma, Maik and Graham Jenkins) have requested
to support TIMESTAMP. But I haven't supported it yet. Though you can
fetch a TIMESTAMP data as an OraDate by adding the following code to
your code.
OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::OraDate
To fetch a DATE(oracle) as a Time(ruby).
OCI8::BindType::Mapping[OCI8::SQLT_DAT] = OCI8::BindType::Time
To fetch a NUMBER(oracle) as a Float(ruby) at all times.
OCI8::BindType::Mapping[OCI8::SQLT_NUM] = OCI8::BindType::Float
I've released ruby-oci8 0.1.10.
This is a Oracle module using OCI8 API.
URL:http://rubyforge.org/projects/ruby-oci8/
What's new:
1. bind a ref cursor as an OCI8::Cursor or a DBI::StatementHandle.
(requested by Stephen Flinter and Jason Sweat.)
Example:
# parse PL/SQL
plsql = conn.parse("BEGIN OPEN :cursor FOR SELECT * FROM emp; END;")
# bind :cursor as OCI8::Cursor
plsql.bind_param(':cursor', OCI8::Cursor)
# execute
plsql.exec
# get a bind value, which is an OCI8::Cursor.
cursor = plsql[':cursor']
# fetch results from the cursor.
while r = cursor.fetch()
puts r.join(',')
end
or
# parse/bind/execute PL/SQL
sth1 = dbh.execute("BEGIN OPEN ? FOR SELECT * FROM emp; END;", DBI::StatementHandle)
# get a bind value, which is a DBI::StatementHandle.
sth2 = sth1.funcbind_value, 1)
# fetch results from the statement handle.
while r = sth2.fetch()
puts r.join(',')
end
Restriction:
* bind a ref cursor as output, but not as input.
That means you can get it from a pl/sql block, can't pass it to
the block.
2. bind LONG / LONG RAW as 65535-byte String.
(suggested by Graham Jenkins.)
Restriction:
* If the length is longer than 65535, I don't know what happen.
I haven't tested yet. (Sorry)
3. customizable default column data type of select statements.
Many people (Dmitry Maksyoma, Maik and Graham Jenkins) have requested
to support TIMESTAMP. But I haven't supported it yet. Though you can
fetch a TIMESTAMP data as an OraDate by adding the following code to
your code.
OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::OraDate
To fetch a DATE(oracle) as a Time(ruby).
OCI8::BindType::Mapping[OCI8::SQLT_DAT] = OCI8::BindType::Time
To fetch a NUMBER(oracle) as a Float(ruby) at all times.
OCI8::BindType::Mapping[OCI8::SQLT_NUM] = OCI8::BindType::Float