2011/4/23 Andre Smit <[email protected]>:
> This one has me stumped. Can anyone see the problem. It bombs on this
> line:
>
> db.update('users', uvar, where = 'uid = $uid', lastlog =
> "datetime('now')")

There are two issues.

1. The second argument to update is where, not vars.
2. You need to use sqlliteral if you want to insert current time
instead of string "datetime('now')".

>>> db.update('users', where = 'uid = $uid', lastlog ="datetime('now')", 
>>> _test=True, vars=uvar)
<sql: 'UPDATE users SET lastlog = "datetime(\'now\')" WHERE uid = 1'>

>>> db.update('users', where = 'uid = $uid', lastlog 
>>> =web.sqlliteral("datetime('now')"), _test=True, vars=uvar)
<sql: "UPDATE users SET lastlog = datetime('now') WHERE uid = 1">

Anand

-- 
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