Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#12 Default 'vtype' in DBD/Oracle/Oracle.rb Statement#bind_param

open
nobody
None
5
2003-06-04
2003-06-04
Anonymous
No

When using code like:

dbH.execute('SELECT * FROM TableName WHERE
RecIDName=:1', record)

where 'RecIDName' is a CHAR(8) type, the comparison
will fail and #fetch returns nil rows, every time. If
I patch the DBD/Oracle/Oracle.rb file
(lib/dbd_oracle/Oracle.rb in the source):

--- lib/dbd_oracle/Oracle.rb Wed Jul 3 17:48:35 2002
+++ lib/dbd_oracle/Oracle.rb.new Wed Jun 4
13:47:13 2003
@@ -267,8 +267,9 @@
if value.is_a? DBI::Binary
vtype = LONG_RAW
else
- vtype = VARCHAR2
+ vtype = nil
+ #vtype = VARCHAR2
end

param = ":#{param}" if param.is_a? Fixnum
@handle.bindrv(param, value.to_s, vtype)

it works properly. I don't know enough about C-level
Oracle programming to say why, but Yoshida Masato's
Oracle7 module documents the ORACursor#bindrv:

bindrv(var, progv, ftype = CHAR)

i.e the default vtype/ftype is CHAR, not VARCHAR2.

Anyway, hope this helps.
--
Will (willr at rd dot bbc dot co dot uk)

Discussion