symbian-qemu-0.9.1-12/python-2.6.1/Doc/includes/sqlite3/adapter_datetime.py
author bugtracker-ml@nttdocomo.com
Sun, 04 Jul 2010 21:21:52 +0100
changeset 83 05f4463787cf
parent 1 2fb8b9db1c86
permissions -rw-r--r--
Fix Bug 1283 - E32test t_kheap.exe failed to load a device driver

import sqlite3
import datetime, time

def adapt_datetime(ts):
    return time.mktime(ts.timetuple())

sqlite3.register_adapter(datetime.datetime, adapt_datetime)

con = sqlite3.connect(":memory:")
cur = con.cursor()

now = datetime.datetime.now()
cur.execute("select ?", (now,))
print cur.fetchone()[0]