I've just opened issue 
#404<http://code.google.com/p/web2py/issues/detail?id=404>: datetime gets 
downgraded to 1-sec resolution when inserting to database - 
example and full details there. And just 90 minutes before that, someone 
else submitted issue 
#403<http://code.google.com/p/web2py/issues/detail?id=403>, 
which deals with textual vs. parametric SQL queries.

Both issues stem from (a) web2py expanding every query to be textual, and 
(b) not properly representing/escaping field values. My proposed solution to 
#404 is to add some control to the textual datetime representation. The 
patch included in #403 switches postgresql to work with parametric queries 
(thus bypassing the escaping issue), but still uses the same textual 
representation.

I think it should be possible to combine them robustly, by letting represent 
either return a string (in which case it is textually inserted), or some 
kind of wrapped value object, in which case the query gets a '%s' or '?' in 
the text, and the underlying value is passed to dbapi as a parameter. 

Massimo / Jonathan / other web2py gurus - does this make sense?

Reply via email to