Tim Bunce wrote:
> On Mon, Feb 04, 2002 at 04:00:35PM -0000, [EMAIL PROTECTED] wrote:
> > It just looked to me like we were see-sawing.
>
> FYI the mediumterm plan is for the DBI's new preparse code to be
> used by all the drivers to provide this kind of functionality
> (via a perl code and/or a pointer to a C function).
DBD::Informix did use it once (back in the very old days).
I then found where it broke on Informix non-standard syntax:
INSERT INTO somedb@someserver:owner.table
VALUES (DATETIME(12:23:59.999) HOUR TO FRACTION);
The :owner got translated to question mark - NBG.
The :23 and :59 got translated question mark - NBG either.
Neither colon-prefixed pseudo-placeholder notation can be used safely in
Informix.
Could you escape your way out of trouble? Maybe, but it is probably not
worth it.
Add variant comment conventions into the mix (and things like optimizer
hints that aren't comments
but look like comments), and you get real hell to play with. Especially
since Informix now has some things that superficially look like comments
but which, by virtue of the context they are in, are not comments after
all:
INSERT INTO somedb:{comment}table
VALUES{}({comment}SET{{comment}1{},{}2{}}OF{}INT{}){};
Given that braces enclose comments (but, for example, C-style comments
are just a syntax error), it is immediately obvious that SET (and
MULTISET and LIST) followed by braces does not mark a comment after all,
but a constructor for a SET of INT. Of course, you can use the SQL
standard --to-end-of-line comment style between the SET and the opening
brace of the constructor. Ugh! You really do not want to mess with
this -- I sure as hell don't either, but I'm stuck with it. I have to
damn well pre-parse the SQL since I can't get a decent count of the
input parameters back from Informix.
Just a heads up; you may find that some other database drivers will have
an equally hard time using any standard version of preparse() -- though
I doubt if any others are as bad as Informix.
--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED])
Guardian of DBD::Informix 1.00.PC1 -- see http://www.cpan.org/
#include <disclaimer.h>