Commit e0388ecc authored by Julien Muchembled's avatar Julien Muchembled

catalog: render µs in SQL methods

parent c3215b74
...@@ -72,17 +72,15 @@ def SQLVar_render(self, md): ...@@ -72,17 +72,15 @@ def SQLVar_render(self, md):
'Invalid datetime value for <em>%s</em>: %r' % (name, v)) 'Invalid datetime value for <em>%s</em>: %r' % (name, v))
try: try:
if getattr(v, 'ISO', None) is not None: v = (v if isinstance(v, DateTime) else DateTime(v)).toZone('UTC')
v=v.toZone('UTC').ISO() # For subsecond precision in MySQL, use 'datetime(N)' type,
else: # where N is the number of digits after the decimal point.
v = DateTime(v) v = "'%s.%06u'" % (v.ISO(), v.micros() % 1000000)
v=v.toZone('UTC').ISO()
except: except:
if not v and args.has_key('optional') and args['optional']: if not v and args.has_key('optional') and args['optional']:
return 'null' return 'null'
raise ValueError, ( raise ValueError, (
'Invalid datetime value for <em>%s</em>: %r' % (name, v)) 'Invalid datetime value for <em>%s</em>: %r' % (name, v))
v=md.getitem('sql_quote__',0)(v)
# End of patch # End of patch
else: else:
# Patched by yo # Patched by yo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment