Hello Tim/all,
my dbish segfaulted when I selected an interval from 10g. I narrowed
it down to
$dbh->selectall_arrayref(q! select to_dsinterval(?) from dual !,
{}, "1 07:00:00");
leading to
dbd_describe SELECT (EXPLICIT, lb 2000)...
OCIStmtExecute(828003c,8287210,82800b0,0,0,0,0,16)=SUCCESS
OCIAttrGet(8287210,OCI_HTYPE_STMT,bfffebdc,0,18,82800b0)=SUCCESS
[...]
OCIAttrGet(8286f74,OCI_DTYPE_PARAM,82b76a3,0,7,82800b0)=SUCCESS
OCIAttrGet(8286f74,OCI_DTYPE_PARAM,82b76a4,bfffebd8,4,82800b0)=SUCCESS
Field 1 has an Oracle type (190) which is not explicitly supported
col 1: dbtype 190, scale 9, prec 9, nullok 1, name TO_DSINTERVAL(:P1)
: dbsize 11, char_used 0, char_size 0, csid 0, csform 0, disize 11
fbh 1: 'TO_DSINTERVAL(:P1)' NULLable, otype 190->190, dbsize 11/11, p9.s9
OCIAttrSet(8287210,OCI_HTYPE_STMT,bfffebd4,4,13,82800b0)=SUCCESS
OCIAttrSet(8287210,OCI_HTYPE_STMT,bfffebd0,4,11,82800b0)=SUCCESS
OCIDefineByPos(8287210,82b768c,82800b0,1,82b7030,11,190,82b7328,82b76d0,82b74e8,0)=SUCCESS
dbd_describe'd 1 columns (row bytes: 11 max, 11 est avg, cache: 608)
[...]
dbd_st_execute SELECT (out0, lob0)...
in ':p1' [0,0]: len 10, ind 0
OCIStmtExecute(828003c,8287210,82800b0,0,0,0,0,0)=SUCCESS
OCIAttrGet(8287210,OCI_HTYPE_STMT,bffff3e6,0,10,82800b0)=SUCCESS
dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
dbd_st_fetch 1 fields...
Segmentation fault
Since I use to_dsinterval function, I expect Oracle to return type of
INTERVAL DAY TO SECOND. Here, dbtype says 190. So I went to oci8.c
and here I only found 183 as a DAY TO SECOND INTERVAL.
So, without investigating further, I did
--- oci8.c.orig 2005-06-06 10:31:38.000000000 +0200
+++ oci8.c 2005-06-06 10:35:29.000000000 +0200
@@ -1207,6 +1207,7 @@
case 182: /* INTERVAL YEAR TO MONTH */
case 183: /* INTERVAL DAY TO SECOND */
+ case 190: /* INTERVAL DAY TO SECOND */
case 187: /* TIMESTAMP */
case 188: /* TIMESTAMP WITH TIME ZONE */
case 232: /* TIMESTAMP WITH LOCAL TIME ZONE */
leading to
col 1: dbtype 190, scale 9, prec 9, nullok 1, name TO_DSINTERVAL(:P1)
: dbsize 11, char_used 0, char_size 0, csid 0, csform 0, disize 75
fbh 1: 'TO_DSINTERVAL(:P1)' NULLable, otype 190-> 5, dbsize 11/76, p9.s9
[...]
dbd_st_execute SELECT (out0, lob0)...
in ':p1' [0,0]: len 10, ind 0
OCIStmtExecute(828003c,8287210,82800b0,0,0,0,0,0)=SUCCESS
OCIAttrGet(8287210,OCI_HTYPE_STMT,bffff3e6,0,10,82800b0)=SUCCESS
dbd_st_execute SELECT returned (SUCCESS, rpc0, fn4, out0)
dbd_st_fetch 1 fields...
OCIStmtFetch(8287210,82800b0,1,2,0)=SUCCESS
dbih_setup_fbav for 1 fields => 0x82b5ba8
dbd_st_fetch 1 fields SUCCESS
0 (rc=0): "+000000001 07:00:00.000000000"
dbd_st_fetch 1 fields...
OCIStmtFetch(8287210,82800b0,1,2,0)=NO_DATA
dbd_st_fetch no-more-data
which got me happy since it gives me the interval value alright.
Please let me know if I should do some more tests for other rare
types of 10g. If you give me a hint how 10g-specific tests should be
done in t/*.t, I can provide some additions to the test suite as
well.
If you do not want to dig into the interval issues, please, just apply
the patch above. ;-)
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | [EMAIL PROTECTED] | http://www.fi.muni.cz/~adelton/
.project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
Only self-confident people can be simple.