On Tue, Dec 04, 2001 at 08:00:15PM +0100, Flemming Frandsen wrote:
> Tim Bunce wrote:
> > 
> > I'd rather not go that way (I don't like solutions that require
> > mangling the sql in odd ways).
> 
> Hmm, ok then.
>  
> 
> > I think I'd rather optionally ignore placeholders named ':old' and ':new'.
> > Also, I think there was a patch floating around that optionally
> > disabled :foo style placeholders. That would also suffice.
> 
> Ok, here it is, it ignores and passes through stuff that starts out like
> a : placeholder and ends with a ., as far as I know there is no use for
> a dot right after a placeholder so this ought to be 100% safe and
> transparent.

I was going to suggest that originally but I suspect there is valid
trigger syntax that uses :old or :new without a trailing .fieldname.
(I'm pretty sure there is for Oracle.)

However, if you're happy with this more limited solution then it's
fine by me. But I don't maintain the driver.

Tim.

> This means that there is no need to have :: in the SAPDB code, whee!
> 
> 
> --- orig/DBD-ODBC-0.29/dbdimp.c Thu Nov  8 10:48:01 2001
> +++ DBD-ODBC-0.29/dbdimp.c      Tue Dec  4 19:51:27 2001
> @@ -183,16 +183,15 @@
>       * and level 2+ just to indicate that we are trying SQLConnect.
>       */
>      if (!SQL_ok(rc)) {
> +       if (DBIS->debug > 3) {
>  #ifdef DBD_ODBC_NO_SQLDRIVERCONNECT
>         PerlIO_printf(DBILOGFP, "SQLDriverConnect unsupported.\n");
>  #else
> -       if (DBIS->debug > 3) {
>             PerlIO_printf(DBILOGFP, "SQLDriverConnect failed:\n");
>             AllODBCErrors(imp_dbh->henv, imp_dbh->hdbc, 0, 1);
> -       }
> -
>  #endif /* DriverConnect supported */
> -
> +       }
> +
>         if (DBIS->debug >= 2)
>             PerlIO_printf(DBILOGFP, "SQLConnect '%s', '%s', '%s'\n",
> dbname, uid, pwd);
> 
> @@ -488,18 +487,27 @@
>             while(isDIGIT(*src))
>                 *p++ = *src++;
>             *p = 0;
> +
>             style = 1;
>         }
>         else if (isALNUM(*src)) {       /* ':foo'       */
>             char *p = name;
> -           *dest++ = '?';
> 
>             while(isALNUM(*src))        /* includes '_' */
>                 *p++ = *src++;
>             *p = 0;
> +
> +           if (*src == '.') { /* Ignore :new.field, for sapdb triggers
> */
> +               *dest++ = ':';
> +               strcpy(dest, name);
> +               dest += strlen(name);
> +               continue;
> +           }
> +
> +           *dest++ = '?';
>             style = 2;
>         }
> 
> -- 
>  Regards Flemming Frandsen aka. Dion/Swamp http://dion.swamp.dk

Reply via email to