Back to index

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

List of all members.

Public Member Functions

def setUp
def tearDown
def CheckDeclTypeNotUsed
def CheckNone
def CheckColName
def CheckCaseInConverterName
def CheckCursorDescriptionNoRow

Public Attributes

 con
 cur

Detailed Description

Definition at line 238 of file types.py.


Member Function Documentation

Definition at line 283 of file types.py.

00283 
00284     def CheckCaseInConverterName(self):
00285         self.cur.execute("select 'other' as \"x [b1b1]\"")
00286         val = self.cur.fetchone()[0]
00287         self.assertEqual(val, "MARKER")

Here is the call graph for this function:

Definition at line 273 of file types.py.

00273 
00274     def CheckColName(self):
00275         self.cur.execute("insert into test(x) values (?)", ("xxx",))
00276         self.cur.execute('select x as "x [bar]" from test')
00277         val = self.cur.fetchone()[0]
00278         self.assertEqual(val, "<xxx>")
00279 
00280         # Check if the stripping of colnames works. Everything after the first
00281         # whitespace should be stripped.
00282         self.assertEqual(self.cur.description[0][0], "x")

Here is the call graph for this function:

cursor.description should at least provide the column name(s), even if
no row returned.

Definition at line 288 of file types.py.

00288 
00289     def CheckCursorDescriptionNoRow(self):
00290         """
00291         cursor.description should at least provide the column name(s), even if
00292         no row returned.
00293         """
00294         self.cur.execute("select * from test where 0 = 1")
00295         self.assertEqual(self.cur.description[0][0], "x")

Here is the call graph for this function:

Assures that the declared type is not used when PARSE_DECLTYPES
is not set.

Definition at line 257 of file types.py.

00257 
00258     def CheckDeclTypeNotUsed(self):
00259         """
00260         Assures that the declared type is not used when PARSE_DECLTYPES
00261         is not set.
00262         """
00263         self.cur.execute("insert into test(x) values (?)", ("xxx",))
00264         self.cur.execute("select x from test")
00265         val = self.cur.fetchone()[0]
00266         self.assertEqual(val, "xxx")

Here is the call graph for this function:

Definition at line 267 of file types.py.

00267 
00268     def CheckNone(self):
00269         self.cur.execute("insert into test(x) values (?)", (None,))
00270         self.cur.execute("select x from test")
00271         val = self.cur.fetchone()[0]
00272         self.assertEqual(val, None)

Here is the call graph for this function:

Definition at line 239 of file types.py.

00239 
00240     def setUp(self):
00241         self.con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
00242         self.cur = self.con.cursor()
00243         self.cur.execute("create table test(x foo)")
00244 
00245         sqlite.converters["FOO"] = lambda x: "[%s]" % x.decode("ascii")
00246         sqlite.converters["BAR"] = lambda x: "<%s>" % x.decode("ascii")
00247         sqlite.converters["EXC"] = lambda x: 5/0
00248         sqlite.converters["B1B1"] = lambda x: "MARKER"

Here is the caller graph for this function:

Definition at line 249 of file types.py.

00249 
00250     def tearDown(self):
00251         del sqlite.converters["FOO"]
00252         del sqlite.converters["BAR"]
00253         del sqlite.converters["EXC"]
00254         del sqlite.converters["B1B1"]
00255         self.cur.close()
00256         self.con.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 240 of file types.py.

Definition at line 241 of file types.py.


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