From: brian z. <bz...@us...> - 2002-04-19 19:08:07
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv25122/Lib/test/zxjdbc Modified Files: zxtest.py runner.py Log Message: added .prepare() to cursor Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** zxtest.py 12 Apr 2002 04:12:27 -0000 1.13 --- zxtest.py 19 Apr 2002 19:01:06 -0000 1.14 *************** *** 110,113 **** --- 110,140 ---- c.close() + def _test_preparedstatement(self, dynamic): + c = self.cursor(dynamic) + try: + p = c.prepare("select * from zxtesting where id = ?") + for i in range(1, 8): + try: + c.execute(p, (i,)) + except: + print i + raise + data = c.fetchall() + self.assertEquals(1, len(data)) + assert not p.closed + p.close() + assert p.closed + self.assertRaises(zxJDBC.ProgrammingError, c.execute, p, (1,)) + finally: + c.close() + + def testStaticPrepare(self): + """testing the prepare() functionality for static cursors""" + self._test_preparedstatement(0) + + def testDynamicPrepare(self): + """testing the prepare() functionality for dynamic cursors""" + self._test_preparedstatement(1) + def _test_cursorkeywords(self, *args, **kws): c = self.cursor(*args, **kws) *************** *** 183,187 **** finally: c.close() ! self.assertRaises(zxJDBC.InternalError, c.execute, ("select * from zxtesting",)) def testClosingConnectionWithOpenCursors(self): --- 210,214 ---- finally: c.close() ! self.assertRaises(zxJDBC.ProgrammingError, c.execute, ("select * from zxtesting",)) def testClosingConnectionWithOpenCursors(self): *************** *** 193,199 **** # open a new connection so the tearDown can run self.db = self.connect() ! self.assertRaises(zxJDBC.InternalError, c.execute, ("select * from zxtesting",)) ! self.assertRaises(zxJDBC.InternalError, d.execute, ("select * from zxtesting",)) ! self.assertRaises(zxJDBC.InternalError, e.execute, ("select * from zxtesting",)) def testNativeSQL(self): --- 220,226 ---- # open a new connection so the tearDown can run self.db = self.connect() ! self.assertRaises(zxJDBC.ProgrammingError, c.execute, ("select * from zxtesting",)) ! self.assertRaises(zxJDBC.ProgrammingError, d.execute, ("select * from zxtesting",)) ! self.assertRaises(zxJDBC.ProgrammingError, e.execute, ("select * from zxtesting",)) def testNativeSQL(self): Index: runner.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/runner.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runner.py 12 Apr 2002 04:10:47 -0000 1.2 --- runner.py 19 Apr 2002 19:01:06 -0000 1.3 *************** *** 185,189 **** opts, args = getopt.getopt(sys.argv[1:], "t:", []) except getopt.error, msg: ! print "%s -s [search] -r [replace] <pattern>" sys.exit(0) --- 185,189 ---- opts, args = getopt.getopt(sys.argv[1:], "t:", []) except getopt.error, msg: ! print "%s -t [testmask] <vendor>[,<vendor>]" sys.exit(0) *************** *** 199,200 **** --- 199,201 ---- fp.close() test(configParser.vendors, args[1:], mask=mask) + sys.exit(0) |