[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dbi-dev
Subject:    Re: [Fwd: Question Mark parsing with DBI]
From:       Jonathan Leffler <jleffler () earthlink ! net>
Date:       2000-07-27 17:46:46
[Download RAW message or body]




Tim Bunce wrote:

> On Wed, Jul 26, 2000 at 11:05:21AM -0700, Michael Peppler wrote:
> > This is a problem with the statement parsing in DBD::Sybase.
> > It's a known problem, and there is no work-around at the moment
> > (other than not having question marks in comments...)
>
> It's be *very* happy for someone to volunteer to extract the
> placeholder parsing code from DBD::Oracle (and/or other drivers),
> generalise it, parameterize it and add it to the DBI so it could be
> shared by other drivers.
>
> p.s. It could then form the basis of adding ODBC style 'escape'
> functions to the DBI which would be a big step forward.

There's a general purpose function, sqltoken(), in the file sqltoken.c in the
DBD::Informix driver.  It is what DBD::Informix uses to tokenize SQL and
calculate how many placeholders there are in it.  The code has a couple of
Informix eccentricities -- primarily that {...} marks a comment, but {+hint}
is a hint.  IIRC, it treats comments as token delimiters but leaves hints as
valid tokens.  The other issue for compatibility with DBD::Oracle is that
in Informix's dialect of SQL, the :12 and :name type placeholders that Oracle
recognizes can be confused with legitimate, non-placeholder syntax in
Informix's SQL (specifically, :12 can appear as part of a DATETIME or
INTERVAL literal, and :name can appear as part of a table name in a
distributed environment (dbase@server:owner.table)).  Consequently,
DBD::Informix cannot (and never will) support :12 or :name style placeholders.

It would not be dreadfully difficult to add support for the official ODBC-style
escape notations.  It comes with a self-contained excruciating torture test
compiled
into the code when you use -DTEST on the compilation line:

cc -o sqltoken -DTEST sqltoken.c

Is that anything like what you're looking for?  The code which uses it is in the
DBD::Informix dbdimp.ec, of course.

--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
#include <disclaimer.h>




------------------------------------------------------------------------------
DBI HOME PAGE AND ARCHIVES: http://www.symbolstone.org/technology/perl/DBI/
To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html
If you are without web access, or if you are having trouble with the web page,
please send mail to dbi-dev-request@isc.org with the subject line of:
'unsubscribe'.
------------------------------------------------------------------------------ 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic