[DB-SIG] Syntax for dates/times in prepared statements
Mon, 26 Jul 1999 09:52:18 -0400 (EDT)
Still at work on the database chapter for PPW32 - I'm
doing some benchmarking on prepared vs. literal
statements. I'd like to include dates and times in
the parameter list and cannot find a syntax to let me
do it. Any help gratefully received as failure to
solve this kind of weakens my hymns of praise to
Currently using Sybase SQL Anywhere with their
provided ODBC driver; mxODBC.Windows; and mxDateTime.
cursor.execute("""INSERT INTO analysis
(id, when, what, howmuch)
VALUES (?,?,?,?)""", (id,when,what,howmuch))
fails however I represent the date-time in 'when'.
Sybase complains about the SQL syntax. I've tried
strings in many formats, numbers, and raw mxDateTime
objects (I hoped the latter was the intention...)
Without the "when" column, it all works beautifully
and runs 60% faster with prepared statements. I also
tried other column names. Also embedding dates in
literal SQL statements is no problem.
If this is a database-specific problem, can someone
give me an example of a database it does work with,
and what syntax they use?
Robinson Analytics Ltd.
My opinions are the official policy of Robinson Analytics Ltd.
They just vary from day to day.
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com