You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: brian z. <bz...@us...> - 2001-12-16 05:01:30
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv5797/ziclix/python/sql Modified Files: PyCursor.java Log Message: abstract the sql execution in preparation for callable statements Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyCursor.java 2001/12/10 03:37:40 1.8 --- PyCursor.java 2001/12/16 05:01:27 1.9 *************** *** 216,219 **** --- 216,235 ---- /** + * An interface to allow the abstraction of SQL execution for + * different statements. + */ + private static interface ExecuteSQL { + + /** + * Execute a SQL statement and add the results to Fetch as + * appropriate. + * + * @throws SQLException + * + */ + public void executeSQL() throws SQLException; + } + + /** * Delete the cursor. * *************** *** 364,368 **** * @param maxRows integer value of max rows */ ! public void execute(String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { clear(); --- 380,384 ---- * @param maxRows integer value of max rows */ ! public void execute(final String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { clear(); *************** *** 374,389 **** if (hasParams) { - execute(params, bindings); - } else { - this.datahandler.preExecute(this.sqlStatement); ! if (this.sqlStatement.execute(sqlString)) { ! create(this.sqlStatement.getResultSet()); } ! this.rowid = this.datahandler.getRowId(this.sqlStatement); ! addWarning(this.sqlStatement.getWarnings()); ! this.datahandler.postExecute(this.sqlStatement); } } catch (PyException e) { --- 390,418 ---- if (hasParams) { ! // if we have a sequence of sequences, let's run through them and finish ! if (isSeqSeq(params)) { ! ! // [(3, 4)] or [(3, 4), (5, 6)] ! for (int i = 0, len = params.__len__(); i < len; i++) { ! PyObject param = params.__getitem__(i); ! ! execute(param, bindings); ! } ! } else { ! execute(params, bindings); } + } else { ! // execute the sql string straight up ! execute(new ExecuteSQL() { ! public void executeSQL() throws SQLException { ! ! if (sqlStatement.execute(sqlString)) { ! create(sqlStatement.getResultSet()); ! } ! } ! }); } } catch (PyException e) { *************** *** 395,424 **** /** ! * The workhorse for properly executing a prepared statement. * ! * @param PyObject params a non-None seq of sequences or entities ! * @param PyObject bindings an optional dictionary of index:DBApiType mappings * * @throws SQLException * */ ! protected void execute(PyObject params, PyObject bindings) throws SQLException { ! // if we have a sequence of sequences, let's run through them and finish ! if (isSeqSeq(params)) { ! // [(3, 4)] or [(3, 4), (5, 6)] ! for (int i = 0, len = params.__len__(); i < len; i++) { ! PyObject param = params.__getitem__(i); ! execute(param, bindings); ! } ! // we've recursed through everything, so we're done ! return; ! } // [3, 4] or (3, 4) ! PreparedStatement preparedStatement = (PreparedStatement)this.sqlStatement; // clear the statement so all new bindings take affect --- 424,461 ---- /** ! * Performs the execution * ! * @param ExecuteSQL execute * * @throws SQLException * */ ! protected void execute(ExecuteSQL execute) throws SQLException { ! this.datahandler.preExecute(this.sqlStatement); ! // this performs the SQL execution and fetch per the Statement type ! execute.executeSQL(); ! this.rowid = this.datahandler.getRowId(this.sqlStatement); ! addWarning(this.sqlStatement.getWarnings()); ! this.datahandler.postExecute(this.sqlStatement); ! } ! ! /** ! * The workhorse for properly preparing the parameters and executing a ! * prepared statement. ! * ! * @param PyObject params a non-None seq of sequences or entities ! * @param PyObject bindings an optional dictionary of index:DBApiType mappings ! * ! * @throws SQLException ! * ! */ ! protected void execute(PyObject params, PyObject bindings) throws SQLException { // [3, 4] or (3, 4) ! final PreparedStatement preparedStatement = (PreparedStatement)this.sqlStatement; // clear the statement so all new bindings take affect *************** *** 449,460 **** } ! this.datahandler.preExecute(preparedStatement); ! preparedStatement.execute(); ! create(preparedStatement.getResultSet()); ! this.rowid = this.datahandler.getRowId(preparedStatement); ! addWarning(preparedStatement.getWarnings()); ! this.datahandler.postExecute(preparedStatement); return; --- 486,498 ---- } ! execute(new ExecuteSQL() { ! public void executeSQL() throws SQLException { ! if (preparedStatement.execute()) { ! create(preparedStatement.getResultSet()); ! } ! } ! }); return; *************** *** 523,527 **** /** ! * Create the results after a successful execution and closes the result set. * * @param rs A ResultSet. --- 561,565 ---- /** ! * Create the results after a successful execution and manages the result set. * * @param rs A ResultSet. *************** *** 532,536 **** /** ! * Create the results after a successful execution and closes the result set. * Optionally takes a set of JDBC-indexed columns to automatically set to None * primarily to support getTypeInfo() which sets a column type of a number but --- 570,574 ---- /** ! * Create the results after a successful execution and manages the result set. * Optionally takes a set of JDBC-indexed columns to automatically set to None * primarily to support getTypeInfo() which sets a column type of a number but *************** *** 547,551 **** * Adds a warning to the tuple and will follow the chain as necessary. */ ! void addWarning(SQLWarning warning) { if (warning == null) { --- 585,589 ---- * Adds a warning to the tuple and will follow the chain as necessary. */ ! protected void addWarning(SQLWarning warning) { if (warning == null) { |
From: brian z. <bz...@us...> - 2001-12-14 04:20:05
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv29016 Added Files: dbextstest.py jndi.py runner.py test.xml zxtest.py Log Message: testing framework for zxjdbc --- NEW FILE: dbextstest.py --- # Jython Database Specification API 2.0 # # $Id: dbextstest.py,v 1.1 2001/12/14 04:20:03 bzimmer Exp $ # # Copyright (c) 2001 brian zimmer <bz...@zi...> import dbexts, runner, tempfile, os from random import random class dbextsTestCase(runner.SQLTestCase): def setUp(self): template = """ [default] name=dbexts_test [jdbc] name=dbexts_test url=%s user=%s pwd=%s driver=%s """ args = {} for arg in self.factory.arguments: args[arg[0]] = arg[1] template = template % (args["url"], args["usr"], args["pwd"], args["driver"]) if hasattr(self, "datahandler"): template += "\tdatahandler=%s" % (self.datahandler.__name__) template = os.linesep.join(template.split()) try: fp = open(tempfile.mktemp(), "w") fp.write(template) fp.close() self.db = dbexts.dbexts(cfg=fp.name) self.db.verbose = 0 self.db.raw("create table one (a int, b int, c varchar(32))") self.db.raw("create table two (a int, b int, c varchar(32))") finally: try: os.remove(fp.name) except: pass def tearDown(self): self.db.raw("drop table one") self.db.raw("drop table two") self.db.close() def testChoose(self): """testing choose()""" r = dbexts.choose(1, 4, 5) assert r == 4, "choose failed, expected 4, got %d" % r def _insertInto(self, table, num): for i in range(0, num): self.db.raw("insert into %s (a, b, c) values (?, ?, ?)" % (table), [(i, random()*100+i, "%s" % (random()*100+i))]) def testSqlFailure(self): """testing isql with sql exception""" try: self.db.isql("select * from __garbage__") self.fail("expected SQL exception") except: pass def testSqlFailureWithBeginCommit(self): """testing failure with begin/commit""" failed = 0 c = self.db.begin() try: try: c.execute("select * from __garbage__") except: failed = 1 finally: self.db.commit(c) c.close() if not failed: self.fail("expected SQL exception") def testSqlWithBeginCommit(self): """testing begin/commit""" self._insertInto("two", 30) c = self.db.begin() c.execute("select * from two") f = c.fetchall() c.close() self.db.commit() assert len(f) == 30, "expected [30], got [%d]" % (len(f)) def testQueryMultipleReturnSets(self): """testing multiple return sets""" self._insertInto("two", 30) h, r = self.db.raw("select * from two where a = ?", [(0,), (3,)]) assert len(r) == 2, "expected [2], got [%d]" % (len(r)) def testQueryWithMaxRows(self): """testing query with max rows""" self._insertInto("one", 45) self.db.raw("select * from one where a > ?", [(12,)], maxrows=3) assert len(self.db.results) == 3, "failed to query set number of max rows, got [%d], expected [%d]" % (len(self.db.results), 3) def testBulkcopy(self): """testing bcp""" self._insertInto("two", 3) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a']) assert len(bcp.columns) == 1, "one column should be specified, [%d] found" % (len(bcp.columns)) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a', 'b', 'c'], exclude=['a']) assert len(bcp.columns) == 2, "expected two columns, found [%d]" % (len(bcp.columns)) a = filter(lambda x, c=bcp.columns: x in c, ['b', 'c']) assert a, "expecting ['b', 'c'], found %s" % (str(a)) class _executor: def __init__(self, table, cols): self.cols = cols if cols: self.sql = "insert into %s (%s) values (%s)" % (table, ",".join(self.cols), ",".join(("?",) * len(self.cols))) else: self.sql = "insert into %s values (%%s)" % (table) def execute(self, db, rows, bindings): assert len(rows) > 0, "must have at least one row" if self.cols: sql = self.sql else: sql = self.sql % (",".join(("?",) * len(rows[0]))) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a'], executor=_executor) done = bcp.transfer(self.db) assert done == 3, "expecting three rows to be handled but not inserted, found [%d]" % (done) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a']) done = bcp.transfer(self.db) assert done == 3, "expecting three rows to be inserted, found [%d]" % (done) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a']) bcp.rowxfer([200]) bcp.rowxfer([201]) bcp.rowxfer([202]) bcp.rowxfer([203]) done = bcp.batch() assert done == 4, "expecting four rows to be inserted, found [%d]" % (done) bcp.rowxfer([300]) bcp.rowxfer([401]) bcp.rowxfer([502]) bcp.rowxfer([603]) done = bcp.batch() assert done == 4, "expecting four rows to be inserted, found [%d]" % (done) bcp.rowxfer([205]) bcp.rowxfer([210]) done = bcp.done() assert done == 2, "expecting two rows to be inserted, found [%d]" % (done) assert bcp.total == 10, "expecting 10 rows to be inserted, found [%d]" % (bcp.total) bcp = self.db.bulkcopy("dbexts_test", "two", include=['a']) done = bcp.transfer(self.db) assert done == 16, "expecting sixteen rows to be inserted, found [%d]" % (done) def testTable(self): """testing dbexts.table(tabname)""" self.db.table("one") assert not self.db.results == None, "results were None" self.assertEquals(3, len(self.db.results)) def testOut(self): """testing dbexts.out""" self.db.verbose = 1 fp = open(tempfile.mktemp(), "w") try: self.db.out = fp self.db.raw("insert into one (a, b) values (?, ?)", [(1, 2), (3, 4)]) self.db.isql("select * from one") self.db.verbose = 0 fp.close() fp = open(fp.name, "r") data = fp.read() assert len(data), "expected file to contain output" finally: fp.close() os.remove(fp.name) def testResultSetWrapper(self): """testing result set wrapper""" from dbexts import ResultSet self._insertInto("two", 30) h, r = self.db.raw("select * from two where a in (?, ?, ?, ?) order by a", [(12,15,17,8)]) assert len(r) == 4, "expected [4], got [%d]" % (len(r)) rs = ResultSet(map(lambda x: x[0], h), r) assert len(rs[0]) == 3, "expected [3], got [%d]" % (len(rs[0])) assert rs[0]['a'] == 8, "expected [8], got [%s]" % (rs[0]['a']) assert rs[0]['A'] == 8, "expected [8], got [%s]" % (rs[0]['A']) assert len(rs[0]['b':]) == 2, "expected [2], got [%s]" % (len(rs[0]['b':])) assert len(rs[0]['a':'b']) == 1, "expected [1], got [%s]" % (len(rs[0]['a':'b'])) def testMultipleResultSetConcatentation(self): """testing multiple result sets with some resulting in None""" self._insertInto("two", 30) # first is non None h, r = self.db.raw("select * from two where a = ?", [(12,),(8001,),(15,),(17,),(8,),(9001,)]) assert len(r) == 4, "expected [4], got [%d]" % (len(r)) # first is None h, r = self.db.raw("select * from two where a = ?", [(1200,),(8001,),(15,),(17,),(8,),(9001,)]) assert len(r) == 3, "expected [3], got [%d]" % (len(r)) def testBulkcopyWithDynamicColumns(self): """testing bcp with dynamic column names""" self.testBulkcopy() bcp = self.db.bulkcopy("dbexts_test", "two", exclude=['a']) assert len(bcp.columns) == 2, "expected two columns, found [%d]" % (len(bcp.columns)) a = filter(lambda x, c=bcp.columns: x in c, ['b', 'c']) assert a == ['b', 'c'], "expecting ['b', 'c'], found %s" % (str(a)) bcp = self.db.bulkcopy("dbexts_test", "two") done = bcp.transfer(self.db) assert done == 32, "expecting thirty two rows to be inserted, found [%d]" % (done) --- NEW FILE: jndi.py --- # Jython Database Specification API 2.0 # # $Id: jndi.py,v 1.1 2001/12/14 04:20:03 bzimmer Exp $ # # Copyright (c) 2001 brian zimmer <bz...@zi...> """ This script is used to bind a JNDI reference for testing purposes only. """ from java.util import Hashtable from org.gjt.mm.mysql import MysqlDataSource from javax.naming import Context, InitialContext, NameAlreadyBoundException env = Hashtable() env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory") ds = MysqlDataSource() ds.setServerName("localhost") ds.setDatabaseName("ziclix") ds.setPort(3306) ctx = InitialContext(env) try: try: ctx.bind("/jdbc/mysqldb", ds) except NameAlreadyBoundException, e: ctx.unbind("/jdbc/mysqldb") ctx.bind("/jdbc/mysqldb", ds) finally: ctx.close() print "bound [%s] at /jdbc/mysqldb" % (ds) --- NEW FILE: runner.py --- # Jython Database Specification API 2.0 # # $Id: runner.py,v 1.1 2001/12/14 04:20:03 bzimmer Exp $ # # Copyright (c) 2001 brian zimmer <bz...@zi...> """ To run the tests, simply invoke this script from the commandline: jython runner.py <xml config file> [vendor, ...] If no vendors are given, then all vendors will be tested. If a vendor is given, then only that vendor will be tested. """ import unittest, sys, os import xmllib, __builtin__, re def __imp__(module, attr=None): if attr: j = __import__(module, globals(), locals()) return getattr(j, attr) else: last = module.split(".")[-1] return __import__(module, globals(), locals(), last) class Factory: def __init__(self, classname, method): self.classname = classname self.method = method self.arguments = [] self.keywords = {} class Testcase: def __init__(self, frm, impt): self.frm = frm self.impt = impt self.ignore = [] class Test: def __init__(self, name, os): self.name = name self.os = os self.factory = None self.tests = [] class Vendor: def __init__(self, name, datahandler=None): self.name = name self.datahandler = datahandler self.tests = [] self.tables = {} class ConfigParser(xmllib.XMLParser): """ A simple XML parser for the config file. """ def __init__(self, **kw): apply(xmllib.XMLParser.__init__, (self,), kw) self.vendors = [] self.table_stack = [] self.re_var = re.compile(r"\${(.*?)}") def vendor(self): assert len(self.vendors) > 0, "no vendors" return self.vendors[-1] def test(self): v = self.vendor() assert len(v.tests) > 0, "no tests" return v.tests[-1] def factory(self): c = self.test() assert c.factory, "no factory" return c.factory def testcase(self): s = self.test() assert len(s.tests) > 0, "no testcases" return s.tests[-1] def value(self, value): def repl(sub): from java.lang import System return System.getProperty(sub.group(1), sub.group(1)) value = self.re_var.sub(repl, value) return value def start_vendor(self, attrs): if attrs.has_key('datahandler'): v = Vendor(attrs['name'], attrs['datahandler']) else: v = Vendor(attrs['name']) self.vendors.append(v) def start_test(self, attrs): v = self.vendor() c = Test(attrs['name'], attrs['os']) v.tests.append(c) def start_factory(self, attrs): c = self.test() f = Factory(attrs['class'], attrs['method']) c.factory = f def start_argument(self, attrs): f = self.factory() if attrs.has_key('type'): f.arguments.append((attrs['name'], getattr(__builtin__, attrs['type'])(self.value(attrs['value'])))) else: f.arguments.append((attrs['name'], self.value(attrs['value']))) def start_keyword(self, attrs): f = self.factory() if attrs.has_key('type'): f.keywords[attrs['name']] = getattr(__builtin__, attrs['type'])(self.value(attrs['value'])) else: f.keywords[attrs['name']] = self.value(attrs['value']) def start_ignore(self, attrs): t = self.testcase() t.ignore.append(attrs['name']) def start_testcase(self, attrs): c = self.test() c.tests.append(Testcase(attrs['from'], attrs['import'])) def start_table(self, attrs): self.table_stack.append((attrs['ref'], attrs['name'])) def end_table(self): del self.table_stack[-1] def handle_data(self, data): if len(self.table_stack): ref, tabname = self.table_stack[-1] self.vendor().tables[ref] = (tabname, data.strip()) class SQLTestCase(unittest.TestCase): """ Base testing class. It contains the list of table and factory information to run any tests. """ def __init__(self, name, vendor, factory): unittest.TestCase.__init__(self, name) self.vendor = vendor self.factory = factory if self.vendor.datahandler: self.datahandler = __imp__(self.vendor.datahandler) def table(self, name): return self.vendor.tables[name] def has_table(self, name): return self.vendor.tables.has_key(name) def make_suite(vendor, testcase, factory): clz = __imp__(testcase.frm, testcase.impt) caseNames = filter(lambda x, i=testcase.ignore: x not in i, unittest.getTestCaseNames(clz, "test")) tests = [clz(caseName, vendor, factory) for caseName in caseNames] return unittest.TestSuite(tests) def test(vendors, include=None): for vendor in vendors: if not include or vendor.name in include: print print "testing [%s]" % (vendor.name) for test in vendor.tests: if not test.os or test.os == os.name: for testcase in test.tests: suite = make_suite(vendor, testcase, test.factory) unittest.TextTestRunner().run(suite) else: print print "skipping [%s]" % (vendor.name) if __name__ == '__main__': configParser = ConfigParser() fp = open(sys.argv[1], "r") configParser.feed(fp.read()) fp.close() test(configParser.vendors, sys.argv[2:]) --- NEW FILE: test.xml --- <?xml version="1.0"?> <!-- Jython Database Specification API 2.0 $Id: test.xml,v 1.1 2001/12/14 04:20:03 bzimmer Exp $ Copyright (c) 2001 brian zimmer <bz...@zi...> --> <tests> <vendor name="postgresql" datahandler="com.ziclix.python.sql.handler.PostgresqlDataHandler"> <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=""/> <argument name="driver" value="org.postgresql.Driver"/> </factory> <testcase from="zxtest" import="zxCoreTest"> <!-- Returns any empty ResultSet every time. --> <ignore name="testIndexInfo"/> </testcase> <testcase from="zxtest" import="BCPTest"/> <testcase from="dbextstest" import="dbextsTestCase"/> </test> <!-- <test name="datasource" os="java"> <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"/> <keyword name="password" value=""/> <keyword name="portNumber" value="5432" type="int"/> </factory> <testcase from="zxtest" import="zxCoreTest"> <ignore name="testIndexInfo"/> </testcase> <testcase from="zxtest" import="BCPTest"/> </test> --> <table ref="texttable" name="c_texttable"> create table c_texttable (a int not null, primary key(a), b text 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 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 datetime) </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> <table ref="post_autoincrementtable" name="aitable_a_seq"> drop sequence aitable_a_seq </table> </vendor> <vendor name="mysql" datahandler="com.ziclix.python.sql.handler.MySQLDataHandler"> <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> <testcase from="zxtest" import="zxCoreTest"/> <testcase from="zxtest" import="BCPTest"/> <testcase from="dbextstest" import="dbextsTestCase"/> </test> <test name="datasource" os="java"> <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> <testcase from="zxtest" import="zxCoreTest"/> <testcase from="zxtest" import="BCPTest"/> </test> <!-- <test name="lookup" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="lookup"> <argument name="jndiName" value="/jdbc/mysqldb"/> <keyword name="INITIAL_CONTEXT_FACTORY" value="com.sun.jndi.fscontext.RefFSContextFactory"/> </factory> <testcase from="zxtest" import="zxCoreTest"/> <testcase from="zxtest" import="BCPTest"/> </test> --> <table ref="texttable" name="c_texttable"> create table c_texttable (a int not null auto_increment, primary key(a), b text not null) </table> <table ref="floattable" name="c_floattable"> create table c_floattable (a int, b float(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 datetime) </table> <table ref="blobtable" name="b_blobtable"> create table b_blobtable (a int, b longblob) </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 int not null auto_increment, primary key(a), b int) </table> </vendor> <vendor name="oracle" datahandler="com.ziclix.python.sql.handler.OracleDataHandler"> <test name="driver" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connect"> <argument name="url" value="jdbc:oracle:thin:@localhost:1521:ziclix"/> <argument name="usr" value="jython"/> <argument name="pwd" value="jython"/> <argument name="driver" value="oracle.jdbc.driver.OracleDriver"/> </factory> <testcase from="zxtest" import="zxCoreTest"> <ignore name="testRowid"/> </testcase> <testcase from="zxtest" import="BCPTest"/> <testcase from="dbextstest" import="dbextsTestCase"/> </test> <test name="datasource" os="java"> <factory class="com.ziclix.python.sql.zxJDBC" method="connectx"> <argument name="datasource" value="oracle.jdbc.pool.OracleConnectionPoolDataSource"/> <keyword name="URL" value="jdbc:oracle:thin:@localhost:1521:ziclix"/> <keyword name="user" value="jython"/> <keyword name="password" value="jython"/> </factory> <testcase from="zxtest" import="zxCoreTest"> <ignore name="testRowid"/> </testcase> <testcase from="zxtest" import="BCPTest"/> </test> <table ref="texttable" name="c_texttable"> create table c_texttable (a int, b varchar2(4000) not null) </table> <table ref="floattable" name="c_floattable"> create table c_floattable (a int, b number(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 date) </table> <table ref="timestamptable" name="c_timestamptable"> create table c_timestamptable (a int, b date) </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> --- NEW FILE: zxtest.py --- # Jython Database Specification API 2.0 # # $Id: zxtest.py,v 1.1 2001/12/14 04:20:03 bzimmer Exp $ # # Copyright (c) 2001 brian zimmer <bz...@zi...> from com.ziclix.python.sql import zxJDBC from java.util import Calendar, Date as JDate import tempfile, os, time, runner class zxJDBCTest(runner.SQLTestCase): def connect(self): factory = runner.__imp__(self.factory.classname) args = map(lambda x: x[1], self.factory.arguments) connect = getattr(factory, self.factory.method) 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) return c def setUp(self): runner.SQLTestCase.setUp(self) self.db = self.connect() self.db.autocommit = 0 c = self.cursor() try: c.execute("drop table zxtesting") except: self.db.rollback() try: c.execute("create table zxtesting (id int not null, name varchar(32), state varchar(32), primary key (id))") c.execute("insert into zxtesting (id, name, state) values (1, 'test0', 'il')") c.execute("insert into zxtesting (id, name, state) values (2, 'test1', 'wi')") c.execute("insert into zxtesting (id, name, state) values (3, 'test2', 'tx')") c.execute("insert into zxtesting (id, name, state) values (4, 'test3', 'co')") c.execute("insert into zxtesting (id, name, state) values (5, 'test4', 'il')") c.execute("insert into zxtesting (id, name, state) values (6, 'test5', 'ca')") c.execute("insert into zxtesting (id, name, state) values (7, 'test6', 'wi')") self.db.commit() finally: c.close() def tearDown(self): c = self.cursor() try: try: c.execute("drop table zxtesting") except: self.db.rollback() finally: c.close() try: self.db.close() finally: self.db = None class zxCoreTest(zxJDBCTest): def testConnection(self): """testing connection""" assert self.db, "invalid connection" def testSimpleQuery(self): """testing simple queries with cursor.execute(), no parameters""" c = self.cursor() try: c.execute("select count(*) from zxtesting") f = c.fetchall() assert len(f) == 1, "expecting one row" c.execute("select * from zxtesting") data = c.fetchone() assert len(f) == 1, "expecting one row" assert data[0] == 1, "expected [1] rows, got [%d]" % (data[0]) finally: c.close() def testColumns(self): """testing cursor.columns()""" c = self.cursor() try: c.columns(None, None, "zxtesting", None) f = c.fetchall() assert c.rowcount == 3, "columns() failed to report correct number of columns, expected [3], got [%d]" % (c.rowcount) f.sort(lambda x, y: cmp(x[3], y[3])) assert "name" == f[1][3].lower(), "expected [name], got [%s]" % (f[1][3].lower()) finally: c.close() def testTypeInfo(self): """testing cursor.gettypeinfo()""" c = self.cursor() try: c.gettypeinfo() f = c.fetchall() assert f is not None, "expected some type information, got None" # this worked prior to the Fetch re-write, now the client will have to bear the burden, sorry #c.gettypeinfo(zxJDBC.INTEGER) #f = c.fetchall() #assert f[0][1] == zxJDBC.INTEGER, "expected [%d], got [%d]" % (zxJDBC.INTEGER, f[0][1]) finally: c.close() def testTableTypeInfo(self): """testing cursor.gettabletypeinfo()""" c = self.cursor() try: c.gettabletypeinfo() c.fetchall() assert c.rowcount > 0, "expected some table types" finally: c.close() def testTupleParams(self): """testing the different ways to pass params to execute()""" c = self.cursor() try: self.assertRaises(zxJDBC.ProgrammingError, c.execute, "select * from zxtesting where id = ?", params=4) c.execute("select * from zxtesting where id = ?", params=[4]) c.execute("select * from zxtesting where id = ?", params=(4,)) finally: c.close() def testConnectionAttribute(self): """testing the getting and setting of cursor.connection""" c = self.cursor() try: from com.ziclix.python.sql import PyConnection assert isinstance(c.connection, PyConnection), "expected PyConnection" self.assertRaises(TypeError, setattr, (c, "connection", None), None) finally: c.close() def testFetchMany(self): """testing cursor.fetchmany()""" c = self.cursor() try: c.execute("select * from zxtesting") data = c.fetchmany(6) assert len(data) == 6, "expected [6] rows, got [%d]" % (len(data)) c.execute("select * from zxtesting") data = c.fetchmany(16) assert len(data) == 7, "expected [7] rows, got [%d]" % (len(data)) finally: c.close() def testQueryWithParameter(self): """testing query by parameter""" c = self.cursor() try: c.execute("select name from zxtesting where state = ?", [("il",)], {0:zxJDBC.VARCHAR}) data = c.fetchall() assert len(data) == 2, "expected [2] rows, got [%d]" % (len(data)) c.execute("select name from zxtesting where state = ?", [("co",)], {0:zxJDBC.VARCHAR}) data = c.fetchall() assert len(data) == 1, "expected [1] row, got [%d]" % (len(data)) finally: c.close() def testInsertWithFile(self): """testing insert with file""" assert self.has_table("texttable"), "missing attribute texttable" fp = open(tempfile.mktemp(), "w") try: c = self.cursor() c.execute(self.table("texttable")[1]) data = fp.name * 300 data = data[:3500] fp.write(data) fp.flush() fp.close() fp = open(fp.name, "r") c.execute("insert into %s (a, b) values (?, ?)" % (self.table("texttable")[0]), [(0, fp)], {1:zxJDBC.LONGVARCHAR}) self.db.commit() c.execute("select b from %s" % (self.table("texttable")[0])) f = c.fetchall() assert len(f) == 1, "expected [1] row, got [%d]" % (len(f)) assert len(f[0][0]) == len(data), "expected [%d], got [%d]" % (len(data), len(f[0][0])) assert data == f[0][0], "failed to retrieve the same text as inserted" finally: c.execute("drop table %s" % (self.table("texttable")[0])) c.close() self.db.commit() fp.close() os.remove(fp.name) def __calendar(self): c = Calendar.getInstance() c.setTime(JDate()) return c def testDate(self): """testing creation of Date""" # Java uses milliseconds and Python uses seconds, so adjust the time accordingly # seeded with Java c = self.__calendar() o = zxJDBC.DateFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Date(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE)) assert o.equals(v), "incorrect date conversion using java, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) # seeded with Python t = time.time() l = time.localtime(t) o = zxJDBC.DateFromTicks(t) v = zxJDBC.Date(l[0], l[1], l[2]) assert o.equals(v), "incorrect date conversion, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) def testTime(self): """testing creation of Time""" # Java uses milliseconds and Python uses seconds, so adjust the time accordingly # seeded with Java c = self.__calendar() o = zxJDBC.TimeFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Time(c.get(Calendar.HOUR), c.get(Calendar.MINUTE), c.get(Calendar.SECOND)) assert o.equals(v), "incorrect date conversion using java, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) # seeded with Python #t = time.time() #l = time.localtime(t) #o = zxJDBC.TimeFromTicks(t) #v = zxJDBC.Time(l[3], l[4], l[5]) #assert o.equals(v), "incorrect date conversion using python, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) def testTimestamp(self): """testing creation of Timestamp""" # Java uses milliseconds and Python uses seconds, so adjust the time accordingly # seeded with Java c = self.__calendar() o = zxJDBC.TimestampFromTicks(c.getTime().getTime() / 1000L) v = zxJDBC.Timestamp(c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE), c.get(Calendar.HOUR), c.get(Calendar.MINUTE), c.get(Calendar.SECOND)) assert o.equals(v), "incorrect date conversion using java, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) # seeded with Python #t = time.time() #l = time.localtime(t) #o = zxJDBC.TimestampFromTicks(t) #v = zxJDBC.Timestamp(l[0], l[1], l[2], l[3], l[4], l[5]) #assert o.equals(v), "incorrect date conversion using python, got [%ld], expected [%ld]" % (v.getTime(), o.getTime()) def _test_precision(self, (tabname, sql), diff, values, attr): try: c = self.cursor() try: c.execute("drop table %s" % (tabname)) self.db.commit() except: self.db.rollback() finally: c.close() try: c = self.cursor() c.execute(sql) c.execute("insert into %s (a, b) values (?, ?)" % (tabname), map(lambda x: (0, x), values)) c.execute("select a, b from %s" % (tabname)) f = c.fetchall() assert len(values) == len(f), "mismatched result set length" for i in range(0, len(f)): v = values[i] if attr: v = getattr(v, attr)() msg = "expected [%0.10f], got [%0.10f] for index [%d] of [%d]" % (v, f[i][1], (i+1), len(f)) assert diff(f[i][1], values[i]) < 0.01, msg self.db.commit() finally: c.close() try: c = self.cursor() try: c.execute("drop table %s" % (tabname)) self.db.commit() except: self.db.rollback() finally: c.close() def testFloat(self): """testing value of float""" assert self.has_table("floattable"), "missing attribute floattable" values = [4.22, 123.44, 292.09, 33.2, 102.00, 445] self._test_precision(self.table("floattable"), lambda x, y: x-y, values, None) def testBigDecimal(self): """testing value of BigDecimal""" assert self.has_table("floattable"), "missing attribute floattable" from java.math import BigDecimal values = map(lambda x, b=BigDecimal: b(x), [4.22, 123.44, 292.09, 33.2, 102.00, 445]) self._test_precision(self.table("floattable"), lambda x, y, b=BigDecimal: b(x).subtract(y).doubleValue(), values, "doubleValue") def testBigDecimalConvertedToDouble(self): """testing value of BigDecimal when converted to double""" assert self.has_table("floattable"), "missing attribute floattable" from java.math import BigDecimal values = map(lambda x, b=BigDecimal: b(x), [4.22, 123.44, 33.2, 102.00, 445, 292.09]) self._test_precision(self.table("floattable"), lambda x, y: x - y.doubleValue(), values, "doubleValue") def testNextset(self): """testing nextset""" c = self.cursor() try: c.execute("select * from zxtesting where id = ?", [(3,), (4,)]) f = c.fetchall() assert f, "expected results, got None" assert len(f) == 1, "expected [1], got [%d]" % (len(f)) assert c.nextset(), "expected next set, got None" f = c.fetchall() assert f, "expected results after call to nextset(), got None" assert len(f) == 1, "expected [1], got [%d]" % (len(f)) finally: c.close() def testJavaUtilList(self): """testing parameterized values in a java.util.List""" c = self.cursor() try: from java.util import LinkedList a = LinkedList() a.add((3,)) c.execute("select * from zxtesting where id = ?", a) f = c.fetchall() assert len(f) == 1, "expected [1], got [%d]" % (len(f)) finally: c.close() def __updatecount(self, insert_only=0): from com.ziclix.python.sql.handler import UpdateCountDataHandler c = self.cursor() try: c.datahandler = UpdateCountDataHandler(c.datahandler) msg = "wrong instance, expected [UpdateCountDataHandler], got [%s]" % (str(c.datahandler)) assert isinstance(c.datahandler, UpdateCountDataHandler), msg c.execute("insert into zxtesting values (?, ?, ?)", [(500, 'bz', 'or')]) assert c.datahandler.updateCount == 1, "expected [1], got [%d]" % (c.datahandler.updateCount) # there's a *feature* in the mysql engine where it returns 0 for delete if there is no # where clause, regardless of the actual value. using a where clause forces it to calculate # the appropriate value c.execute("delete from zxtesting where 1>0") if not insert_only: assert c.datahandler.updateCount == 8, "expected [8], got [%d]" % (c.datahandler.updateCount) finally: c.close() def testUpdateCountDataHandler(self): """testing custom data handler for getting the update count""" self.__updatecount() def testUpdateCountDataHandlerInsertOnly(self): """testing custom data handler for getting the update count on inserts only""" self.__updatecount(1) def _test_time(self, (tabname, sql), factory, values, _type, _cmp=cmp): c = self.cursor() try: c.execute(sql) dates = map(lambda x, f=factory: apply(f, x), values) for a in dates: c.execute("insert into %s values (1, ?)" % (tabname), [(a,)], {0:_type}) self.db.commit() c.execute("select * from %s where b = ?" % (tabname), [(dates[0],)], {0:_type}) f = c.fetchall() assert len(f) == 1, "expected length [1], got [%d]" % (len(f)) assert _cmp(f[0][1], dates[0]) == 0, "expected date [%s], got [%s]" % (str(dates[0]), str(f[0][1])) c.execute("delete from %s where b = ?" % (tabname), [(dates[1],)], {0:_type}) self.db.commit() c.execute("select * from %s" % (tabname)) f = c.fetchall() assert len(f) == len(dates) - 1, "expected length [%d], got [%d]" % (len(dates) - 1, len(f)) finally: c.execute("drop table %s" % (tabname)) c.close() self.db.commit() def testUpdateSelectByDate(self): """testing insert, update, query and delete by java.sql.Date""" assert self.has_table("datetable"), "missing attribute datetable" def _cmp_(x, y): xt = (x.getYear(), x.getMonth(), x.getDay()) yt = (y.getYear(), y.getMonth(), y.getDay()) return not xt == yt values = [(1996, 6, 22), (2000, 11, 12), (2000, 1, 12), (1999, 9, 24)] self._test_time(self.table("datetable"), zxJDBC.Date, values, zxJDBC.DATE, _cmp_) def testUpdateSelectByTime(self): """testing insert, update, query and delete by java.sql.Time""" assert self.has_table("timetable"), "missing attribute timetable" def _cmp_(x, y): xt = (x.getHours(), x.getMinutes(), x.getSeconds()) yt = (y.getHours(), y.getMinutes(), y.getSeconds()) return not xt == yt values = [(10, 11, 12), (3, 1, 12), (22, 9, 24)] self._test_time(self.table("timetable"), zxJDBC.Time, values, zxJDBC.TIME, _cmp_) def testUpdateSelectByTimestamp(self): """testing insert, update, query and delete by java.sql.Timestamp""" assert self.has_table("timestamptable"), "missing attribute timestamptable" def _cmp_(x, y): xt = (x.getYear(), x.getMonth(), x.getDay(), x.getHours(), x.getMinutes(), x.getSeconds()) yt = (y.getYear(), y.getMonth(), y.getDay(), y.getHours(), y.getMinutes(), y.getSeconds()) return not xt == yt values = [(1996, 6, 22, 10, 11, 12), (2000, 11, 12, 3, 1, 12), (2001, 1, 12, 4, 9, 24)] 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 c.execute("select * from zxtesting where id = ?", bindings={0:zxJDBC.INTEGER}, params=[(3,)]) f = c.fetchall() assert len(f) == 1, "expected length [1], got [%d]" % (len(f)) # bindings and params flipped, empty params c.execute("select * from zxtesting where id = ?", bindings={}, params=[(3,)]) f = c.fetchall() assert len(f) == 1, "expected length [1], got [%d]" % (len(f)) # bindings and params flipped, empty params, empty bindings c.execute("select * from zxtesting where id = 3", bindings={}, params=[]) f = c.fetchall() assert len(f) == 1, "expected length [1], got [%d]" % (len(f)) finally: c.close() self.db.commit() def testMaxrows(self): """testing maxrows""" c = self.cursor() try: c.execute("select * from zxtesting", maxrows=3) f = c.fetchall() assert len(f) == 3, "expected length [3], got [%d]" % (len(f)) c.execute("select count(*) from zxtesting") f = c.fetchall() num = f[0][0] c.execute("select * from zxtesting", maxrows=0) f = c.fetchall() assert len(f) == num, "expected length [%d], got [%d]" % (num, len(f)) finally: c.close() self.db.commit() def testPrimaryKey(self): """testing for primary key information""" c = self.cursor() try: c.primarykeys(None, None, "zxtesting") f = c.fetchall() assert len(f) == 1, "expected [1], got [%d]" % (len(f)) assert f[0][3].lower() == "id", "expected [id], got [%s]" % (f[0][3]) finally: c.close() self.db.commit() def testForeignKey(self): """testing for foreign key information""" pass def testIndexInfo(self): """testing index information""" c = self.cursor() try: c.statistics(None, None, "zxtesting", 0, 0) f = c.fetchall() assert f is not None, "expected some values" # filter out any indicies with name None f = filter(lambda x: x[5], f) assert len(f) == 1, "expected [1], got [%d]" % (len(f)) finally: c.close() def testFetchingBeforeExecute(self): """testing fetch methods before execution""" c = self.cursor() try: f = c.fetchall() assert f == None, "expecting no results since no execute*() has been called" finally: c.close() def testFetchingWithArraysize(self): """testing fetch methods using arraysize""" c = self.cursor() try: c.execute("select * from zxtesting") f = c.fetchmany() assert len(f) == c.arraysize, "expecting [%d] rows, got [%d]" % (c.arraysize, len(f)) c.execute("select * from zxtesting") c.arraysize = 4 f = c.fetchmany() assert len(f) == 4, "expecting [4] rows, got [%d]" % (len(f)) c.execute("select * from zxtesting") c.arraysize = -1 f = c.fetchmany() assert len(f) == 7, "expecting [7] rows, got [%d]" % (len(f)) finally: c.close() def testBindingsWithNoParams(self): """testing bindings with no params""" c = self.cursor() try: self.assertRaises(zxJDBC.ProgrammingError, c.execute, "select * from zxtesting", {0:zxJDBC.INTEGER}) # test an inappropriate value for a binding self.assertRaises(zxJDBC.ProgrammingError, c.execute, "select * from zxtesting", {0:{}}) finally: c.close() def testDynamicCursor(self): """testing dynamic cursor queries""" c = self.cursor(1) try: c.execute("select * from zxtesting") f = c.fetchmany(4) assert len(f) == 4, "expected [4] rows, got [%d]" % (len(f)) finally: c.close() def testRowid(self): """test the autoincrement facilities of the different handlers""" assert self.has_table("autoincrementtable"), "no autoincrement table" c = self.cursor() assert "expected initial rowid to be None", c.rowid == None try: tabname, sql = self.table("autoincrementtable") c.execute(sql) c.execute("insert into %s (b) values (?)" % (tabname), [(0,)]) assert c.rowid is not None, "rowid is None" try: for idx in range(c.rowid + 1, c.rowid + 25): c.execute("insert into %s (b) values (?)" % (tabname), [(idx,)]) assert c.rowid is not None, "rowid is None" assert c.rowid == idx, "expected rowid [%d], got [%d]" % (idx, c.rowid) except: self.db.rollback() finally: if self.has_table("post_autoincrementtable"): try: sequence, sql = self.table("post_autoincrementtable") c.execute(sql) self.db.commit() except: self.db.rollback() try: c.execute("drop table %s" % (tabname)) self.db.commit() except: self.db.rollback() self.db.commit() c.close() class LOBTest(zxJDBCTest): def __blob(self, obj=0): assert self.has_table("blobtable"), "no blob table" c = self.cursor() tabname, sql = self.table("blobtable") fn = tempfile.mktemp() fp = None try: hello = ("hello",) * 1024 c.execute(sql) self.db.commit() from java.io import FileOutputStream, FileInputStream, ObjectOutputStream, ObjectInputStream, ByteArrayInputStream fp = FileOutputStream(fn) oos = ObjectOutputStream(fp) oos.writeObject(hello) fp.close() fp = FileInputStream(fn) blob = ObjectInputStream(fp) value = blob.readObject() fp.close() assert hello == value, "unable to serialize properly" if obj == 1: fp = open(fn, "rb") else: fp = FileInputStream(fn) c.execute("insert into %s (a, b) values (?, ?)" % (tabname), [(0, fp)], {1:zxJDBC.BLOB}) self.db.commit() c.execute("select * from %s" % (tabname)) f = c.fetchall() bytes = f[0][1] blob = ObjectInputStream(ByteArrayInputStream(bytes)).readObject() assert hello == blob, "blobs are not equal" finally: c.execute("drop table %s" % (tabname)) c.close() self.db.commit() if os.path.exists(fn): if fp: fp.close() os.remove(fn) def testBLOBAsString(self): """testing BLOB as string""" self.__blob() def testBLOBAsPyFile(self): """testing BLOB as PyFile""" self.__blob(1) def __clob(self, asfile=0): assert self.has_table("clobtable"), "no clob table" c = self.cursor() tabname, sql = self.table("clobtable") try: hello = "hello" * 1024 * 10 c.execute(sql) self.db.commit() if asfile: fp = open(tempfile.mktemp(), "w") fp.write(hello) fp.flush() fp.close() obj = open(fp.name, "r") else: obj = hello c.execute("insert into %s (a, b) values (?, ?)" % (tabname), [(0, obj)], {1:zxJDBC.CLOB}) c.execute("select * from %s" % (tabname), maxrows=1) f = c.fetchall() assert len(f) == 1, "expected [%d], got [%d]" % (1, len(f)) assert hello == f[0][1], "clobs are not equal" finally: c.execute("drop table %s" % (tabname)) c.close() self.db.commit() if asfile: obj.close() os.remove(obj.name) def testCLOBAsString(self): """testing CLOB as string""" self.__clob(0) def testCLOBAsPyFile(self): """testing CLOB as PyFile""" self.__clob(1) class BCPTest(zxJDBCTest): def testCSVPipe(self): """testing the CSV pipe""" from java.io import PrintWriter, FileWriter from com.ziclix.python.sql.pipe import Pipe from com.ziclix.python.sql.pipe.db import DBSource from com.ziclix.python.sql.pipe.csv import CSVSink try: src = self.connect() fn = tempfile.mktemp(suffix="csv") writer = PrintWriter(FileWriter(fn)) csvSink = CSVSink(writer) c = self.cursor() try: c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1000, 'this,has,a,comma', 'and a " quote')]) c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1001, 'this,has,a,comma and a "', 'and a " quote')]) # ORACLE has a problem calling stmt.setObject(index, null) c.execute("insert into zxtesting (id, name, state) values (?, ?, ?)", [(1010, '"this,has,a,comma"', None)], {2:zxJDBC.VARCHAR}) self.db.commit() finally: self.db.rollback() c.close() dbSource = DBSource(src, self.datahandler, "zxtesting", None, None, None) cnt = Pipe().pipe(dbSource, csvSink) - 1 # ignore the header row finally: writer.close() src.close() os.remove(fn) def _testXMLPipe(self): """testing the XML pipe""" from java.io import PrintWriter, FileWriter from com.ziclix.python.sql.pipe import Pipe from com.ziclix.python.sql.pipe.db import DBSource from com.ziclix.python.sql.pipe.xml import XMLSink try: src = self.connect() fn = tempfile.mktemp(suffix="csv") writer = PrintWriter(FileWriter(fn)) xmlSink = XMLSink(writer) dbSource = DBSource(src, self.datahandler, "zxtesting", None, None, None) cnt = Pipe().pipe(dbSource, xmlSink) - 1 # ignore the header row finally: writer.close() src.close() os.remove(fn) def testDBPipe(self): """testing the DB pipe""" from com.ziclix.python.sql.pipe import Pipe from com.ziclix.python.sql.pipe.db import DBSource, DBSink try: src = self.connect() dst = self.connect() c = self.cursor() c.execute("create table zxtestingbcp (id int not null, name varchar(20), state varchar(2), primary key (id))") self.db.commit() c.execute("select count(*) from zxtesting") one = c.fetchone()[0] c.close() dbSource = DBSource(src, self.datahandler, "zxtesting", None, None, None) dbSink = DBSink(dst, self.datahandler, "zxtestingbcp", None, None, 1) cnt = Pipe().pipe(dbSource, dbSink) - 1 # ignore the header row c = self.cursor() c.execute("select count(*) from zxtestingbcp") two = c.fetchone()[0] c.execute("delete from zxtestingbcp") self.db.commit() c.close() assert one == two, "expected [%d] rows in destination, got [%d] (sql)" % (one, two) assert one == cnt, "expected [%d] rows in destination, got [%d] (bcp)" % (one, cnt) # this tests the internal assert in BCP. we need to handle the case where we exclude # all the rows queried (based on the fact no columns exist) but rows were fetched # also make sure (eg, Oracle) that the column name case is ignored dbSource = DBSource(src, self.datahandler, "zxtesting", None, ["id"], None) dbSink = DBSink(dst, self.datahandler, "zxtestingbcp", ["id"], None, 1) self.assertRaises(zxJDBC.Error, Pipe().pipe, dbSource, dbSink) params = [(4,)] dbSource = DBSource(src, self.datahandler, "zxtesting", "id > ?", None, params) dbSink = DBSink(dst, self.datahandler, "zxtestingbcp", None, None, 1) cnt = Pipe().pipe(dbSource, dbSink) - 1 # ignore the header row c = self.cursor() c.execute("select count(*) from zxtesting where id > ?", params) one = c.fetchone()[0] c.execute("select count(*) from zxtestingbcp") two = c.fetchone()[0] c.close() assert one == two, "expected [%d] rows in destination, got [%d] (sql)" % (one, two) assert one == cnt, "expected [%d] rows in destination, got [%d] (bcp)" % (one, cnt) finally: try: c = self.cursor() try: c.execute("drop table zxtestingbcp") self.db.commit() except: self.db.rollback() finally: c.close() try: src.close() except: src = None try: dst.close() except: dst = None def testBCP(self): """testing bcp parameters and functionality""" from com.ziclix.python.sql.util import BCP import dbexts try: src = self.connect() dst = self.connect() c = self.cursor() c.execute("create table zxtestingbcp (id int not null, name varchar(20), state varchar(2), primary key (id))") self.db.commit() c.execute("select count(*) from zxtesting") one = c.fetchone()[0] c.close() b = BCP(src, dst) if hasattr(self, "datahandler"): b.sourceDataHandler = self.datahandler b.destinationDataHandler = self.datahandler cnt = b.bcp("zxtesting", toTable="zxtestingbcp") c = self.cursor() c.execute("select count(*) from zxtestingbcp") two = c.fetchone()[0] c.execute("delete from zxtestingbcp") self.db.commit() c.close() assert one == two, "expected [%d] rows in destination, got [%d] (sql)" % (one, two) assert one == cnt, "expected [%d] rows in destination, got [%d] (bcp)" % (one, cnt) # this tests the internal assert in BCP. we need to handle the case where we exclude # all the rows queried (based on the fact no columns exist) but rows were fetched # also make sure (eg, Oracle) that the column name case is ignored self.assertRaises(zxJDBC.Error, b.bcp, "zxtesting", toTable="zxtestingbcp", include=["id"], exclude=["id"]) params = [(4,)] cnt = b.bcp("zxtesting", "id > ?", params, toTable="zxtestingbcp") c = self.cursor() c.execute("select count(*) from zxtesting where id > ?", params) one = c.fetchone()[0] c.execute("select count(*) from zxtestingbcp") two = c.fetchone()[0] c.close() assert one == two, "expected [%d] rows in destination, got [%d] (sql)" % (one, two) assert one == cnt, "expected [%d] rows in destination, got [%d] (bcp)" % (one, cnt) finally: try: c = self.cursor() try: c.execute("drop table zxtestingbcp") self.db.commit() except: self.db.rollback() finally: c.close() try: src.close() except: src = None try: dst.close() except: dst = None |
From: brian z. <bz...@us...> - 2001-12-14 04:19:30
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/handler In directory usw-pr-cvs1:/tmp/cvs-serv28847/com/ziclix/python/sql/handler Modified Files: OracleDataHandler.java Log Message: handle decimal Index: OracleDataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/handler/OracleDataHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OracleDataHandler.java 2001/12/07 02:56:39 1.2 --- OracleDataHandler.java 2001/12/14 04:19:27 1.3 *************** *** 12,19 **** import java.io.*; import java.sql.*; import org.python.core.*; ! import oracle.sql.*; ! import oracle.jdbc.driver.*; ! import com.ziclix.python.sql.*; /** --- 12,24 ---- import java.io.*; import java.sql.*; + import java.math.BigDecimal; import org.python.core.*; ! import oracle.sql.BLOB; ! import oracle.sql.ROWID; ! import oracle.jdbc.driver.OracleTypes; ! import oracle.jdbc.driver.OracleResultSet; ! import com.ziclix.python.sql.DataHandler; ! import com.ziclix.python.sql.FilterDataHandler; ! import com.ziclix.python.sql.zxJDBC; /** *************** *** 61,64 **** --- 66,83 ---- case OracleTypes.ROWID : stmt.setString(index, (String)object.__tojava__(String.class)); + break; + + case Types.DECIMAL : + + // Oracle is annoying + Object input = object.__tojava__(Double.class); + + if (input != Py.NoConversion) { + stmt.setDouble(index, ((Double)input).doubleValue()); + + break; + } + + super.setJDBCObject(stmt, index, object, type); break; |
From: brian z. <bz...@us...> - 2001-12-14 04:18:57
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv28746/com/ziclix/python/sql Modified Files: zxJDBC.java Log Message: mask makeException() from python Index: zxJDBC.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/zxJDBC.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** zxJDBC.java 2001/12/07 02:56:39 1.3 --- zxJDBC.java 2001/12/14 04:18:54 1.4 *************** *** 107,110 **** --- 107,111 ---- dict.__setitem__("resourceBundle", null); dict.__setitem__("getString", null); + dict.__setitem__("makeException", null); } |
From: brian z. <bz...@us...> - 2001-12-14 04:17:18
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv28379/Lib/test/zxjdbc Log Message: Directory /cvsroot/jython/jython/Lib/test/zxjdbc added to the repository |
From: brian z. <bz...@us...> - 2001-12-12 17:19:49
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv17905/ziclix/python/sql Modified Files: PyConnection.java PyExtendedCursor.java Log Message: improved __methods__ and __members__ Index: PyConnection.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyConnection.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyConnection.java 2001/12/10 03:37:40 1.3 --- PyConnection.java 2001/12/12 17:19:45 1.4 *************** *** 41,44 **** --- 41,69 ---- } + /** Field __members__ */ + protected static PyList __members__; + + /** Field __methods__ */ + protected static PyList __methods__; + + static { + PyObject[] m = new PyObject[5]; + + m[0] = new PyString("close"); + m[1] = new PyString("commit"); + m[2] = new PyString("cursor"); + m[3] = new PyString("rollback"); + m[4] = new PyString("nativesql"); + __methods__ = new PyList(m); + m = new PyObject[6]; + m[0] = new PyString("autocommit"); + m[1] = new PyString("dbname"); + m[2] = new PyString("dbversion"); + m[3] = new PyString("driverversion"); + m[4] = new PyString("url"); + m[5] = new PyString("__connection__"); + __members__ = new PyList(m); + } + /** * Create a PyConnection with the open connection. *************** *** 82,85 **** --- 107,111 ---- dict.__setitem__("cursor", new ConnectionFunc("cursor", 2, 0, 1, zxJDBC.getString("cursor"))); dict.__setitem__("rollback", new ConnectionFunc("rollback", 3, 0, 0, zxJDBC.getString("rollback"))); + dict.__setitem__("nativesql", new ConnectionFunc("nativesql", 4, 1, 1, zxJDBC.getString("nativesql"))); // hide from python *************** *** 155,158 **** --- 181,188 ---- } else if ("__connection__".equals(name)) { return Py.java2py(this.connection); + } else if ("__methods__".equals(name)) { + return __methods__; + } else if ("__members__".equals(name)) { + return __members__; } *************** *** 225,228 **** --- 255,282 ---- /** + * Converts the given SQL statement into the system's native SQL grammar. A + * driver may convert the JDBC sql grammar into its system's native SQL grammar + * prior to sending it; this method returns the native form of the statement + * that the driver would have sent. + * + * @param PyObject a SQL statement that may contain one or more '?' parameter placeholders + * + * @return the native form of this statement + * + */ + public PyObject nativesql(PyObject nativeSQL) { + + if (nativeSQL == Py.None) { + return Py.None; + } + + try { + return Py.newString(this.connection.nativeSQL(nativeSQL.__str__().toString())); + } catch (SQLException e) { + throw zxJDBC.newError(e); + } + } + + /** * Return a new Cursor Object using the connection. If the database does not * provide a direct cursor concept, the module will have to emulate cursors *************** *** 324,327 **** --- 378,384 ---- case 2 : return c.cursor(arg.__nonzero__()); + + case 4 : + return c.nativesql(arg); default : Index: PyExtendedCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyExtendedCursor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyExtendedCursor.java 2001/12/10 03:37:40 1.4 --- PyExtendedCursor.java 2001/12/12 17:19:45 1.5 *************** *** 54,59 **** --- 54,64 ---- m[6] = new PyString("statistics"); __methods__ = new PyList(m); + + __methods__.extend(PyCursor.__methods__); + m = new PyObject[0]; __members__ = new PyList(m); + + __members__.extend(PyCursor.__members__); } *************** *** 110,113 **** --- 115,135 ---- dict.__setitem__("classDictInit", null); dict.__setitem__("toString", null); + } + + /** + * Finds the attribute. + * + * @param name the name of the attribute of interest + * @return the value for the attribute of the specified name + */ + public PyObject __findattr__(String name) { + + if ("__methods__".equals(name)) { + return __methods__; + } else if ("__members__".equals(name)) { + return __members__; + } + + return super.__findattr__(name); } |
From: brian z. <bz...@us...> - 2001-12-12 17:19:48
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/resource In directory usw-pr-cvs1:/tmp/cvs-serv17905/ziclix/python/sql/resource Modified Files: zxJDBCMessages.properties Log Message: improved __methods__ and __members__ Index: zxJDBCMessages.properties =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/resource/zxJDBCMessages.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** zxJDBCMessages.properties 2001/12/07 02:56:39 1.2 --- zxJDBCMessages.properties 2001/12/12 17:19:45 1.3 *************** *** 77,80 **** --- 77,85 ---- performed. + nativesql.0=Converts the given SQL statement into the system's native SQL grammar. + nativesql.1=A driver may convert the JDBC sql grammar into its system's native SQL\ + grammar prior to sending it; this method returns the native form of the statement\ + that the driver would have sent. + # exception messages noStoredProc=stored procedures not implemented in db |
From: Finn B. <bc...@us...> - 2001-12-10 20:40:51
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv30406 Modified Files: PyFile.java Log Message: Fix for "[ #490962 ] Typo in PyFile.java". Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** PyFile.java 2001/11/28 19:19:54 2.23 --- PyFile.java 2001/12/10 20:40:48 2.24 *************** *** 55,59 **** } public void truncate(long position) throws java.io.IOException { ! throw new java.io.IOException("file doens't support truncate"); } --- 55,59 ---- } public void truncate(long position) throws java.io.IOException { ! throw new java.io.IOException("file doesn't support truncate"); } |
From: Finn B. <bc...@us...> - 2001-12-10 20:38:56
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv29708 Modified Files: ReadlineConsole.java Log Message: Fix for "[ #490963 ] Please update ReadlineConsole.java". Include a call to Readline.load() as needed in java_readline-0.6. Index: ReadlineConsole.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/ReadlineConsole.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReadlineConsole.java 2001/11/27 13:51:38 1.4 --- ReadlineConsole.java 2001/12/10 20:38:54 1.5 *************** *** 18,21 **** --- 18,29 ---- public ReadlineConsole(PyObject locals, String filename) { super(locals,filename); + String backingLib = PySystemState.registry.getProperty( + "python.console.readlinelib", "Editline"); + try { + Readline.load(ReadlineLibrary.byName(backingLib)); + } catch (RuntimeException e) { + // Silently ignore errors during load of the native library. + // Will use a pure java fallback. + } Readline.initReadline("jpython"); } |
From: brian z. <bz...@us...> - 2001-12-10 03:37:43
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv22641/ziclix/python/sql Modified Files: PyConnection.java PyCursor.java PyExtendedCursor.java Log Message: added cursor.connection Index: PyConnection.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyConnection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyConnection.java 2001/11/27 10:48:04 1.2 --- PyConnection.java 2001/12/10 03:37:40 1.3 *************** *** 211,215 **** * */ ! void rollback() { if (!this.supportsTransactions) { --- 211,215 ---- * */ ! public void rollback() { if (!this.supportsTransactions) { *************** *** 232,236 **** */ public PyCursor cursor() { ! return new PyExtendedCursor(this.connection); } --- 232,236 ---- */ public PyCursor cursor() { ! return new PyExtendedCursor(this); } *************** *** 244,248 **** */ public PyCursor cursor(boolean dynamicFetch) { ! return new PyExtendedCursor(this.connection, dynamicFetch); } } --- 244,248 ---- */ public PyCursor cursor(boolean dynamicFetch) { ! return new PyExtendedCursor(this, dynamicFetch); } } Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyCursor.java 2001/12/08 15:44:29 1.7 --- PyCursor.java 2001/12/10 03:37:40 1.8 *************** *** 43,47 **** /** Field connection */ ! protected Connection connection; /** Field datahandler */ --- 43,47 ---- /** Field connection */ ! protected PyConnection connection; /** Field datahandler */ *************** *** 66,70 **** * Create the cursor with a static fetch. */ ! PyCursor(Connection connection) { this(connection, false); } --- 66,70 ---- * Create the cursor with a static fetch. */ ! PyCursor(PyConnection connection) { this(connection, false); } *************** *** 74,78 **** * If dynamicFetch is true, then use a dynamic fetch. */ ! PyCursor(Connection connection, boolean dynamicFetch) { this.arraysize = 1; --- 74,78 ---- * If dynamicFetch is true, then use a dynamic fetch. */ ! PyCursor(PyConnection connection, boolean dynamicFetch) { this.arraysize = 1; *************** *** 177,180 **** --- 177,182 ---- } else if ("dynamic".equals(name)) { return this.dynamicFetch ? Py.One : Py.Zero; + } else if ("connection".equals(name)) { + return this.connection; } *************** *** 204,208 **** dict.__setitem__("classDictInit", null); dict.__setitem__("toString", null); - dict.__setitem__("connection", null); dict.__setitem__("getDataHandler", null); dict.__setitem__("addWarning", null); --- 206,209 ---- *************** *** 234,237 **** --- 235,248 ---- /** + * Return ths DatabaseMetaData for the current connection. + * + * @return DatabaseMetaData + * + */ + protected DatabaseMetaData getMetaData() throws SQLException { + return this.connection.connection.getMetaData(); + } + + /** * Return the currently bound DataHandler. */ *************** *** 254,273 **** /** - * Prepare a callable statement (stored procedure). - * - * @param sqlString - * @param maxRows max number of rows to be returned - * @throws SQLException - */ - protected void callableStatement(String sqlString, PyObject maxRows) throws SQLException { - - this.sqlStatement = this.connection.prepareCall(sqlString); - - if (maxRows != Py.None) { - this.sqlStatement.setMaxRows(maxRows.__int__().getValue()); - } - } - - /** * Prepare a statement ready for executing. * --- 265,268 ---- *************** *** 280,286 **** if (prepared) { ! this.sqlStatement = this.connection.prepareStatement(sqlString); } else { ! this.sqlStatement = this.connection.createStatement(); } --- 275,281 ---- if (prepared) { ! this.sqlStatement = this.connection.connection.prepareStatement(sqlString); } else { ! this.sqlStatement = this.connection.connection.createStatement(); } *************** *** 306,311 **** try { ! if (this.connection.getMetaData().supportsStoredProcedures()) { ! callableStatement(sqlString, maxRows); execute(params, bindings); } else { --- 301,311 ---- try { ! if (getMetaData().supportsStoredProcedures()) { ! this.sqlStatement = this.connection.connection.prepareCall(sqlString); ! ! if (maxRows != Py.None) { ! this.sqlStatement.setMaxRows(maxRows.__int__().getValue()); ! } ! execute(params, bindings); } else { Index: PyExtendedCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyExtendedCursor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyExtendedCursor.java 2001/12/07 02:56:39 1.3 --- PyExtendedCursor.java 2001/12/10 03:37:40 1.4 *************** *** 61,68 **** * Constructor PyExtendedCursor * ! * @param Connection connection * */ ! PyExtendedCursor(Connection connection) { super(connection); } --- 61,68 ---- * Constructor PyExtendedCursor * ! * @param PyConnection connection * */ ! PyExtendedCursor(PyConnection connection) { super(connection); } *************** *** 71,79 **** * Constructor PyExtendedCursor * ! * @param Connection connection * @param boolean dynamicFetch * */ ! PyExtendedCursor(Connection connection, boolean dynamicFetch) { super(connection, dynamicFetch); } --- 71,79 ---- * Constructor PyExtendedCursor * ! * @param PyConnection connection * @param boolean dynamicFetch * */ ! PyExtendedCursor(PyConnection connection, boolean dynamicFetch) { super(connection, dynamicFetch); } *************** *** 147,151 **** try { ! create(this.connection.getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 147,151 ---- try { ! create(getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 171,175 **** try { ! create(this.connection.getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 171,175 ---- try { ! create(getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 193,197 **** try { ! create(this.connection.getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 193,197 ---- try { ! create(getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 217,221 **** try { ! create(this.connection.getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 217,221 ---- try { ! create(getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 240,244 **** try { ! create(this.connection.getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 240,244 ---- try { ! create(getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 273,277 **** try { ! create(this.connection.getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { throw zxJDBC.newError(e); --- 273,277 ---- try { ! create(getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 304,308 **** try { ! create(this.connection.getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { throw zxJDBC.newError(e); --- 304,308 ---- try { ! create(getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 325,329 **** try { ! create(this.connection.getMetaData().getTypeInfo(), skipCols); } catch (SQLException e) { throw zxJDBC.newError(e); --- 325,329 ---- try { ! create(getMetaData().getTypeInfo(), skipCols); } catch (SQLException e) { throw zxJDBC.newError(e); *************** *** 353,357 **** try { ! create(this.connection.getMetaData().getTableTypes()); } catch (SQLException e) { throw zxJDBC.newError(e); --- 353,357 ---- try { ! create(getMetaData().getTableTypes()); } catch (SQLException e) { throw zxJDBC.newError(e); |
From: brian z. <bz...@us...> - 2001-12-08 15:44:32
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv19856/com/ziclix/python/sql Modified Files: PyCursor.java Log Message: only prepare statements with params Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyCursor.java 2001/12/07 04:03:51 1.6 --- PyCursor.java 2001/12/08 15:44:29 1.7 *************** *** 49,53 **** /** Field sqlStatement */ ! protected PreparedStatement sqlStatement; // they are stateless instances, so we only need to instantiate it once --- 49,53 ---- /** Field sqlStatement */ ! protected Statement sqlStatement; // they are stateless instances, so we only need to instantiate it once *************** *** 143,147 **** if ("arraysize".equals(name)) { ! arraysize = ((PyInteger)value).getValue(); } else if ("datahandler".equals(name)) { this.datahandler = (DataHandler)value.__tojava__(DataHandler.class); --- 143,147 ---- if ("arraysize".equals(name)) { ! arraysize = value.__int__().getValue(); } else if ("datahandler".equals(name)) { this.datahandler = (DataHandler)value.__tojava__(DataHandler.class); *************** *** 160,164 **** if ("arraysize".equals(name)) { ! return new PyInteger(arraysize); } else if ("__methods__".equals(name)) { return __methods__; --- 160,164 ---- if ("arraysize".equals(name)) { ! return Py.newInteger(arraysize); } else if ("__methods__".equals(name)) { return __methods__; *************** *** 168,172 **** return this.fetch.getDescription(); } else if ("rowcount".equals(name)) { ! return new PyInteger(this.fetch.getRowCount()); } else if ("warnings".equals(name)) { return warnings; --- 168,172 ---- return this.fetch.getDescription(); } else if ("rowcount".equals(name)) { ! return Py.newInteger(this.fetch.getRowCount()); } else if ("warnings".equals(name)) { return warnings; *************** *** 274,282 **** * @param sqlString * @param maxRows max number of rows to be returned * @throws SQLException */ ! protected void prepareStatement(String sqlString, PyObject maxRows) throws SQLException { ! this.sqlStatement = this.connection.prepareStatement(sqlString); if (maxRows != Py.None) { --- 274,287 ---- * @param sqlString * @param maxRows max number of rows to be returned + * @param prepared if true, prepare the statement, otherwise create a normal statement * @throws SQLException */ ! protected void prepareStatement(String sqlString, PyObject maxRows, boolean prepared) throws SQLException { ! if (prepared) { ! this.sqlStatement = this.connection.prepareStatement(sqlString); ! } else { ! this.sqlStatement = this.connection.createStatement(); ! } if (maxRows != Py.None) { *************** *** 363,369 **** clear(); try { ! prepareStatement(sqlString, maxRows); ! execute(params, bindings); } catch (PyException e) { throw e; --- 368,390 ---- clear(); + boolean hasParams = hasParams(params); + try { ! prepareStatement(sqlString, maxRows, hasParams); ! ! if (hasParams) { ! execute(params, bindings); ! } else { ! this.datahandler.preExecute(this.sqlStatement); ! ! if (this.sqlStatement.execute(sqlString)) { ! create(this.sqlStatement.getResultSet()); ! } ! ! this.rowid = this.datahandler.getRowId(this.sqlStatement); ! ! addWarning(this.sqlStatement.getWarnings()); ! this.datahandler.postExecute(this.sqlStatement); ! } } catch (PyException e) { throw e; *************** *** 374,381 **** /** ! * Method execute * ! * @param PyObject params ! * @param PyObject bindings * * @throws SQLException --- 395,402 ---- /** ! * The workhorse for properly executing a prepared statement. * ! * @param PyObject params a non-None seq of sequences or entities ! * @param PyObject bindings an optional dictionary of index:DBApiType mappings * * @throws SQLException *************** *** 384,402 **** protected void execute(PyObject params, PyObject bindings) throws SQLException { - boolean seq = isSeq(params); - - // the optional argument better be a sequence - if (!seq && (Py.None != params)) { - throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("optionalSecond")); - } - - boolean hasParams = (seq && (params.__len__() > 0)); - // if we have a sequence of sequences, let's run through them and finish ! if (hasParams && isSeqSeq(params)) { ! for (int i = 0; i < params.__len__(); i++) { PyObject param = params.__getitem__(i); - // [(3, 4)] or [(3, 4), (5, 6)] execute(param, bindings); } --- 405,415 ---- protected void execute(PyObject params, PyObject bindings) throws SQLException { // if we have a sequence of sequences, let's run through them and finish ! if (isSeqSeq(params)) { ! ! // [(3, 4)] or [(3, 4), (5, 6)] ! for (int i = 0, len = params.__len__(); i < len; i++) { PyObject param = params.__getitem__(i); execute(param, bindings); } *************** *** 405,447 **** return; } - - if (hasParams) { ! // clear the statement so all new bindings take affect ! this.sqlStatement.clearParameters(); ! // [3, 4] or (3, 4) ! for (int i = 0; i < params.__len__(); i++) { ! PyObject index = Py.newInteger(i); ! PyObject param = params.__getitem__(i); ! if (bindings != Py.None) { ! PyObject binding = bindings.__finditem__(index); ! if (binding != null) { ! try { ! int bindingValue = binding.__int__().getValue(); ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param, bindingValue); ! continue; ! } catch (PyException e) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("bindingValue")); ! } } - } ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param); } } ! this.datahandler.preExecute(this.sqlStatement); ! this.sqlStatement.execute(); ! this.rowid = this.datahandler.getRowId(this.sqlStatement); ! create(this.sqlStatement.getResultSet()); ! this.datahandler.postExecute(this.sqlStatement); ! addWarning(this.sqlStatement.getWarnings()); return; --- 418,460 ---- return; } ! // [3, 4] or (3, 4) ! PreparedStatement preparedStatement = (PreparedStatement)this.sqlStatement; ! // clear the statement so all new bindings take affect ! preparedStatement.clearParameters(); ! for (int i = 0, len = params.__len__(); i < len; i++) { ! PyObject param = params.__getitem__(i); ! if (bindings != Py.None) { ! PyObject binding = bindings.__finditem__(Py.newInteger(i)); ! if (binding != null) { ! int bindingValue = 0; ! try { ! bindingValue = binding.__int__().getValue(); ! } catch (PyException e) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("bindingValue")); } ! this.datahandler.setJDBCObject(preparedStatement, i + 1, param, bindingValue); ! ! continue; ! } } + + this.datahandler.setJDBCObject(preparedStatement, i + 1, param); } ! this.datahandler.preExecute(preparedStatement); ! preparedStatement.execute(); ! create(preparedStatement.getResultSet()); ! this.rowid = this.datahandler.getRowId(preparedStatement); ! addWarning(preparedStatement.getWarnings()); ! this.datahandler.postExecute(preparedStatement); return; *************** *** 587,591 **** --- 600,609 ---- /** + * Method isSeq + * + * @param PyObject object + * * @return true for any PyList, PyTuple or java.util.List + * */ protected boolean isSeq(PyObject object) { *************** *** 605,609 **** /** ! * @return true for any PyList, PyTuple or java.util.List of PyLists, PyTuples or java.util.Lists */ protected boolean isSeqSeq(PyObject object) { --- 623,656 ---- /** ! * Method hasParams ! * ! * @param PyObject params ! * ! * @return boolean ! * ! */ ! protected boolean hasParams(PyObject params) { ! ! if (Py.None == params) { ! return false; ! } ! ! boolean isSeq = isSeq(params); ! ! // the optional argument better be a sequence ! if (!isSeq) { ! throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("optionalSecond")); ! } ! ! return params.__len__() > 0; ! } ! ! /** ! * Method isSeqSeq ! * ! * @param PyObject object ! * ! * @return true is a sequence of sequences ! * */ protected boolean isSeqSeq(PyObject object) { |
From: Finn B. <bc...@us...> - 2001-12-07 14:15:22
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv4554 Modified Files: PyString.java Log Message: Fix for "[ #490157 ] string.splitlines() - incorrectly splits". Index: PyString.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyString.java,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** PyString.java 2001/11/27 19:07:21 2.52 --- PyString.java 2001/12/07 14:15:18 2.53 *************** *** 1038,1043 **** for (int i = 0; i < n; ) { /* Find a line and append it */ ! while (i < n && (Character.getType(chars[i]) & ! Character.LINE_SEPARATOR) == 0) i++; --- 1038,1043 ---- for (int i = 0; i < n; ) { /* Find a line and append it */ ! while (i < n && chars[i] != '\n' && chars[i] != '\r' && ! Character.getType(chars[i]) != Character.LINE_SEPARATOR) i++; |
From: Finn B. <bc...@us...> - 2001-12-07 14:13:26
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv4719 Added Files: test347.py Log Message: Test for "[ #490157 ] string.splitlines() - incorrectly splits" --- NEW FILE: test347.py --- """ [ #490157 ] string.splitlines() - incorrectly splits """ import support r = 'This is a\n multiline string\n'.splitlines() if r != ['This is a', ' multiline string']: raise support.TestError("Wrong splitlines(): %s" % r) |
From: Finn B. <bc...@us...> - 2001-12-07 13:48:58
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv30907 Modified Files: jython.java Log Message: Fix for "[ #488632 ] -c sys.argv diff" Index: jython.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/jython.java,v retrieving revision 2.23 retrieving revision 2.24 diff -C2 -d -r2.23 -r2.24 *** jython.java 2001/11/27 19:07:22 2.23 --- jython.java 2001/12/07 13:48:56 2.24 *************** *** 279,282 **** --- 279,283 ---- command = args[++index]; if (!fixInteractive) interactive = false; + index++; break; } *************** *** 328,332 **** if (filename != null) argv[0] = filename; ! else argv[0] = ""; for(int i=1; i<n; i++, index++) { --- 329,336 ---- if (filename != null) argv[0] = filename; ! else if (command != null) ! argv[0] = "-c"; ! else ! argv[0] = ""; for(int i=1; i<n; i++, index++) { |
From: Finn B. <bc...@us...> - 2001-12-07 13:48:07
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv30713 Added Files: test346.py Log Message: Test for "[ #488632 ] -c sys.argv diff" --- NEW FILE: test346.py --- """ [ #488632 ] -c sys.argv diff """ import support support.runJython( """-c "import sys; assert sys.argv == ['-c', '-v', 'args']" -v args""") |
From: Finn B. <bc...@us...> - 2001-12-07 13:01:30
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv13968 Modified Files: BaseEvaluator.py PythonVisitor.py Log Message: Fix for "[ #489836 ] Private names is not mangled" Several names are now passed through the getName() method which will perform the mangling. Index: BaseEvaluator.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/BaseEvaluator.py,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** BaseEvaluator.py 2001/11/26 15:21:08 2.14 --- BaseEvaluator.py 2001/12/07 13:01:24 2.15 *************** *** 27,32 **** self.lineno = lineno ! def getName(self, name): ! return self.visitor.getName(name) def visit(self, node): --- 27,32 ---- self.lineno = lineno ! def getName(self, name, fast_locals=0): ! return self.visitor.getName(name, fast_locals) def visit(self, node): *************** *** 63,67 **** def delete(self, node): if node.id == JJTNAME: ! return self.del_name(node.getInfo()) elif node.id == JJTLIST or node.id == JJTTUPLE: return self.del_list(nodeToList(node)) --- 63,67 ---- def delete(self, node): if node.id == JJTNAME: ! return self.del_name(self.getName(node, self.frame.fast_locals)) elif node.id == JJTLIST or node.id == JJTTUPLE: return self.del_list(nodeToList(node)) *************** *** 71,75 **** elif node.id == JJTDOT_OP: return self.del_attribute(node.getChild(0), ! node.getChild(1).getInfo()) else: raise TypeError, 'help, fancy lhs: %s' % node --- 71,75 ---- elif node.id == JJTDOT_OP: return self.del_attribute(node.getChild(0), ! self.getName(node.getChild(1))) else: raise TypeError, 'help, fancy lhs: %s' % node *************** *** 89,93 **** def set(self, node, value): if node.id == JJTNAME: ! return self.set_name(node.getInfo(), value) elif node.id == JJTLIST or node.id == JJTFPLIST or node.id == JJTTUPLE: return self.set_list(nodeToList(node), value) --- 89,94 ---- def set(self, node, value): if node.id == JJTNAME: ! return self.set_name(self.getName(node, self.frame.fast_locals), ! value) elif node.id == JJTLIST or node.id == JJTFPLIST or node.id == JJTTUPLE: return self.set_list(nodeToList(node), value) *************** *** 97,101 **** elif node.id == JJTDOT_OP: return self.set_attribute(node.getChild(0), ! node.getChild(1).getInfo(), value) else: raise TypeError, 'help, fancy lhs: %s' % node --- 98,102 ---- elif node.id == JJTDOT_OP: return self.set_attribute(node.getChild(0), ! self.getName(node.getChild(1)), value) else: raise TypeError, 'help, fancy lhs: %s' % node Index: PythonVisitor.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonVisitor.py,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -d -r2.9 -r2.10 *** PythonVisitor.py 2001/11/26 15:21:08 2.9 --- PythonVisitor.py 2001/12/07 13:01:24 2.10 *************** *** 50,57 **** self.walker = walker ! def getName(self, node): if not node.id == JJTNAME: return None ! return node.getInfo() def walk(self, node): --- 50,64 ---- self.walker = walker ! # The fast_locals arg is supplied when this method is used for ! # names in local scope. ! def getName(self, node, fast_locals=0): if not node.id == JJTNAME: return None ! s = node.getInfo() ! if fast_locals: ! return s ! if s[:2] == '__' and s[-2:] != '__' and self.walker.className: ! s = "_%s%s" % (self.walker.className, s) ! return s def walk(self, node): *************** *** 250,254 **** def Name(self, node): #self.startnode(node) ! return self.walker.name_const(node.getInfo()) def Int(self, node): --- 257,262 ---- def Name(self, node): #self.startnode(node) ! return self.walker.name_const( ! self.getName(node, self.walker.frame.fast_locals)) def Int(self, node): *************** *** 324,328 **** #self.startnode(node) obj = node.getChild(0) ! name = node.getChild(1).getInfo() return self.walker.get_attribute(obj, name) --- 332,336 ---- #self.startnode(node) obj = node.getChild(0) ! name = self.getName(node.getChild(1)) return self.walker.get_attribute(obj, name) *************** *** 368,372 **** if callee.id == JJTDOT_OP and kwargs is None and starargs is None: object = callee.getChild(0) ! name = callee.getChild(1).getInfo() return self.walker.invoke(object, name, args, keyargs) if kwargs or starargs: --- 376,380 ---- if callee.id == JJTDOT_OP and kwargs is None and starargs is None: object = callee.getChild(0) ! name = self.getName(callee.getChild(1)) return self.walker.invoke(object, name, args, keyargs) if kwargs or starargs: *************** *** 479,483 **** self.startnode(node) ! funcname = node.getChild(0).getInfo() Body = node.getChild(node.numChildren-1) --- 487,491 ---- self.startnode(node) ! funcname = self.getName(node.getChild(0)) Body = node.getChild(node.numChildren-1) *************** *** 497,501 **** def classdef(self, node): self.startnode(node) ! name = node.getChild(0).getInfo() n = node.numChildren --- 505,509 ---- def classdef(self, node): self.startnode(node) ! name = self.getName(node.getChild(0)) n = node.numChildren |
From: Finn B. <bc...@us...> - 2001-12-07 12:58:23
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv13501 Modified Files: ObjectFactory.py SimpleCompiler.py Log Message: Pass the classname into the SimpleCompiler instance that is parsing class level and method level code. Index: ObjectFactory.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/ObjectFactory.py,v retrieving revision 2.12 retrieving revision 2.13 diff -C2 -d -r2.12 -r2.13 *** ObjectFactory.py 2001/11/26 15:21:08 2.12 --- ObjectFactory.py 2001/12/07 12:58:17 2.13 *************** *** 105,114 **** return Object(code, Generic) ! def getCompiler(self, parent_compiler, frameCtr, scope): return SimpleCompiler.SimpleCompiler(self.parent.module, self, parent = parent_compiler, frameCtr = frameCtr, scope = scope, ! options = self.parent.options) --- 105,115 ---- return Object(code, Generic) ! def getCompiler(self, parent_compiler, frameCtr, scope, className): return SimpleCompiler.SimpleCompiler(self.parent.module, self, parent = parent_compiler, frameCtr = frameCtr, scope = scope, ! options = self.parent.options, ! className = className) *************** *** 151,155 **** ac = self.scope.ac # Parse the body ! comp = self.factory.getCompiler(self.def_compiler,SimpleCompiler.FunctionFrame,self.scope) for argname in ac.names: comp.frame.setname(argname, self.factory.makePyObject(None)) --- 152,156 ---- ac = self.scope.ac # Parse the body ! comp = self.factory.getCompiler(self.def_compiler,SimpleCompiler.FunctionFrame,self.scope, self.def_compiler.className) for argname in ac.names: comp.frame.setname(argname, self.factory.makePyObject(None)) *************** *** 266,270 **** def makeCode(self): comp = self.factory.getCompiler(self.def_compiler, ! SimpleCompiler.ClassFrame, self.scope) code = jast.Block([comp.parse(self.body), jast.Return(jast.Invoke(comp.frame.frame, --- 267,272 ---- def makeCode(self): comp = self.factory.getCompiler(self.def_compiler, ! SimpleCompiler.ClassFrame, self.scope, ! self.name) code = jast.Block([comp.parse(self.body), jast.Return(jast.Invoke(comp.frame.frame, Index: SimpleCompiler.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/SimpleCompiler.py,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -d -r2.17 -r2.18 *** SimpleCompiler.py 2001/11/26 15:21:08 2.17 --- SimpleCompiler.py 2001/12/07 12:58:17 2.18 *************** *** 236,240 **** class SimpleCompiler(BaseEvaluator, CompilationContext): def __init__(self, module, factory, parent=None, frameCtr=None, scope=None, ! options=None): BaseEvaluator.__init__(self) --- 236,240 ---- class SimpleCompiler(BaseEvaluator, CompilationContext): def __init__(self, module, factory, parent=None, frameCtr=None, scope=None, ! options=None, className=None): BaseEvaluator.__init__(self) *************** *** 253,256 **** --- 253,257 ---- self.factory = factory self.options = options + self.className = className self.listComprehensionStack = [] |
From: Finn B. <bc...@us...> - 2001-12-07 12:54:15
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv10537 Modified Files: CachedJarsPackageManager.java Log Message: addJarToPackages(URL,File,boolean): Don't insert a JarXEntry object in the hashtable if we don't create a .pkc file. The intention is to ensure that the contents of packages.idx is in sync with the .pkc files. Index: CachedJarsPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CachedJarsPackageManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CachedJarsPackageManager.java 2001/10/28 17:13:42 1.10 --- CachedJarsPackageManager.java 2001/12/07 12:54:11 1.11 *************** *** 233,237 **** entry = (JarXEntry)jarfiles.get(jarcanon); ! if (entry == null) { message("processing new jar, '"+ jarcanon+"'"); --- 233,237 ---- entry = (JarXEntry)jarfiles.get(jarcanon); ! if (entry == null && cache) { message("processing new jar, '"+ jarcanon+"'"); *************** *** 255,259 **** ! if (mtime != 0 && entry.mtime == mtime) { zipPackages = readCacheFile(entry, jarcanon); } --- 255,259 ---- ! if (mtime != 0 && entry != null && entry.mtime == mtime) { zipPackages = readCacheFile(entry, jarcanon); } |
From: brian z. <bz...@us...> - 2001-12-07 04:03:54
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30489/Lib Modified Files: dbexts.py Log Message: api cleanup Index: dbexts.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/dbexts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbexts.py 2001/11/20 04:55:18 1.1 --- dbexts.py 2001/12/07 04:03:51 1.2 *************** *** 180,184 **** self.formatter = formatter self.out = out - self.metaDataCase = lambda x: x if not jndiname: --- 180,183 ---- *************** *** 203,209 **** except: pass ! if t.has_key("metaDataCase"): ! self.metaDataCase = getattr(string, t['metaDataCase']) ! keys = filter(lambda x: x not in ['url', 'user', 'pwd', 'driver', 'datahandler', 'name', 'metaDataCase'], t.keys()) props = {} for a in keys: --- 202,206 ---- except: pass ! keys = filter(lambda x: x not in ['url', 'user', 'pwd', 'driver', 'datahandler', 'name'], t.keys()) props = {} for a in keys: *************** *** 323,327 **** """ display the table's primary keys """ cur = self.begin() ! cur.primarykeys(schema, owner, self.metaDataCase(table)) self.commit(cur) self.display() --- 320,324 ---- """ display the table's primary keys """ cur = self.begin() ! cur.primarykeys(schema, owner, table) self.commit(cur) self.display() *************** *** 331,339 **** cur = self.begin() if primary_table and foreign_table: ! cur.foreignkeys(schema, owner, self.metaDataCase(primary_table), schema, owner, self.metaDataCase(foreign_table)) elif primary_table: ! cur.foreignkeys(schema, owner, self.metaDataCase(primary_table), schema, owner, None) elif foreign_table: ! cur.foreignkeys(schema, owner, None, schema, owner, self.metaDataCase(foreign_table)) self.commit(cur) self.display() --- 328,336 ---- cur = self.begin() if primary_table and foreign_table: ! cur.foreignkeys(schema, owner, primary_table, schema, owner, foreign_table) elif primary_table: ! cur.foreignkeys(schema, owner, primary_table, schema, owner, None) elif foreign_table: ! cur.foreignkeys(schema, owner, None, schema, owner, foreign_table) self.commit(cur) self.display() *************** *** 344,348 **** cur = self.begin() if table: ! cur.columns(schema, owner, self.metaDataCase(table), None) else: cur.tables(schema, owner, None, types) --- 341,345 ---- cur = self.begin() if table: ! cur.columns(schema, owner, table, None) else: cur.tables(schema, owner, None, types) *************** *** 364,368 **** """ display the table's indicies """ cur = self.begin() ! cur.statistics(qualifier, owner, self.metaDataCase(table), unique, accuracy) self.commit(cur) self.display() --- 361,365 ---- """ display the table's indicies """ cur = self.begin() ! cur.statistics(qualifier, owner, table, unique, accuracy) self.commit(cur) self.display() |
From: brian z. <bz...@us...> - 2001-12-07 04:03:54
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv30489/com/ziclix/python/sql Modified Files: PyCursor.java Log Message: api cleanup Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyCursor.java 2001/12/07 02:56:39 1.5 --- PyCursor.java 2001/12/07 04:03:51 1.6 *************** *** 257,264 **** * * @param sqlString * @throws SQLException */ ! protected void callableStatement(String sqlString) throws SQLException { this.sqlStatement = this.connection.prepareCall(sqlString); } --- 257,270 ---- * * @param sqlString + * @param maxRows max number of rows to be returned * @throws SQLException */ ! protected void callableStatement(String sqlString, PyObject maxRows) throws SQLException { ! this.sqlStatement = this.connection.prepareCall(sqlString); + + if (maxRows != Py.None) { + this.sqlStatement.setMaxRows(maxRows.__int__().getValue()); + } } *************** *** 272,284 **** protected void prepareStatement(String sqlString, PyObject maxRows) throws SQLException { - int maxrows = 0; - - if (!maxRows.equals(Py.None)) { - maxrows = ((Integer)maxRows.__tojava__(Integer.class)).intValue(); - } - this.sqlStatement = this.connection.prepareStatement(sqlString); ! this.sqlStatement.setMaxRows(maxrows); } --- 278,286 ---- protected void prepareStatement(String sqlString, PyObject maxRows) throws SQLException { this.sqlStatement = this.connection.prepareStatement(sqlString); ! if (maxRows != Py.None) { ! this.sqlStatement.setMaxRows(maxRows.__int__().getValue()); ! } } *************** *** 294,298 **** * through the standard fetchXXX() methods. */ ! public void callproc(String sqlString, PyObject params) { clear(); --- 296,300 ---- * through the standard fetchXXX() methods. */ ! public void callproc(String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { clear(); *************** *** 300,305 **** try { if (this.connection.getMetaData().supportsStoredProcedures()) { ! callableStatement(sqlString); ! execute(params, Py.None); } else { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString("noStoredProc")); --- 302,307 ---- try { if (this.connection.getMetaData().supportsStoredProcedures()) { ! callableStatement(sqlString, maxRows); ! execute(params, bindings); } else { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString("noStoredProc")); *************** *** 323,328 **** * Return values are not defined. */ ! public void executemany(String sqlString, PyObject params, PyObject bindings) { ! execute(sqlString, params, bindings, Py.Zero); } --- 325,330 ---- * Return values are not defined. */ ! public void executemany(String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { ! execute(sqlString, params, bindings, maxRows); } *************** *** 708,715 **** case 0 : ! return cursor.fetchmany(((PyInteger)arg).getValue()); case 5 : ! cursor.execute((String)arg.__tojava__(String.class), Py.None, Py.None, Py.None); return Py.None; --- 710,717 ---- case 0 : ! return cursor.fetchmany(arg.__int__().getValue()); case 5 : ! cursor.execute(arg.__str__().toString(), Py.None, Py.None, Py.None); return Py.None; *************** *** 720,729 **** case 8 : ! cursor.callproc((String)arg.__tojava__(String.class), Py.None); return Py.None; case 9 : ! cursor.executemany((String)arg.__tojava__(String.class), Py.None, Py.None); return Py.None; --- 722,731 ---- case 8 : ! cursor.callproc(arg.__str__().toString(), Py.None, Py.None, Py.None); return Py.None; case 9 : ! cursor.executemany(arg.__str__().toString(), Py.None, Py.None, Py.None); return Py.None; *************** *** 750,754 **** case 5 : ! cursor.execute((String)arga.__tojava__(String.class), argb, Py.None, Py.None); return Py.None; --- 752,756 ---- case 5 : ! cursor.execute(arga.__str__().toString(), argb, Py.None, Py.None); return Py.None; *************** *** 758,767 **** case 8 : ! cursor.callproc((String)arga.__tojava__(String.class), argb); return Py.None; case 9 : ! cursor.executemany((String)arga.__tojava__(String.class), argb, Py.None); return Py.None; --- 760,769 ---- case 8 : ! cursor.callproc(arga.__str__().toString(), argb, Py.None, Py.None); return Py.None; case 9 : ! cursor.executemany(arga.__str__().toString(), argb, Py.None, Py.None); return Py.None; *************** *** 789,798 **** case 5 : ! cursor.execute((String)arga.__tojava__(String.class), argb, argc, Py.None); return Py.None; case 9 : ! cursor.executemany((String)arga.__tojava__(String.class), argb, argc); return Py.None; --- 791,805 ---- case 5 : ! cursor.execute(arga.__str__().toString(), argb, argc, Py.None); ! ! return Py.None; ! ! case 8 : ! cursor.callproc(arga.__str__().toString(), argb, argc, Py.None); return Py.None; case 9 : ! cursor.executemany(arga.__str__().toString(), argb, argc, Py.None); return Py.None; *************** *** 815,833 **** PyCursor cursor = (PyCursor)__self__; switch (index) { case 5 : ! PyArgParser parser = new PyArgParser(args, keywords); ! String sql = (String)parser.arg(0).__tojava__(String.class); ! PyObject params = parser.kw("params", Py.None); ! PyObject bindings = parser.kw("bindings", Py.None); ! PyObject maxrows = parser.kw("maxrows", Py.None); ! params = (parser.numArg() >= 2) ? parser.arg(1) : params; ! bindings = (parser.numArg() >= 3) ? parser.arg(2) : bindings; ! maxrows = (parser.numArg() >= 4) ? parser.arg(3) : maxrows; ! cursor.execute(sql, params, bindings, maxrows); return Py.None; --- 822,849 ---- PyCursor cursor = (PyCursor)__self__; + PyArgParser parser = new PyArgParser(args, keywords); + String sql = parser.arg(0).__str__().toString(); + PyObject params = parser.kw("params", Py.None); + PyObject bindings = parser.kw("bindings", Py.None); + PyObject maxrows = parser.kw("maxrows", Py.None); + params = (parser.numArg() >= 2) ? parser.arg(1) : params; + bindings = (parser.numArg() >= 3) ? parser.arg(2) : bindings; + maxrows = (parser.numArg() >= 4) ? parser.arg(3) : maxrows; + switch (index) { case 5 : ! cursor.execute(sql, params, bindings, maxrows); ! return Py.None; ! case 8 : ! cursor.callproc(sql, params, bindings, maxrows); ! ! return Py.None; ! ! case 9 : ! cursor.executemany(sql, params, bindings, maxrows); return Py.None; |
From: brian z. <bz...@us...> - 2001-12-07 02:56:42
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv16639/ziclix/python/sql Modified Files: DataHandler.java PyCursor.java PyExtendedCursor.java zxJDBC.java Added Files: DBApiType.java Log Message: added .getMetaDataName() --- NEW FILE: DBApiType.java --- /* * Jython Database Specification API 2.0 * * $Id: DBApiType.java,v 1.1 2001/12/07 02:56:39 bzimmer Exp $ * * Copyright (c) 2001 brian zimmer <bz...@zi...> * */ package com.ziclix.python.sql; import org.python.core.*; /** * This class wraps the types from java.sql.Type in order for * PyCursor to differentiate between a regular PyInteger and * a SQL datatype value. * * @author brian zimmer * @date $today.date$ * @author last modified by $Author: bzimmer $ * @date last modified on $Date: 2001/12/07 02:56:39 $ * @version $Revision: 1.1 $ * @copyright 2001 brian zimmer */ public final class DBApiType extends PyInteger { /** Field __class__ */ public static PyClass __class__; /** * Constructor DBApiType * * @param int type * */ public DBApiType(int type) { super(type); } /** * Constructor DBApiType * * @param Integer type * */ public DBApiType(Integer type) { super(type.intValue()); } /** * Method getPyClass * * @return PyClass * */ protected PyClass getPyClass() { return __class__; } } Index: DataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/DataHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataHandler.java 2001/12/04 03:09:44 1.2 --- DataHandler.java 2001/12/07 02:56:39 1.3 *************** *** 41,44 **** --- 41,58 ---- /** + * Some database vendors are case sensitive on calls to DatabaseMetaData, + * most notably Oracle. This callback allows a DataHandler to affect the + * name. + * + * @param PyString name + * + * @return String + * + */ + public String getMetaDataName(PyObject name) { + return ((name == Py.None) ? null : name.__str__().toString()); + } + + /** * Returns the row id of the last executed statement. * *************** *** 259,263 **** default : Integer[] vals = { new Integer(col), new Integer(type) }; ! String msg = zxJDBC.getString("errorSettingIndex", vals); throw new SQLException(msg); --- 273,277 ---- default : Integer[] vals = { new Integer(col), new Integer(type) }; ! String msg = zxJDBC.getString("errorGettingIndex", vals); throw new SQLException(msg); Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyCursor.java 2001/12/04 03:09:44 1.4 --- PyCursor.java 2001/12/07 02:56:39 1.5 *************** *** 410,428 **** // [3, 4] or (3, 4) - Integer binding = null; - PyObject param = Py.None, index = Py.None; - for (int i = 0; i < params.__len__(); i++) { ! binding = null; ! index = Py.newInteger(i); ! param = params.__getitem__(i); if (bindings != Py.None) { ! PyObject tmp = bindings.__finditem__(index); ! if (tmp != null) { try { ! binding = (Integer)tmp.__tojava__(Integer.class); ! } catch (ClassCastException e) { throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("bindingValue")); } --- 410,428 ---- // [3, 4] or (3, 4) for (int i = 0; i < params.__len__(); i++) { ! PyObject index = Py.newInteger(i); ! PyObject param = params.__getitem__(i); if (bindings != Py.None) { ! PyObject binding = bindings.__finditem__(index); ! if (binding != null) { try { ! int bindingValue = binding.__int__().getValue(); ! ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param, bindingValue); ! ! continue; ! } catch (PyException e) { throw zxJDBC.makeException(zxJDBC.ProgrammingError, zxJDBC.getString("bindingValue")); } *************** *** 430,438 **** } ! if (binding == null) { ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param); ! } else { ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param, binding.intValue()); ! } } } --- 430,434 ---- } ! this.datahandler.setJDBCObject(this.sqlStatement, i + 1, param); } } Index: PyExtendedCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyExtendedCursor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyExtendedCursor.java 2001/11/27 10:48:04 1.2 --- PyExtendedCursor.java 2001/12/07 02:56:39 1.3 *************** *** 126,150 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String t = (table == Py.None) ? null : (String)table.__tojava__(String.class); ! String[] y = null; ! if (type != Py.None) { ! if (isSeq(type)) { ! int len = type.__len__(); ! y = new String[len]; ! for (int i = 0; i < len; i++) { ! y[i] = (String)type.__getitem__(i).__tojava__(String.class); ! } ! } else { ! y = new String[1]; ! y[0] = (String)type.__tojava__(String.class); } } create(this.connection.getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { --- 126,150 ---- clear(); ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String t = datahandler.getMetaDataName(table); ! String[] y = null; ! if (type != Py.None) { ! if (isSeq(type)) { ! int len = type.__len__(); ! y = new String[len]; ! for (int i = 0; i < len; i++) { ! y[i] = datahandler.getMetaDataName(type.__getitem__(i)); } + } else { + y = new String[1]; + y[0] = datahandler.getMetaDataName(type); } + } + try { create(this.connection.getMetaData().getTables(q, o, t, y)); } catch (SQLException e) { *************** *** 165,174 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String t = (table == Py.None) ? null : (String)table.__tojava__(String.class); ! String c = (column == Py.None) ? null : (String)column.__tojava__(String.class); create(this.connection.getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { --- 165,174 ---- clear(); ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String t = datahandler.getMetaDataName(table); ! String c = datahandler.getMetaDataName(column); + try { create(this.connection.getMetaData().getColumns(q, o, t, c)); } catch (SQLException e) { *************** *** 188,196 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String p = (procedure == Py.None) ? null : (String)procedure.__tojava__(String.class); create(this.connection.getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { --- 188,196 ---- clear(); ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String p = datahandler.getMetaDataName(procedure); + try { create(this.connection.getMetaData().getProcedures(q, o, p)); } catch (SQLException e) { *************** *** 211,220 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String p = (procedure == Py.None) ? null : (String)procedure.__tojava__(String.class); ! String c = (column == Py.None) ? null : (String)column.__tojava__(String.class); create(this.connection.getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { --- 211,220 ---- clear(); ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String p = datahandler.getMetaDataName(procedure); ! String c = datahandler.getMetaDataName(column); + try { create(this.connection.getMetaData().getProcedureColumns(q, o, p, c)); } catch (SQLException e) { *************** *** 235,243 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String t = (table == Py.None) ? null : (String)table.__tojava__(String.class); create(this.connection.getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { --- 235,243 ---- clear(); ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String t = datahandler.getMetaDataName(table); + try { create(this.connection.getMetaData().getPrimaryKeys(q, o, t)); } catch (SQLException e) { *************** *** 265,276 **** clear(); ! try { ! String pq = (primaryQualifier == Py.None) ? null : (String)primaryQualifier.__tojava__(String.class); ! String po = (primaryOwner == Py.None) ? null : (String)primaryOwner.__tojava__(String.class); ! String pt = (primaryTable == Py.None) ? null : (String)primaryTable.__tojava__(String.class); ! String fq = (foreignQualifier == Py.None) ? null : (String)foreignQualifier.__tojava__(String.class); ! String fo = (foreignOwner == Py.None) ? null : (String)foreignOwner.__tojava__(String.class); ! String ft = (foreignTable == Py.None) ? null : (String)foreignTable.__tojava__(String.class); create(this.connection.getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { --- 265,276 ---- clear(); ! String pq = datahandler.getMetaDataName(primaryQualifier); ! String po = datahandler.getMetaDataName(primaryOwner); ! String pt = datahandler.getMetaDataName(primaryTable); ! String fq = datahandler.getMetaDataName(foreignQualifier); ! String fo = datahandler.getMetaDataName(foreignOwner); ! String ft = datahandler.getMetaDataName(foreignTable); + try { create(this.connection.getMetaData().getCrossReference(pq, po, pt, fq, fo, ft)); } catch (SQLException e) { *************** *** 293,305 **** clear(); ! try { ! String q = (qualifier == Py.None) ? null : (String)qualifier.__tojava__(String.class); ! String o = (owner == Py.None) ? null : (String)owner.__tojava__(String.class); ! String t = (table == Py.None) ? null : (String)table.__tojava__(String.class); ! boolean u = (unique == Py.None) ? false : ((Boolean)unique.__tojava__(Boolean.class)).booleanValue(); ! boolean a = (accuracy == Py.None) ? false : ((Boolean)accuracy.__tojava__(Boolean.class)).booleanValue(); ! Set skipCols = new HashSet(); ! skipCols.add(new Integer(12)); create(this.connection.getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { --- 293,307 ---- clear(); ! Set skipCols = new HashSet(); ! skipCols.add(new Integer(12)); ! ! String q = datahandler.getMetaDataName(qualifier); ! String o = datahandler.getMetaDataName(owner); ! String t = datahandler.getMetaDataName(table); ! boolean u = unique.__nonzero__(); ! boolean a = accuracy.__nonzero__(); ! ! try { create(this.connection.getMetaData().getIndexInfo(q, o, t, u, a), skipCols); } catch (SQLException e) { *************** *** 317,343 **** clear(); ! try { ! Set skipCols = new HashSet(); ! skipCols.add(new Integer(16)); ! skipCols.add(new Integer(17)); ! create(this.connection.getMetaData().getTypeInfo(), skipCols); ! // if the type is non-null, then trim the result list down to that type only ! // if(type != null &&!Py.None.equals(type)) { ! // for(int i = 0; i < ((PyObject) this.results.get(0)).__len__(); i++) { ! // PyObject row = ((PyObject) this.results.get(0)).__getitem__(new PyInteger(i)); ! // PyObject sqlType = row.__getitem__(new PyInteger(1)); ! // if(type.equals(sqlType)) { ! // this.results.remove(0); ! // this.results.add(0, new PyList(new PyObject[] { ! // row ! // })); ! // } ! // } ! // } } catch (SQLException e) { throw zxJDBC.newError(e); } } --- 319,346 ---- clear(); ! Set skipCols = new HashSet(); ! skipCols.add(new Integer(16)); ! skipCols.add(new Integer(17)); ! try { ! create(this.connection.getMetaData().getTypeInfo(), skipCols); } catch (SQLException e) { throw zxJDBC.newError(e); } + + // if the type is non-null, then trim the result list down to that type only + // if(type != null &&!Py.None.equals(type)) { + // for(int i = 0; i < ((PyObject) this.results.get(0)).__len__(); i++) { + // PyObject row = ((PyObject) this.results.get(0)).__getitem__(new PyInteger(i)); + // PyObject sqlType = row.__getitem__(new PyInteger(1)); + // if(type.equals(sqlType)) { + // this.results.remove(0); + // this.results.add(0, new PyList(new PyObject[] { + // row + // })); + // } + // } + // } } Index: zxJDBC.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/zxJDBC.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** zxJDBC.java 2001/11/27 10:48:04 1.2 --- zxJDBC.java 2001/12/07 02:56:39 1.3 *************** *** 142,151 **** for (int i = 0; i < fields.length; i++) { Field f = fields[i]; ! dict.__setitem__(Py.newString(f.getName()), new PyInteger(f.getInt(c))); ! sqltype.__setitem__(new PyInteger(f.getInt(c)), Py.newString(f.getName())); } ! } catch (Exception e) { ! throw newError(e); } --- 142,153 ---- for (int i = 0; i < fields.length; i++) { Field f = fields[i]; + PyString name = Py.newString(f.getName()); + PyObject value = new DBApiType(f.getInt(c)); ! dict.__setitem__(name, value); ! sqltype.__setitem__(value, name); } ! } catch (Throwable t) { ! throw newError(t); } *************** *** 299,305 **** public static PyException newError(Throwable e) { ! try { ! return (PyException)e; ! } catch (ClassCastException ex) {} try { --- 301,307 ---- public static PyException newError(Throwable e) { ! if (e instanceof PyException) { ! throw (PyException)e; ! } try { |
From: brian z. <bz...@us...> - 2001-12-07 02:56:42
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/resource In directory usw-pr-cvs1:/tmp/cvs-serv16639/ziclix/python/sql/resource Modified Files: zxJDBCMessages.properties Log Message: added .getMetaDataName() Index: zxJDBCMessages.properties =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/resource/zxJDBCMessages.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** zxJDBCMessages.properties 2001/11/20 04:55:18 1.1 --- zxJDBCMessages.properties 2001/12/07 02:56:39 1.2 *************** *** 88,90 **** --- 88,92 ---- invalidTableName=invalid table name [None] errorSettingIndex=error setting index [{0}], type [{1}] + errorGettingIndex=error getting index [{0}], type [{1}] + maybeCallproc=use .callproc() for stored procedures |
From: brian z. <bz...@us...> - 2001-12-07 02:56:42
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/handler In directory usw-pr-cvs1:/tmp/cvs-serv16639/ziclix/python/sql/handler Modified Files: OracleDataHandler.java Log Message: added .getMetaDataName() Index: OracleDataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/handler/OracleDataHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OracleDataHandler.java 2001/11/20 04:55:18 1.1 --- OracleDataHandler.java 2001/12/07 02:56:39 1.2 *************** *** 34,37 **** --- 34,52 ---- /** + * Method getMetaDataName + * + * @param PyString name + * + * @return String + * + */ + public String getMetaDataName(PyObject name) { + + String metaName = super.getMetaDataName(name); + + return (metaName == null) ? null : metaName.toUpperCase(); + } + + /** * Provide functionality for Oracle specific types, such as ROWID. */ |
From: Finn B. <bc...@us...> - 2001-12-06 19:30:35
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv31186 Modified Files: Py.java Log Message: runMain(): Don't rethrow SystemException. Just do a return. Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** Py.java 2001/11/28 19:25:33 2.59 --- Py.java 2001/12/06 19:30:32 2.60 *************** *** 827,830 **** --- 827,832 ---- } catch (PyException e) { Py.getSystemState().callExitFunc(); + if (Py.matchException(e, Py.SystemExit)) + return; throw e; } |
From: Finn B. <bc...@us...> - 2001-12-06 19:29:33
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv30630 Modified Files: PyServlet.java Log Message: Enable caching of the .jar files in WEB-INF/lib. Index: PyServlet.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/PyServlet.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyServlet.java 2001/11/27 19:07:22 1.13 --- PyServlet.java 2001/12/06 19:29:30 1.14 *************** *** 96,101 **** File.separator + "classes"); ! sys.add_extdir(rootPath + "WEB-INF" + ! File.separator + "lib"); } --- 96,100 ---- File.separator + "classes"); ! sys.add_extdir(rootPath + "WEB-INF" + File.separator + "lib", true); } |