ยปCore Development>Code coverage>Doc/includes/sqlite3/adapter_datetime.py

Python code coverage for Doc/includes/sqlite3/adapter_datetime.py

#countcontent
1n/aimport sqlite3
2n/aimport datetime
3n/aimport time
4n/a
5n/adef adapt_datetime(ts):
6n/a return time.mktime(ts.timetuple())
7n/a
8n/asqlite3.register_adapter(datetime.datetime, adapt_datetime)
9n/a
10n/acon = sqlite3.connect(":memory:")
11n/acur = con.cursor()
12n/a
13n/anow = datetime.datetime.now()
14n/acur.execute("select ?", (now,))
15n/aprint(cur.fetchone()[0])