Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
sqlite3.test.types.DateTimeTests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def CheckSqliteDate
def CheckSqliteTimestamp
def CheckSqlTimestamp
def CheckDateTimeSubSeconds
def CheckDateTimeSubSecondsFloatingPoint

Public Attributes

 con
 cur

Detailed Description

Definition at line 338 of file types.py.


Member Function Documentation

Definition at line 375 of file types.py.

00375 
00376     def CheckDateTimeSubSeconds(self):
00377         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 500000)
00378         self.cur.execute("insert into test(ts) values (?)", (ts,))
00379         self.cur.execute("select ts from test")
00380         ts2 = self.cur.fetchone()[0]
00381         self.assertEqual(ts, ts2)

Here is the call graph for this function:

Definition at line 382 of file types.py.

00382 
00383     def CheckDateTimeSubSecondsFloatingPoint(self):
00384         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0, 510241)
00385         self.cur.execute("insert into test(ts) values (?)", (ts,))
00386         self.cur.execute("select ts from test")
00387         ts2 = self.cur.fetchone()[0]
00388         self.assertEqual(ts, ts2)

Here is the call graph for this function:

Definition at line 348 of file types.py.

00348 
00349     def CheckSqliteDate(self):
00350         d = sqlite.Date(2004, 2, 14)
00351         self.cur.execute("insert into test(d) values (?)", (d,))
00352         self.cur.execute("select d from test")
00353         d2 = self.cur.fetchone()[0]
00354         self.assertEqual(d, d2)

Here is the call graph for this function:

Definition at line 355 of file types.py.

00355 
00356     def CheckSqliteTimestamp(self):
00357         ts = sqlite.Timestamp(2004, 2, 14, 7, 15, 0)
00358         self.cur.execute("insert into test(ts) values (?)", (ts,))
00359         self.cur.execute("select ts from test")
00360         ts2 = self.cur.fetchone()[0]
00361         self.assertEqual(ts, ts2)

Here is the call graph for this function:

Definition at line 362 of file types.py.

00362 
00363     def CheckSqlTimestamp(self):
00364         # The date functions are only available in SQLite version 3.1 or later
00365         if sqlite.sqlite_version_info < (3, 1):
00366             return
00367 
00368         # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time.
00369         now = datetime.datetime.now()
00370         self.cur.execute("insert into test(ts) values (current_timestamp)")
00371         self.cur.execute("select ts from test")
00372         ts = self.cur.fetchone()[0]
00373         self.assertEqual(type(ts), datetime.datetime)
00374         self.assertEqual(ts.year, now.year)

Here is the call graph for this function:

Definition at line 339 of file types.py.

00339 
00340     def setUp(self):
00341         self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_DECLTYPES)
00342         self.cur = self.con.cursor()
00343         self.cur.execute("create table test(d date, ts timestamp)")

Here is the caller graph for this function:

Definition at line 344 of file types.py.

00344 
00345     def tearDown(self):
00346         self.cur.close()
00347         self.con.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 340 of file types.py.

Definition at line 341 of file types.py.


The documentation for this class was generated from the following file: