Problems with bind variables with DBD::Oracle 1.21 on Leopard (MacOSX 10.5.2)

Problems with bind variables with DBD::Oracle 1.21 on Leopard (MacOSX 10.5.2)

Post by mdr » Wed, 30 Apr 2008 01:22:13


With Oracle having finally come out with native Intel drivers for
MacOS, I tried to install these to get rid of having to use a Rosetta-
ized version of perl to run Oracle things through, but kept running
into a problem where sometimes bind variables would work, and
sometimes I would get things like:

ORA-00911: invalid character (DBD ERROR: error possibly near <*>
indicator at char 77 in '
SELECT
System_User_ID,
'1' Hey
FROM
System_User
WHERE
Login LIKE <*>? ESCAPE '\'

After more investigation, I determined that any query that contained a
literal quote would die like this, and any query that did not was
fine. It seems that there is an error in dbdimp.c where is_literal is
defined as a bool but then used as a char. This triggers the
behavior, at least GCC 4.0.1 on the Mac and possibly other GCC4
platforms, where is_literal will get the value 1, and not the value of
the literal type, so that the end of the literal is never seen. The
following patches this so that the behavior is correct and things work:

*** dbdimp.c.orig Mon Apr 28 12:08:50 2008
--- dbdimp.c Mon Apr 28 12:09:07 2008
***************
*** 1096,1102 ****
{
dTHX;
D_imp_dbh_from_sth;
! bool in_literal = FALSE;
char in_comment = '\0';
char *src, *start, *dest;
phs_t phs_tpl;
--- 1096,1102 ----
{
dTHX;
D_imp_dbh_from_sth;
! char in_literal = '\0';
char in_comment = '\0';
char *src, *start, *dest;
phs_t phs_tpl;

-- Matt
 
 
 

Problems with bind variables with DBD::Oracle 1.21 on Leopard (MacOSX 10.5.2)

Post by scole » Wed, 30 Apr 2008 06:29:54

This was reported just a few days ago on rt cpan

http://www.yqcomputer.com/

I fixed it and checked it in. It will be in release 1.22 of DBD::Oracle

cheers
John Scoles