Back to index

python3.2  3.2.2
Public Member Functions
sqlite3.test.dbapi.ExtensionTests Class Reference

List of all members.

Public Member Functions

def CheckScriptStringSql
def CheckScriptSyntaxError
def CheckScriptErrorNormal
def CheckConnectionExecute
def CheckConnectionExecutemany
def CheckConnectionExecutescript

Detailed Description

Definition at line 669 of file dbapi.py.


Member Function Documentation

Definition at line 703 of file dbapi.py.

00703 
00704     def CheckConnectionExecute(self):
00705         con = sqlite.connect(":memory:")
00706         result = con.execute("select 5").fetchone()[0]
00707         self.assertEqual(result, 5, "Basic test of Connection.execute")

Here is the call graph for this function:

Definition at line 708 of file dbapi.py.

00708 
00709     def CheckConnectionExecutemany(self):
00710         con = sqlite.connect(":memory:")
00711         con.execute("create table test(foo)")
00712         con.executemany("insert into test(foo) values (?)", [(3,), (4,)])
00713         result = con.execute("select foo from test order by foo").fetchall()
00714         self.assertEqual(result[0][0], 3, "Basic test of Connection.executemany")
00715         self.assertEqual(result[1][0], 4, "Basic test of Connection.executemany")

Here is the call graph for this function:

Definition at line 716 of file dbapi.py.

00716 
00717     def CheckConnectionExecutescript(self):
00718         con = sqlite.connect(":memory:")
00719         con.executescript("create table test(foo); insert into test(foo) values (5);")
00720         result = con.execute("select foo from test").fetchone()[0]
00721         self.assertEqual(result, 5, "Basic test of Connection.executescript")

Here is the call graph for this function:

Definition at line 693 of file dbapi.py.

00693 
00694     def CheckScriptErrorNormal(self):
00695         con = sqlite.connect(":memory:")
00696         cur = con.cursor()
00697         raised = False
00698         try:
00699             cur.executescript("create table test(sadfsadfdsa); select foo from hurz;")
00700         except sqlite.OperationalError:
00701             raised = True
00702         self.assertEqual(raised, True, "should have raised an exception")

Here is the call graph for this function:

Definition at line 670 of file dbapi.py.

00670 
00671     def CheckScriptStringSql(self):
00672         con = sqlite.connect(":memory:")
00673         cur = con.cursor()
00674         cur.executescript("""
00675             -- bla bla
00676             /* a stupid comment */
00677             create table a(i);
00678             insert into a(i) values (5);
00679             """)
00680         cur.execute("select i from a")
00681         res = cur.fetchone()[0]
00682         self.assertEqual(res, 5)

Here is the call graph for this function:

Definition at line 683 of file dbapi.py.

00683 
00684     def CheckScriptSyntaxError(self):
00685         con = sqlite.connect(":memory:")
00686         cur = con.cursor()
00687         raised = False
00688         try:
00689             cur.executescript("create table test(x); asdf; create table test2(x)")
00690         except sqlite.OperationalError:
00691             raised = True
00692         self.assertEqual(raised, True, "should have raised an exception")

Here is the call graph for this function:


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