Hi

I'm having trouble getting NOW() to work using web.db. In the
following code, the sql that's printed out looks OK (I think?) but the
database complains that the value is out of range. Below is test code
and the output that I get. Something obvious/dumb that anyone can
see??

I'm using web.py 0.22, mysql 5.0.45 if that's relevant.

Thanks for any help,
scott

----------------
import web

web.config.db_parameters = dict(dbn='mysql', user='romeo',
pw='juliet', db='mytestdb')
web.config.db_printing = True
web.load()

web.query("create table if not exists mytbl(mydt datetime)")
web.insert("mytbl", mydt=None)
web.update("mytbl", where="TRUE", mydt=web.SQLLiteral("now()"))  #
<---
for r in web.select("mytbl"):
    print r
----------------

and running that gives me:

----------------
0.01 (1): create table if not exists mytbl(mydt datetime)
0.0 (2): INSERT  INTO mytbl (mydt) VALUES (NULL)
0.0 (3): SELECT last_insert_id()
/home/scott/test/web/db.py:338: Warning: Out of range value adjusted
for column 'mydt' at row 1
  out = cur.execute(sql_query.s, sql_query.v)
0.0 (4): UPDATE mytbl SET mydt = now() WHERE TRUE
0.0 (5): SELECT * FROM mytbl
<Storage {'mydt': None}>
----------------
--~--~---------~--~----~------------~-------~--~----~
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