Scott, if it's not too much trouble, can you send me the code, or let me
know where I can download it if anywhere.
Thanks.
Ilya Sterin
-----Original Message-----
From: Scott T. Hildreth
To: Sterin, Ilya
Cc: Ron Hall; [EMAIL PROTECTED]; Simon Oliver; Ronald J Kimball
Sent: 1/11/02 9:00 AM
Subject: RE: DBI::AnyData question
I've been helping Tim with a preparser for DBI, which in his vision all
the DBD's would use. Basically the Driver would tell the preparser what
is acceptable for comments, placeholders, & escape chars and what to
return
for comments, placeholders, & escape chars. It is a hybrid of the
dbd_preparse
from DBD::Oracle & DBD::Informix. I guess it is best explained with an
example,
$sql = "Select * from foo where id = :1 # a comment"
$r = DBI::preparse(0, $sql, DBIpp_cm_hs|DBIpp_ph_cn,
DBIpp_cm_dw|DBIpp_ph_qs)
DBIpp_ph_cn is a flag that says accept ':1' style placeholders
DBIpp_cm_hs is a flag that says accept '#' style comments
DBIpp_ph_qs is a flag that says return the placeholder as '?' style.
DBIpp_cm_dw is a flag that says return the comments with '-- ' style.
...so the return statement would be
"Select * from foo where id = ? -- a comment".
The new code is not currently in DBI, unfortunately I was not able to
get the work done in time, before Tim left. There is code in DBI for
the preparser, but it is old and has changed considerably. Anyway
short explaination, I have run to a meeting.
STH
On 11-Jan-02 Sterin, Ilya wrote:
> Escaping with a backslash might become a problem later. Jeff and I
talked
> before, and not sure about his vision on this, I want SQL::Parser,
which
> comes with SQL::Statement, to become a universal SQL::Parser and
therefore
> possibly used by all DBDs and possibly DBI iteself, for any SQL
parsing
> needs. It will of course have to be configurable. So a possible
config can
> be an attribute with an escape character.
>
> Ilya
>
> -----Original Message-----
> From: Simon Oliver
> To: Ronald J Kimball
> Cc: Ron Hall; [EMAIL PROTECTED]
> Sent: 1/11/02 8:07 AM
> Subject: Re: DBI::AnyData question
>
>> According to the docs Simon quoted, for DBD::AnyData
> Actually, it's due to SQL::Statement which is used by a number of DBD
> modules
> including DBD::AnyData and DBD::CSV
>
>> you need to escape a
>> single quote with a backslash, not with another single quote, as you
> would
>> for most other DBDs.
>
> Which is why it is better to use the $dbh->quote method or
placeholders
> - they
> are more portable!
>
> --
> Simon Oliver
----------------------------------
E-Mail: Scott T. Hildreth <[EMAIL PROTECTED]>
Date: 11-Jan-02
Time: 09:42:05
----------------------------------