Jim Cromie wrote:

Jim Cromie wrote:

a poor subject line (was: and what about named placeholders ?),
and (perhaps) the wrong list (dbi-users).

So I request comments (consensus would be optimistic) and discussion
on whether/how to devise a feature set which would make named place-holders
free or almost free for most/all DBD::modules.

It may be that some subset can be free, additional feature require DBD participation.
Whether this A/B feature partition is needed is partly dependent on what
current modules do now.


From reading the DBI pod, its apparent that the specific capabilities of ? vary:

1.   some DBDs support them as column values only,
2.   most dont allow them as table-names,
3.   most require value to match entire column
      (ie colA like ?   BUT NOT  colA like 'foo?')

4. do any allow 'where colA in ( ?foolist ) # ie ?foolist is (notionally) an array

For DBD::Informix, with the numbers introduced by me:
1. Yes.
2. Agreed (placeholders are not allowed as either table names or column names).
3. Yes.
4. No.


My biggest concern is that you will misinterpret what Informix means if you see colA MATCHES "?foo". If you recognize that 'string' as a delimited identifier in your syntax analyzer, then you will be OK. If you don't recognize that as a single item, then you would be confusing legitimate Informix syntax with a named placeholder. (MATCHES is a variant of LIKE using shell-style metacharacters. Informix is pretty sloppy about allowing both single-quoted and double-quoted strings as strings - unless you force its hand with the DELIMIDENT environment variable.) The other complicating issue would be comment conventions; different drivers have different comment conventions. In particular, Informix supports SELECT * FROM WhereEver WHERE { ?which } x = 3;
Unless your code recognizes that the code inside braces is an Informix comment, it will interpret that ?which as a named placeholder. of course, nothing is ever simple. Informix also recognizes SET { 1, 2, 3 } :: INT as a set of three integers. And you could use placeholders instead of literal integers. That one is ghastly - look at the SQL tokenizer in DBD::Informix...sqltoken.c. Hmmm, there doesn't seem to be iustoken.c in the code - that's a defect. If you want that (which handles the SET and MULTISET and LIST notations which use curly brackets), you'd have to get hold of SQLCMD from the International Informix User Group Software Archive (http://www.iiug.org/software) in the ESQL/C section - or, at a pinch, an older version of SQLCMD, from home.earthlink.net/~jleffler.



If you know what a given DBD does, please say so - Im happy to compile it into a succinct capabilities matrix, so I'll start:

module    col-vals-only    tablenames    partial-vals    in( ?foolist)
DBD::CSV:     yes            no             no              no

DBD::Informix yes no no no




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




Reply via email to