Tim Bunce wrote:

On Thu, Feb 05, 2004 at 10:50:46AM +0000, Charles Jardine wrote:

If not, would it be useful if I re-worked the patch for
version 1.15.


That would be great. Thanks.


A re-worked patch to make placeholder binding in DBD::Oracle
case insensitive is attached.

--
Charles Jardine - Computing Service, University of Cambridge
[EMAIL PROTECTED]    Tel: +44 1223 334506, Fax: +44 1223 334679
Common subdirectories: DBD-Oracle-1.15/Oracle.ex and 
DBD-Oracle-1.15.placeholder-patch/Oracle.ex
diff -u -r DBD-Oracle-1.15/dbdimp.c DBD-Oracle-1.15.placeholder-patch/dbdimp.c
--- DBD-Oracle-1.15/dbdimp.c    Sat Jan 10 00:00:36 2004
+++ DBD-Oracle-1.15.placeholder-patch/dbdimp.c  Wed Feb 11 11:12:35 2004
@@ -934,7 +934,7 @@
 
        } else if (isALNUM(*src)) {     /* ':foo'       */
            while(isALNUM(*src))        /* includes '_' */
-               *dest++ = *src++;
+               *dest++ = toLOWER(*src), src++;
            style = ":foo";
        } else {                        /* perhaps ':=' PL/SQL construct */
            /* if (src == ':') *dest++ = *src++; XXX? move past '::'? */
@@ -1451,7 +1451,7 @@
     SV **phs_svp;
     STRLEN name_len;
     char *name = Nullch;
-    char namebuf[30];
+    char namebuf[32];  /* ':' + 30 char name + '\0' */
     phs_t *phs;
 
     /* check if placeholder was passed as a number     */
@@ -1459,7 +1459,13 @@
     if (SvGMAGICAL(ph_namesv)) /* eg if from tainted expression */
        mg_get(ph_namesv);
     if (!SvNIOKp(ph_namesv)) {
+       int i;
        name = SvPV(ph_namesv, name_len);
+       if (name_len>31)
+           croak("Placeholder name too long (%s)", neatsvpv(ph_namesv,0));
+       for (i=0; i<name_len; i++) namebuf[i] = toLOWER(name[i]);
+       namebuf[i] = '\0';
+       name = namebuf;
     }
     if (SvNIOKp(ph_namesv) || (name && isDIGIT(name[0]))) {
        sprintf(namebuf, ":p%d", (int)SvIV(ph_namesv));
Common subdirectories: DBD-Oracle-1.15/hints and 
DBD-Oracle-1.15.placeholder-patch/hints
Common subdirectories: DBD-Oracle-1.15/lib and DBD-Oracle-1.15.placeholder-patch/lib
Common subdirectories: DBD-Oracle-1.15/t and DBD-Oracle-1.15.placeholder-patch/t
Common subdirectories: DBD-Oracle-1.15/lib/DBD and 
DBD-Oracle-1.15.placeholder-patch/lib/DBD
Common subdirectories: DBD-Oracle-1.15/lib/DBD/Oracle and 
DBD-Oracle-1.15.placeholder-patch/lib/DBD/Oracle
diff -u -r DBD-Oracle-1.15/t/general.t DBD-Oracle-1.15.placeholder-patch/t/general.t
--- DBD-Oracle-1.15/t/general.t Fri Jan  9 20:48:00 2004
+++ DBD-Oracle-1.15.placeholder-patch/t/general.t       Wed Feb 11 11:38:18 2004
@@ -32,10 +32,13 @@
 
 $sth = $dbh->prepare(q{
        /* also test preparse doesn't get confused by ? :1 */
-       select * from user_tables -- ? :1
+        /* also test placeholder binding is case insensitive */
+       select :a, :A from user_tables -- ? :1
 });
 ok(0, $sth->{ParamValues});
-ok(0, keys %{$sth->{ParamValues}} == 0);
+ok(0, keys %{$sth->{ParamValues}} == 1);
+ok(0, $sth->{NUM_OF_PARAMS} == 1);
+ok(0, $sth->bind_param(':a', 'a value'));
 ok(0, $sth->execute);
 ok(0, $sth->{NUM_OF_FIELDS});
 eval { $p1=$sth->{NUM_OFFIELDS_typo} };
@@ -89,7 +92,7 @@
 ok(0, !$dbh->ping);
 
 exit 0;
-BEGIN { $tests = 24 }
+BEGIN { $tests = 26 }
 # end.
 
 __END__

Reply via email to