Excellent! Many thanks Alan.

Tim.

On Tue, Jul 17, 2001 at 03:48:54PM +0100, Alan Burlison wrote:
> Tim Bunce wrote:
> 
> > It's probably the OCIBindByName call in dbd_rebind_ph() in dbdimp.c.
> > 
> > Enabling trace level 9 will show the OCI calls (modulo the effects of
> > any 64bit issues in the printf code in ocitrace.h :-) Might be worth
> > checking/fixing that first then comparing runs with 32bit and 64bit perls.
> 
> Here is the culprit from the trace:
> 
>     >> bind_param  DISPATCH (DBI::st=HASH(0x194bc0) rc2/1 @4 g0 a1263f0) at
> t/long.t line 131.
>     -> bind_param for DBD::Oracle::st (DBI::st=HASH(0x194bc0)~0x194c14 2
> undef HASH(0x194cc8))
>        bind :p2 <== undef (type 0, attribs: HASH(0x194cc8))
>        bind :p2 <== undef (NULL, size 0/0/0, ptype 4, otype 24)
>        bind :p2 <== '' (size 0/-1, otype 24, indp -1, at_exec 1)
> OCIBindByName(29621c,1ef174,17ee9c,":p2",3,0,-1,24,1ef186,0,1ef184,0,0,2)=ERROR
> OCIErrorGet(17ee9c,1,"<NULL>",ffbfea68,"ORA-02005: implicit (-1) length not
> valid for this bind or define datatype",1024,2)=SUCCESS
>     OCIErrorGet after OCIBindByName (er1:ok): -1, 2005: ORA-02005: implicit
> (-1) length not valid for this bind or define datatype
> 
> The trick was then to find out where phs->maxlen was being set to 0xFFFFFFFF
> (-1), which turned out to be in 
> dbd_rebind_ph_char, which puts the length of a SV (unsigned long) into
> phs->maxlen (signed long long), and then nastiness ensues.
> 
> Here is a patch.  I've tested this with a 64bitint perl, but I have to dash
> so I don't have time at the moment to check the non-64bitint case.
> 
> *** dbdimp.c.orig       Tue Jul 17 15:31:29 2001
> --- dbdimp.c    Tue Jul 17 15:32:37 2001
> ***************
> *** 795,801 ****
>         phs->progv = SvPV(phs->sv, value_len);
>       }
>       phs->sv_type = SvTYPE(phs->sv);   /* part of mutation check       */
> !     phs->maxlen  = SvLEN(phs->sv)-1;  /* avail buffer space           */
>       if (phs->maxlen < 0)              /* can happen with nulls        */
>         phs->maxlen = 0;
>   
> --- 795,801 ----
>         phs->progv = SvPV(phs->sv, value_len);
>       }
>       phs->sv_type = SvTYPE(phs->sv);   /* part of mutation check       */
> !     phs->maxlen  = ((IV)SvLEN(phs->sv))-1;    /* avail buffer space   */
>       if (phs->maxlen < 0)              /* can happen with nulls        */
>         phs->maxlen = 0;
> 
> --
> Alan Burlison
> --
> $ head -1 /dev/bollocks
> reinvent immersive channel segmentation

Reply via email to