"Jeffrey W. Baker" wrote:

> On Sun, 2002-03-10 at 06:22, Jason E. Stewart wrote:
> > "Jeffrey W. Baker" <[EMAIL PROTECTED]> writes:
> >
> > > Binding is simplified: simply scan for the desired placeholder name and
> > > copy the value and data type.  Execution is simplified because we need
> > > not reparse the statement.  The bound values need to be quoted and
> > > escaped, then all the parts of the statement copied into the output
> > > buffer and forwarded to the database library.
> > >
> > > It sounds prety good to me, but I'd like to hear what other DBD
> > > maintainers think about this plan.
> >
> > Is there some reason that each individual DBD maintainer needs to
> > write this kind of code? To my naive ears it sounds like something
> > that's generally useful. Yes, different backends support different
> > placeholder syntax, but that ought to be something that can be made
> > generic and configurable in the parser, shouldn't it?
>
> I had the same thought initially.  There is probably a useful syntax
> supported by all drivers.  But a user already familiar with PostgreSQL's
> syntax will expect to use the same syntax in a Perl program.  PG
> supports /* comments */ and -- comments.  Quotes are escaped with '' or
> \'.  Using \ as the escape character requires \\ to make a real slash.
> A quoted literal can be replaced with its octal representation from
> ASCII, like \146\157\157 and so forth.

And, for contrast mainly, Informix does not support C-style comments but does
support Pascal-style {comments} instead -- except that {+...} is an optimizer
hint, and in certain circumstances, { marks the start of a collection literal -
so comments are context sensitive.
Informix can use double quotes around strings (or, occasionally, identifiers;
it depends on the setting of an environment variable) as well as single quotes
around strings.   Informix does not support octal or backslash escapes.  And
both :foo and :12 can appear in contexts that are not placeholders.  So,
DBD::Informix has its own pre-parser, different again from any other drivers
pre-parser.

> Sticking the parser into the
> DBD shouldn't be difficult, as long as the author doesn't punish himself
> too much.

I'm not quite sure what this means, but certainly DBD::Informix was actually
unable to use the pre-parser code from one version of DBI or DBD::Oracle (I
forget now which I used, but I borrowed it, and released it, and thenreplaced
it with an independent entity).

--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED])
Guardian of DBD::Informix 1.00.PC2 -- see http://dbi.perl.org/
#include <disclaimer.h>


Reply via email to