> From: Terrence Brannon [mailto:[EMAIL PROTECTED]]
> 
> On Monday, December 10, 2001, at 09:16 AM, Jeff Zucker wrote:
> 
> > Terrence Brannon wrote:
> >>
> >> The following SQL is not parseable by SQL::Statement:
> >>
> >> INSERT
> >>    INTO   thot_log (thot_fk,thot_type_fk,thot_temporality_fk,date)
> >>    VALUES (?,?,?,CURRENT_TIMESTAMP)
> 
> What I have is a program which reads a SQL statement from a file. 
> It parses it with SQL::Statement, then it prepares this 
> statement, then does an execute against it with @ARGV. I tried 
> your quoting suggestion. In fact, I put the following 3 different 
> things in the file:
> 

Prepares it and executes it against what database? If its Postgres, then
Postgres should be parsing it, not SQL::Statement. CURRENT_TIMESTAMP is
special to Postgres, and since its not ANSI standard, most other
databases will and should choke on it. SQL::Statement will choke on
it because it is not standard SQL, which is all SQL::Statement
will parse. If you quote it, then it'll be a valid sql statement, but
then obviously you'll be inserting a literal string which is probably
not what you want. You can't expect SQL::Statement to handle every
special thing that every database might include in its featureset/syntax.

Cheers,
Douglas Wilson

Reply via email to