From: brian z. <bz...@us...> - 2002-04-12 04:12:29
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv31769/Lib/test/zxjdbc Modified Files: test.xml zxtest.py Log Message: added result set type and concurrency Index: test.xml =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/test.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test.xml 29 Dec 2001 07:16:55 -0000 1.5 --- test.xml 12 Apr 2002 04:12:27 -0000 1.6 *************** *** 14,18 **** <test name="driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> ! <argument name="url" value="jdbc:postgresql://localhost:5432/ziclix"/> <argument name="usr" value="jython"/> <argument name="pwd" value=""/> --- 14,18 ---- <test name="driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> ! <argument name="url" value="jdbc:postgresql://192.168.1.102:5432/ziclix"/> <argument name="usr" value="jython"/> <argument name="pwd" value=""/> *************** *** 30,34 **** <factory class="com.ziclix.python.sql.zxJDBC" method="connectx"> <argument name="datasource" value="org.postgresql.PostgresqlDataSource"/> ! <keyword name="serverName" value="localhost"/> <keyword name="databaseName" value="ziclix"/> <keyword name="user" value="jython"/> --- 30,34 ---- <factory class="com.ziclix.python.sql.zxJDBC" method="connectx"> <argument name="datasource" value="org.postgresql.PostgresqlDataSource"/> ! <keyword name="serverName" value="192.168.1.102"/> <keyword name="databaseName" value="ziclix"/> <keyword name="user" value="jython"/> *************** *** 74,80 **** <test name="driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> ! <argument name="url" value="jdbc:mysql://localhost/ziclix"/> ! <argument name="usr" value=""/> ! <argument name="pwd" value=""/> <argument name="driver" value="org.gjt.mm.mysql.Driver"/> </factory> --- 74,80 ---- <test name="driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> ! <argument name="url" value="jdbc:mysql://192.168.1.102/ziclix"/> ! <argument name="usr" value="jython"/> ! <argument name="pwd" value="jython"/> <argument name="driver" value="org.gjt.mm.mysql.Driver"/> </factory> *************** *** 86,93 **** <factory class="com.ziclix.python.sql.zxJDBC" method="connectx"> <argument name="datasource" value="org.gjt.mm.mysql.MysqlDataSource"/> ! <keyword name="serverName" value="localhost"/> <keyword name="databaseName" value="ziclix"/> ! <keyword name="user" value=""/> ! <keyword name="password" value=""/> <keyword name="port" value="3306" type="int"/> </factory> --- 86,93 ---- <factory class="com.ziclix.python.sql.zxJDBC" method="connectx"> <argument name="datasource" value="org.gjt.mm.mysql.MysqlDataSource"/> ! <keyword name="serverName" value="192.168.1.102"/> <keyword name="databaseName" value="ziclix"/> ! <keyword name="user" value="jython"/> ! <keyword name="password" value="jython"/> <keyword name="port" value="3306" type="int"/> </factory> *************** *** 188,191 **** --- 188,208 ---- <vendor name="microsoft" datahandler="com.ziclix.python.sql.handler.SQLServerDataHandler"> + <!-- + <test name="freetds" os="java"> + <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> + <argument name="url" value="jdbc:freetds:sqlserver://localhost:1433/ziclix"/> + <argument name="usr" value="jython"/> + <argument name="pwd" value="jython"/> + <argument name="driver" value="com.internetcds.jdbc.tds.Driver"/> + </factory> + <testcase from="zxtest" import="zxAPITestCase"> + <ignore name="testRowid"/> + </testcase> + <testcase from="dbextstest" import="dbextsTestCase"> + <ignore name="testBulkcopy"/> + <ignore name="testBulkcopyWithDynamicColumns"/> + </testcase> + </test> + --> <test name="opta driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> *************** *** 195,199 **** <argument name="driver" value="com.inet.tds.TdsDriver"/> </factory> - <!-- <testcase from="zxtest" import="zxAPITestCase"> <ignore name="testRowid"/> --- 212,215 ---- *************** *** 203,209 **** <ignore name="testBulkcopyWithDynamicColumns"/> </testcase> ! --> <testcase from="sptest" import="SQLServerSPTest"/> </test> <test name="microsoft driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> --- 219,227 ---- <ignore name="testBulkcopyWithDynamicColumns"/> </testcase> ! <!-- <testcase from="sptest" import="SQLServerSPTest"/> + --> </test> + <!-- <test name="microsoft driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> *************** *** 213,217 **** <argument name="driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> </factory> - <!-- <testcase from="zxtest" import="zxAPITestCase"> <ignore name="testRowid"/> --- 231,234 ---- *************** *** 220,225 **** <testcase from="dbextstest" import="dbextsTestCase"/> <testcase from="sptest" import="SQLServerSPTest"/> - --> </test> <table ref="texttable" name="c_texttable"> create table c_texttable (a int not null, primary key(a), b text not null) --- 237,242 ---- <testcase from="dbextstest" import="dbextsTestCase"/> <testcase from="sptest" import="SQLServerSPTest"/> </test> + --> <table ref="texttable" name="c_texttable"> create table c_texttable (a int not null, primary key(a), b text not null) *************** *** 283,285 **** --- 300,386 ---- </vendor> --> + <vendor name="interbase"> + <test name="driver" os="java"> + <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> + <argument name="url" value="jdbc:interbase://rook/usr/local/interbase/data/ziclix.gdb"/> + <argument name="usr" value="jython"/> + <argument name="pwd" value="jython"/> + <argument name="driver" value="interbase.interclient.Driver"/> + </factory> + <testcase from="zxtest" import="zxAPITestCase"> + <ignore name="testRowid"/> + </testcase> + <testcase from="zxtest" import="BCPTestCase"/> + <testcase from="dbextstest" import="dbextsTestCase"/> + </test> + <table ref="texttable" name="c_texttable"> + create table c_texttable (a int not null, primary key(a), b blob not null) + </table> + <table ref="floattable" name="c_floattable"> + create table c_floattable (a int, b numeric(5,2)) + </table> + <table ref="datetable" name="c_datetable"> + create table c_datetable (a int, b timestamp) + </table> + <table ref="timetable" name="c_timetable"> + create table c_timetable (a int, b timestamp) + </table> + <table ref="timestamptable" name="c_timestamptable"> + create table c_timestamptable (a int, b timestamp) + </table> + <table ref="blobtable" name="b_blobtable"> + create table b_blobtable (a int, b blob) + </table> + <table ref="pktable" name="b_pktable"> + create table b_pktable (a int not null, b int, primary key(a)) + </table> + <table ref="autoincrementtable" name="aitable"> + create table aitable (a serial not null, b int, primary key(a)) + </table> + </vendor> + <vendor name="sapdb"> + <test name="driver" os="java"> + <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> + <argument name="url" value="jdbc:sapdb://localhost/TST"/> + <argument name="usr" value="TEST"/> + <argument name="pwd" value="TEST"/> + <argument name="driver" value="com.sap.dbtech.jdbc.DriverSapDB"/> + </factory> + <testcase from="zxtest" import="zxAPITestCase"> + <ignore name="testRowid"/> + <!-- Returns any empty ResultSet every time. --> + <ignore name="testIndexInfo"/> + <ignore name="testMaxrows"/> + <ignore name="testOrderOfArgsMaxRowsOnly"/> + </testcase> + <testcase from="zxtest" import="BCPTestCase"/> + <testcase from="dbextstest" import="dbextsTestCase"> + <ignore name="testQueryWithMaxRows"/> + </testcase> + </test> + <table ref="texttable" name="c_texttable"> + create table c_texttable (a int, b long varchar not null) + </table> + <table ref="floattable" name="c_floattable"> + create table c_floattable (a int, b decimal(5,2)) + </table> + <table ref="datetable" name="c_datetable"> + create table c_datetable (a int, b date) + </table> + <table ref="timetable" name="c_timetable"> + create table c_timetable (a int, b time) + </table> + <table ref="timestamptable" name="c_timestamptable"> + create table c_timestamptable (a int, b timestamp) + </table> + <table ref="blobtable" name="b_blobtable"> + create table b_blobtable (a int, b blob) + </table> + <table ref="pktable" name="b_pktable"> + create table b_pktable (a int not null, b int, primary key(a)) + </table> + <table ref="clobtable" name="b_clobtable"> + create table b_clobtable (a int, b clob) + </table> + </vendor> </tests> Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** zxtest.py 29 Mar 2002 04:01:03 -0000 1.12 --- zxtest.py 12 Apr 2002 04:12:27 -0000 1.13 *************** *** 28,33 **** return apply(connect, args, self.factory.keywords) ! def cursor(self, dynamic=0): ! c = self.db.cursor(dynamic) if hasattr(self, "datahandler"): c.datahandler = self.datahandler(c.datahandler) --- 28,33 ---- return apply(connect, args, self.factory.keywords) ! def cursor(self, *args, **kws): ! c = apply(self.db.cursor, args, kws) if hasattr(self, "datahandler"): c.datahandler = self.datahandler(c.datahandler) *************** *** 110,113 **** --- 110,136 ---- c.close() + def _test_cursorkeywords(self, *args, **kws): + c = self.cursor(*args, **kws) + try: + c.execute("select * from zxtesting") + data = c.fetchmany(1) + assert len(data) == 1, "expecting one row" + finally: + c.close() + + def testCursorKeywords(self): + """testing the creation of a cursor with keywords""" + self._test_cursorkeywords(dynamic=1) + self._test_cursorkeywords(dynamic=1, + rstype=zxJDBC.TYPE_SCROLL_INSENSITIVE, + rsconcur=zxJDBC.CONCUR_READ_ONLY + ) + self._test_cursorkeywords(1, + rstype=zxJDBC.TYPE_SCROLL_INSENSITIVE, + rsconcur=zxJDBC.CONCUR_READ_ONLY + ) + self._test_cursorkeywords(1,zxJDBC.TYPE_SCROLL_INSENSITIVE,zxJDBC.CONCUR_READ_ONLY) + self.assertRaises(TypeError, self.cursor, 1, zxJDBC.TYPE_SCROLL_INSENSITIVE) + def testFileLikeCursor(self): """testing the cursor as a file-like object""" *************** *** 252,256 **** def _test_scrolling(self, dynamic=0): ! c = self.cursor(dynamic) try: # set everything up --- 275,286 ---- def _test_scrolling(self, dynamic=0): ! if self.vendor.name == "oracle": ! c = self.cursor(dynamic, ! rstype=zxJDBC.TYPE_SCROLL_INSENSITIVE, ! rsconcur=zxJDBC.CONCUR_READ_ONLY ! ) ! else: ! c = self.cursor(dynamic) ! try: # set everything up *************** *** 287,291 **** def _test_rownumber(self, dynamic=0): ! c = self.cursor(dynamic) try: if not dynamic: --- 317,328 ---- def _test_rownumber(self, dynamic=0): ! if self.vendor.name == "oracle": ! c = self.cursor(dynamic, ! rstype=zxJDBC.TYPE_SCROLL_INSENSITIVE, ! rsconcur=zxJDBC.CONCUR_READ_ONLY ! ) ! else: ! c = self.cursor(dynamic) ! try: if not dynamic: *************** *** 319,323 **** def _test_rowcount(self, dynamic=0): ! c = self.cursor(dynamic) try: c.execute("select * from zxtesting") --- 356,367 ---- def _test_rowcount(self, dynamic=0): ! if self.vendor.name == "oracle": ! c = self.cursor(dynamic, ! rstype=zxJDBC.TYPE_SCROLL_INSENSITIVE, ! rsconcur=zxJDBC.CONCUR_READ_ONLY ! ) ! else: ! c = self.cursor(dynamic) ! try: c.execute("select * from zxtesting") *************** *** 654,666 **** self._test_time(self.table("timestamptable"), zxJDBC.Timestamp, values, zxJDBC.TIMESTAMP, _cmp_) ! def testOrderOfArgs(self): ! """testing execute with different argument orderings""" c = self.cursor() try: ! # maxrows only c.execute("select * from zxtesting", maxrows=3) f = c.fetchall() assert len(f) == 3, "expected length [3], got [%d]" % (len(f)) # bindings and params flipped --- 698,719 ---- self._test_time(self.table("timestamptable"), zxJDBC.Timestamp, values, zxJDBC.TIMESTAMP, _cmp_) ! def testOrderOfArgsMaxRowsOnly(self): ! """testing execute with max rows only""" c = self.cursor() try: ! # maxrows only (SAPDB doesn't support maxrows as of version 7.2.0) c.execute("select * from zxtesting", maxrows=3) f = c.fetchall() assert len(f) == 3, "expected length [3], got [%d]" % (len(f)) + + finally: + c.close() + self.db.commit() + + def testOrderOfArgs(self): + """testing execute with different argument orderings""" + c = self.cursor() + try: # bindings and params flipped |