Hello,

The following query is giving me errors:

web.insert('updates', seqname=id, start=web.SQLLiteral('NOW()'))

When I run it I get:

/usr/lib/python2.5/site-packages/web/db.py:340: Warning: Data
truncated for column 'start' at row 1

and the 'start' column in the database will be set to '0000-00-00
00:00:00'. But when if I do _test=True I get the correct query:

INSERT INTO updates (start) VALUES (NOW())

If I go to db.py and output the query right before it gets executed I get

sql_query.s => INSERT INTO updates (start) VALUES (%s)
sql_query.v => (NOW(),)

I've looked at the code and what happens is that the cursor recieves
the string and arguments for it to format rather than the already
formatted string by SQLQuery. I fixed it by changing line 338 from

out = cur.execute(sql_query.s, sql_query.v)

to

out = cur.execute(str(sql_query))

Let me know if the old behaviour was on purpose.

Regards,
Hermann Käser
http://theragingche.com/
http://semicir.cl/user/hermzz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to