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: Finn B. <bc...@us...> - 2002-04-05 15:47:11
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv1917 Modified Files: build.xml Log Message: Added "dist" and "copy-dist" targets. Index: build.xml =================================================================== RCS file: /cvsroot/jython/jython/build.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** build.xml 11 Jan 2002 21:34:18 -0000 1.26 --- build.xml 5 Apr 2002 15:47:07 -0000 1.27 *************** *** 31,37 **** <property name="sourceDir" value="${basedir}" /> <property name="outputDir" value="${basedir}/build" /> ! <property name="apidocDir" value="${basedir}/Doc/javadoc" /> <property name="debug" value="off" /> <property name="optimize" value="on" /> <available property="java2collection.present" --- 31,39 ---- <property name="sourceDir" value="${basedir}" /> <property name="outputDir" value="${basedir}/build" /> ! <property name="distDir" value="${basedir}/dist" /> ! <property name="apidocDir" value="${distDir}/Doc/javadoc" /> <property name="debug" value="off" /> <property name="optimize" value="on" /> + <property name="release" value="22a0" /> <available property="java2collection.present" *************** *** 223,241 **** </target> ! <target name="doc" depends="init"> ! <delete> ! <fileset dir="Doc" includes="*.html" /> ! </delete> <!-- Create .html files in Doc --> ! <execon executable="${python.home}/python" dir="Doc"> <arg line="${ht2html.dir}/ht2html.py"/> <arg line="-s JPyLocalGenerator"/> ! <fileset dir="Doc"> <include name="*.ht" /> </fileset> </execon> </target> ! <target name="javadoc" depends="compile"> <delete dir="${apidocDir}" /> <mkdir dir="${apidocDir}" /> --- 225,252 ---- </target> ! <target name="dist-prepare" depends="init"> ! <mkdir dir="${distDir}" /> ! </target> ! ! <target name="doc" depends="dist-prepare"> ! <delete dir="${distDir}/Doc" /> ! <mkdir dir="${distDir}/Doc" /> ! <copy todir="${distDir}/Doc"> ! <fileset dir="Doc" includes="*.ht, **/*.gif" /> ! </copy> <!-- Create .html files in Doc --> ! <execon executable="${python.home}/python" dir="${distDir}/Doc"> <arg line="${ht2html.dir}/ht2html.py"/> <arg line="-s JPyLocalGenerator"/> ! <fileset dir="${distDir}/Doc"> <include name="*.ht" /> </fileset> </execon> + <delete> + <fileset dir="${distDir}/Doc" includes="*.ht" /> + </delete> </target> ! <target name="javadoc" depends="compile, dist-prepare"> <delete dir="${apidocDir}" /> <mkdir dir="${apidocDir}" /> *************** *** 252,259 **** </target> ! <target name="installXML" depends="init"> ! <!-- Set the configuration variables python.home and PyXmlHome ! in your ant.properties file --> ! <copy todir="${sourceDir}/Lib/xml"> <fileset dir="${python.home}/Lib/xml" includes="__init__.py"/> <fileset dir="${PyXmlHome}/xml" includes=" --- 263,432 ---- </target> ! <target name="copy-dist" depends="dist-prepare,compile"> ! <!-- Misc files --> ! <copy todir="${distDir}"> ! <fileset dir="${sourceDir}" includes=" ! ACKNOWLEDGMENTS, ! NEWS, ! LICENSE.txt, ! README.txt, ! registry, ! jython.jar, ! build.xml, ! "/> ! </copy> ! ! <!-- Sources --> ! <copy todir="${distDir}"> ! <fileset dir="${sourceDir}" includes=" ! org/**/*.java, org/**/Makefile, ! com/**/*.java, com/**/Makefile, ! Lib/jxxload_help/*.java, Lib/jxxload_help/Makefile, ! org/**/ucnhash.dat, ! com/**/*.properties," ! excludes="org/python/parser/python.java"/> ! </copy> ! ! <!-- Jythonc --> ! <copy todir="${distDir}"> ! <fileset dir="${sourceDir}" includes="Tools/**/*.py"/> ! </copy> ! ! <copy todir="${distDir}/Lib"> ! <!-- Copy the CPython standard library files --> ! <fileset dir="${python.home}/Lib" includes=" ! ../LICENSE, ! __future__.py, ! BaseHTTPServer.py, ! CGIHTTPServer.py, ! ConfigParser.py, ! Cookie.py, ! MimeWriter.py, ! Queue.py, ! SimpleHTTPServer.py, ! SocketServer.py, ! StringIO.py, ! UserDict.py, ! UserList.py, ! anydbm.py, ! base64.py, ! bdb.py, ! binhex.py, ! bisect.py, ! calendar.py, ! cgi.py, ! cmd.py, ! cmp.py, ! cmpcache.py, ! colorsys.py, ! commands.py, ! compileall.py, ! copy.py, ! copy_reg.py, ! difflib.py, ! dircache.py, ! dircmp.py, ! doctest.py, ! dospath.py, ! dumbdbm.py, ! exceptions.py, ! fileinput.py, ! fnmatch.py, ! formatter.py, ! fpformat.py, ! ftplib.py, ! getopt.py, ! glob.py, ! gopherlib.py, ! gzip.py, ! htmlentitydefs.py, ! htmllib.py, ! httplib.py, ! imaplib.py, ! imghdr.py, ! keyword.py, ! linecache.py, ! macpath.py, ! macurl2path.py, ! mailbox.py, ! mailcap.py, ! mhlib.py, ! mimetools.py, ! mimetypes.py, ! mimify.py, ! multifile.py, ! mutex.py, ! nntplib.py, ! ntpath.py, ! nturl2path.py, ! pdb.py, ! pickle.py, ! pipes.py, ! popen2.py, ! poplib.py, ! posixfile.py, ! posixpath.py, ! pprint.py, ! profile.py, ! pyclbr.py, ! quopri.py, ! random.py, ! reconvert.py, ! repr.py, ! rfc822.py, ! sched.py, ! sgmllib.py, ! site.py, ! shelve.py, ! shutil.py, ! smtplib.py, ! sndhdr.py, ! stat.py, ! symbol.py, ! telnetlib.py, ! tempfile.py, ! token.py, ! tokenize.py, ! traceback.py, ! tzparse.py, ! unittest.py, ! urllib.py, ! urlparse.py, ! user.py, ! weakref.py, ! whichdb.py, ! whrandom.py, ! xdrlib.py, ! xmllib.py, ! zipfile.py ! pstats.py, ! code.py, ! codecs.py, ! sre*.py, ! threading.py, ! atexit.py, ! UserString.py, ! warnings.py, ! encodings/*.py, ! test/pystone.py, ! "/> ! ! <!-- The jython .py modules --> ! <fileset dir="${sourceDir}/Lib" includes="*.py, pawt/*.py"/> ! </copy> ! ! <!-- The demo files --> ! <copy todir="${distDir}/Demo"> ! <fileset dir="${sourceDir}/Demo" ! includes="**/*.java, **/*.html, **/*.py, ! **/*.txt, **/Makefile, **/*.xml, ! **/jreload/example.jar, ! **/jreload/_xample/Version.class" ! excludes="**/jpywork/**"/> ! </copy> ! ! ! <!-- The xml files --> ! <copy todir="${distDir}/Lib/xml"> <fileset dir="${python.home}/Lib/xml" includes="__init__.py"/> <fileset dir="${PyXmlHome}/xml" includes=" *************** *** 274,277 **** --- 447,462 ---- </target> + <target name="dist" depends="copy-dist, doc, javadoc"> + <!-- + Some windows systems need the ${line.separator} or will report a + "Failed to load Main-Class manifest attribute" error + --> + <tar tarfile="jython-${release}.tar" + basedir="${distDir}" + excludes="jython.jar, cachedir"/> + <gzip zipfile="jython-${release}.tgz" src="jython-${release}.tar" /> + </target> + + <target name="all" depends="init,clean,prepare,parser,compile,jar"/> </project> |
From: brian z. <bz...@us...> - 2002-03-29 04:01:06
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv26901/com/ziclix/python/sql Modified Files: PyCursor.java Log Message: cursor is now file-like Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PyCursor.java 26 Mar 2002 02:46:36 -0000 1.18 --- PyCursor.java 29 Mar 2002 04:01:03 -0000 1.19 *************** *** 27,39 **** public class PyCursor extends PyObject implements ClassDictInit { - /** Field closed */ - private boolean closed; - /** Field fetch */ protected Fetch fetch; /** Field arraysize */ protected int arraysize; /** Field warnings */ protected PyObject warnings; --- 27,42 ---- public class PyCursor extends PyObject implements ClassDictInit { /** Field fetch */ protected Fetch fetch; + /** Field closed */ + private boolean closed; + /** Field arraysize */ protected int arraysize; + /** Field softspace */ + protected int softspace; + /** Field warnings */ protected PyObject warnings; *************** *** 83,86 **** --- 86,90 ---- this.arraysize = 1; + this.softspace = 0; this.closed = false; this.connection = connection; *************** *** 112,116 **** static { ! PyObject[] m = new PyObject[8]; m[0] = new PyString("close"); --- 116,120 ---- static { ! PyObject[] m = new PyObject[9]; m[0] = new PyString("close"); *************** *** 122,127 **** m[6] = new PyString("callproc"); m[7] = new PyString("next"); __methods__ = new PyList(m); ! m = new PyObject[8]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); --- 126,132 ---- m[6] = new PyString("callproc"); m[7] = new PyString("next"); + m[8] = new PyString("write"); __methods__ = new PyList(m); ! m = new PyObject[9]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); *************** *** 132,135 **** --- 137,141 ---- m[6] = new PyString("lastrowid"); m[7] = new PyString("updatecount"); + m[8] = new PyString("softspace"); __members__ = new PyList(m); } *************** *** 153,157 **** if ("arraysize".equals(name)) { ! arraysize = value.__int__().getValue(); } else if ("datahandler".equals(name)) { this.datahandler = (DataHandler)value.__tojava__(DataHandler.class); --- 159,165 ---- if ("arraysize".equals(name)) { ! this.arraysize = value.__int__().getValue(); ! } else if ("softspace".equals(name)) { ! this.softspace = value.__int__().getValue(); } else if ("datahandler".equals(name)) { this.datahandler = (DataHandler)value.__tojava__(DataHandler.class); *************** *** 171,174 **** --- 179,184 ---- if ("arraysize".equals(name)) { return Py.newInteger(arraysize); + } else if ("softspace".equals(name)) { + return Py.newInteger(softspace); } else if ("__methods__".equals(name)) { return __methods__; *************** *** 219,222 **** --- 229,233 ---- dict.__setitem__("executemany", new CursorFunc("executemany", 9, 1, 3, "execute sql with the parameter list")); dict.__setitem__("scroll", new CursorFunc("scroll", 10, 1, 2, "scroll the cursor in the result set to a new position according to mode")); + dict.__setitem__("write", new CursorFunc("write", 11, 1, "execute the sql written to this file-like object")); // hide from python *************** *** 430,435 **** * Return values are not defined. */ ! public void executemany(String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { ! execute(sqlString, params, bindings, maxRows); } --- 441,446 ---- * Return values are not defined. */ ! public void executemany(PyObject sql, PyObject params, PyObject bindings, PyObject maxRows) { ! execute(sql, params, bindings, maxRows); } *************** *** 459,468 **** * Return values are not defined. * ! * @param sqlString sql string * @param params params for a prepared statement * @param bindings dictionary of (param index : SQLType binding) * @param maxRows integer value of max rows */ ! public void execute(final String sqlString, PyObject params, PyObject bindings, PyObject maxRows) { clear(); --- 470,489 ---- * Return values are not defined. * ! * @param sql sql string * @param params params for a prepared statement * @param bindings dictionary of (param index : SQLType binding) * @param maxRows integer value of max rows */ ! public void execute(final PyObject sql, PyObject params, PyObject bindings, PyObject maxRows) { ! ! if (sql == Py.None) { ! return; ! } ! ! final String sqlString = sql.__str__().toString(); ! ! if (sqlString.trim().length() == 0) { ! return; ! } clear(); *************** *** 918,922 **** case 5 : ! cursor.execute(arg.__str__().toString(), Py.None, Py.None, Py.None); return Py.None; --- 939,943 ---- case 5 : ! cursor.execute(arg, Py.None, Py.None, Py.None); return Py.None; *************** *** 932,936 **** case 9 : ! cursor.executemany(arg.__str__().toString(), Py.None, Py.None, Py.None); return Py.None; --- 953,957 ---- case 9 : ! cursor.executemany(arg, Py.None, Py.None, Py.None); return Py.None; *************** *** 941,944 **** --- 962,970 ---- return Py.None; + case 11 : + cursor.execute(arg, Py.None, Py.None, Py.None); + + return Py.None; + default : throw argCountError(1); *************** *** 962,966 **** case 5 : ! cursor.execute(arga.__str__().toString(), argb, Py.None, Py.None); return Py.None; --- 988,992 ---- case 5 : ! cursor.execute(arga, argb, Py.None, Py.None); return Py.None; *************** *** 975,979 **** case 9 : ! cursor.executemany(arga.__str__().toString(), argb, Py.None, Py.None); return Py.None; --- 1001,1005 ---- case 9 : ! cursor.executemany(arga, argb, Py.None, Py.None); return Py.None; *************** *** 1006,1010 **** case 5 : ! cursor.execute(arga.__str__().toString(), argb, argc, Py.None); return Py.None; --- 1032,1036 ---- case 5 : ! cursor.execute(arga, argb, argc, Py.None); return Py.None; *************** *** 1016,1020 **** case 9 : ! cursor.executemany(arga.__str__().toString(), argb, argc, Py.None); return Py.None; --- 1042,1046 ---- case 9 : ! cursor.executemany(arga, argb, argc, Py.None); return Py.None; *************** *** 1050,1054 **** case 5 : ! cursor.execute(sql.__str__().toString(), params, bindings, maxrows); return Py.None; --- 1076,1080 ---- case 5 : ! cursor.execute(sql, params, bindings, maxrows); return Py.None; *************** *** 1060,1064 **** case 9 : ! cursor.executemany(sql.__str__().toString(), params, bindings, maxrows); return Py.None; --- 1086,1090 ---- case 9 : ! cursor.executemany(sql, params, bindings, maxrows); return Py.None; |
From: brian z. <bz...@us...> - 2002-03-29 04:01:06
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv26901/Lib/test/zxjdbc Modified Files: zxtest.py Log Message: cursor is now file-like Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** zxtest.py 26 Mar 2002 02:46:36 -0000 1.11 --- zxtest.py 29 Mar 2002 04:01:03 -0000 1.12 *************** *** 102,105 **** --- 102,132 ---- c.close() + def testNoneQuery(self): + """testing that executing None doesn't fail""" + c = self.cursor() + try: + c.execute(None) + finally: + c.close() + + def testFileLikeCursor(self): + """testing the cursor as a file-like object""" + c = self.cursor() + try: + print >> c, "insert into zxtesting (id, name, state) values (100, 'test100', 'wa')" + print >> c, "insert into zxtesting (id, name, state) values (101, 'test101', 'co')" + print >> c, "insert into zxtesting (id, name, state) values (102, 'test102', 'or')" + self.db.commit() + finally: + c.close() + + c = self.cursor() + try: + c.execute("select * from zxtesting where id in (100, 101, 102)") + f = c.fetchall() + self.assertEquals(3, len(f)) + finally: + c.close() + def testIteration(self): """testing the iteration protocol""" |
From: brian z. <bz...@us...> - 2002-03-29 04:01:06
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db In directory usw-pr-cvs1:/tmp/cvs-serv26901/com/ziclix/python/sql/pipe/db Modified Files: DBSource.java DBSink.java Log Message: cursor is now file-like Index: DBSource.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db/DBSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DBSource.java 20 Nov 2001 04:55:18 -0000 1.1 --- DBSource.java 29 Mar 2002 04:01:03 -0000 1.2 *************** *** 88,92 **** return this.cursor.fetchone(); } else { ! this.cursor.execute(this.sql, this.params, Py.None, Py.None); PyObject description = this.cursor.__findattr__("description"); --- 88,92 ---- return this.cursor.fetchone(); } else { ! this.cursor.execute(Py.newString(this.sql), this.params, Py.None, Py.None); PyObject description = this.cursor.__findattr__("description"); Index: DBSink.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/pipe/db/DBSink.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DBSink.java 11 Jan 2002 21:46:01 -0000 1.2 --- DBSink.java 29 Mar 2002 04:01:03 -0000 1.3 *************** *** 25,29 **** /** Field sql */ ! protected String sql; /** Field exclude */ --- 25,29 ---- /** Field sql */ ! protected PyObject sql; /** Field exclude */ *************** *** 56,60 **** super(connection, dataHandler, tableName); ! this.sql = null; this.rows = new PyList(); this.bindings = bindings; --- 56,60 ---- super(connection, dataHandler, tableName); ! this.sql = Py.None; this.rows = new PyList(); this.bindings = bindings; *************** *** 154,158 **** } ! this.sql = sb.toString(); } --- 154,158 ---- } ! this.sql = Py.newString(sb.toString()); } *************** *** 162,166 **** public void row(PyObject row) { ! if (this.sql != null) { if (this.batchsize <= 0) { --- 162,166 ---- public void row(PyObject row) { ! if (this.sql != Py.None) { if (this.batchsize <= 0) { |
From: brian z. <bz...@us...> - 2002-03-26 02:47:03
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/connect In directory usw-pr-cvs1:/tmp/cvs-serv29905/com/ziclix/python/sql/connect Modified Files: Connectx.java Log Message: check for pooled datasources first Index: Connectx.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/connect/Connectx.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Connectx.java 11 Jan 2002 21:46:01 -0000 1.2 --- Connectx.java 26 Mar 2002 02:47:01 -0000 1.3 *************** *** 101,108 **** try { ! if (datasource instanceof DataSource) { ! c = ((DataSource)datasource).getConnection(); ! } else if (datasource instanceof ConnectionPoolDataSource) { c = ((ConnectionPoolDataSource)datasource).getPooledConnection().getConnection(); } } catch (SQLException e) { --- 101,108 ---- try { ! if (datasource instanceof ConnectionPoolDataSource) { c = ((ConnectionPoolDataSource)datasource).getPooledConnection().getConnection(); + } else if (datasource instanceof DataSource) { + c = ((DataSource)datasource).getConnection(); } } catch (SQLException e) { |
From: brian z. <bz...@us...> - 2002-03-26 02:46:39
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv29788/com/ziclix/python/sql Modified Files: PyConnection.java PyCursor.java Log Message: close open cursors when the connection closes Index: PyConnection.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyConnection.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyConnection.java 11 Jan 2002 21:46:01 -0000 1.5 --- PyConnection.java 26 Mar 2002 02:46:36 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- import java.sql.*; + import java.util.*; import org.python.core.*; *************** *** 28,31 **** --- 29,35 ---- protected boolean supportsTransactions; + /** Field cursors */ + protected List cursors; + /** Field __class__ */ public static PyClass __class__; *************** *** 56,60 **** m[4] = new PyString("nativesql"); __methods__ = new PyList(m); ! m = new PyObject[6]; m[0] = new PyString("autocommit"); m[1] = new PyString("dbname"); --- 60,64 ---- m[4] = new PyString("nativesql"); __methods__ = new PyList(m); ! m = new PyObject[7]; m[0] = new PyString("autocommit"); m[1] = new PyString("dbname"); *************** *** 63,66 **** --- 67,71 ---- m[4] = new PyString("url"); m[5] = new PyString("__connection__"); + m[6] = new PyString("__cursors__"); __members__ = new PyList(m); } *************** *** 72,75 **** --- 77,81 ---- this.connection = connection; + this.cursors = new LinkedList(); this.supportsTransactions = this.connection.getMetaData().supportsTransactions(); *************** *** 116,119 **** --- 122,126 ---- dict.__setitem__("connection", null); dict.__setitem__("classDictInit", null); + dict.__setitem__("cursors", null); } *************** *** 181,184 **** --- 188,193 ---- } else if ("__connection__".equals(name)) { return Py.java2py(this.connection); + } else if ("__cursors__".equals(name)) { + return Py.java2py(Collections.unmodifiableList(this.cursors)); } else if ("__methods__".equals(name)) { return __methods__; *************** *** 200,206 **** public void close() { ! try { ! // close the cursors too? this.connection.close(); } catch (SQLException e) { --- 209,223 ---- public void close() { ! synchronized (this.cursors) { ! // close the cursors ! for (int i = this.cursors.size() - 1; i >= 0; i--) { ! ((PyCursor)this.cursors.get(i)).close(); ! } ! ! this.cursors.clear(); ! } ! ! try { this.connection.close(); } catch (SQLException e) { *************** *** 286,290 **** */ public PyCursor cursor() { ! return new PyExtendedCursor(this); } --- 303,307 ---- */ public PyCursor cursor() { ! return cursor(false); } *************** *** 298,302 **** */ public PyCursor cursor(boolean dynamicFetch) { ! return new PyExtendedCursor(this, dynamicFetch); } } --- 315,334 ---- */ public PyCursor cursor(boolean dynamicFetch) { ! ! PyCursor cursor = new PyExtendedCursor(this, dynamicFetch); ! ! cursors.add(cursor); ! ! return cursor; ! } ! ! /** ! * Unregister an open PyCursor. ! * ! * @param PyCursor cursor ! * ! */ ! void unregister(PyCursor cursor) { ! this.cursors.remove(cursor); } } Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PyCursor.java 14 Jan 2002 04:28:41 -0000 1.17 --- PyCursor.java 26 Mar 2002 02:46:36 -0000 1.18 *************** *** 266,269 **** --- 266,270 ---- this.clear(); + this.connection.unregister(this); this.closed = true; |
From: brian z. <bz...@us...> - 2002-03-26 02:46:39
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv29788/Lib/test/zxjdbc Modified Files: zxtest.py Log Message: close open cursors when the connection closes Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** zxtest.py 14 Jan 2002 04:28:41 -0000 1.10 --- zxtest.py 26 Mar 2002 02:46:36 -0000 1.11 *************** *** 43,46 **** --- 43,47 ---- try: c.execute("drop table zxtesting") + self.db.commit() except: self.db.rollback() *************** *** 48,51 **** --- 49,53 ---- try: c.execute("create table zxtesting (id int not null, name varchar(32), state varchar(32), primary key (id))") + self.db.commit() c.execute("insert into zxtesting (id, name, state) values (1, 'test0', 'il')") c.execute("insert into zxtesting (id, name, state) values (2, 'test1', 'wi')") *************** *** 132,135 **** --- 134,149 ---- c.close() self.assertRaises(zxJDBC.InternalError, c.execute, ("select * from zxtesting",)) + + def testClosingConnectionWithOpenCursors(self): + """testing that a closed connection closes any open cursors""" + c = self.cursor() + d = self.cursor() + e = self.cursor() + self.db.close() + # open a new connection so the tearDown can run + self.db = self.connect() + self.assertRaises(zxJDBC.InternalError, c.execute, ("select * from zxtesting",)) + self.assertRaises(zxJDBC.InternalError, d.execute, ("select * from zxtesting",)) + self.assertRaises(zxJDBC.InternalError, e.execute, ("select * from zxtesting",)) def testNativeSQL(self): |
From: Finn B. <bc...@us...> - 2002-03-11 14:04:37
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv30952 Added Files: test358.py Log Message: Test for "[ 515894 ] Behaviour of "+=" stm. is different from" --- NEW FILE: test358.py --- """ [ 515894 ] Behaviour of "+=" stm. is different from """ import support a = [1, 2, 3] a += "456" if a != [1, 2, 3, '4', '5', '6']: raise support.TestError('list += not working') |
From: Finn B. <bc...@us...> - 2002-03-11 13:58:46
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv29123 Modified Files: PyLong.java Log Message: Fix for "[ 517237 ] Binary ops with int and long fail". Index: PyLong.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyLong.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** PyLong.java 13 Jan 2002 18:20:31 -0000 2.14 --- PyLong.java 11 Mar 2002 13:58:42 -0000 2.15 *************** *** 355,358 **** --- 355,364 ---- } + public PyObject __rand__(PyObject left) { + if (!canCoerce(left)) + return null; + return new PyLong(coerce(left).and(value)); + } + public PyObject __xor__(PyObject right) { if (!canCoerce(right)) *************** *** 361,368 **** --- 367,386 ---- } + public PyObject __rxor__(PyObject left) { + if (!canCoerce(left)) + return null; + return new PyLong(coerce(left).xor(value)); + } + public PyObject __or__(PyObject right) { if (!canCoerce(right)) return null; return new PyLong(value.or(coerce(right))); + } + + public PyObject __ror__(PyObject left) { + if (!canCoerce(left)) + return null; + return new PyLong(coerce(left).or(value)); } |
From: Finn B. <bc...@us...> - 2002-03-11 13:53:54
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv27881 Added Files: test357.py Log Message: Test for "[ 517237 ] Binary ops with int and long fail" --- NEW FILE: test357.py --- """ [ 517237 ] Binary ops with int and long fail """ import support 5&7L 5|7L 5^7L |
From: Finn B. <bc...@us...> - 2002-03-11 13:39:43
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv23805 Modified Files: struct.java Log Message: Fix for "[ 522828 ] struct.pack('>NNs', v) fails for NN > 20" Index: struct.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/struct.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -d -r2.5 -r2.6 *** struct.java 2 Feb 2001 11:29:42 -0000 2.5 --- struct.java 11 Mar 2002 13:39:40 -0000 2.6 *************** *** 406,410 **** private void ensureCapacity(int l) { if (pos + l >= data.length) { ! char[] b = new char[data.length * 2]; System.arraycopy(data, 0, b, 0, pos); data = b; --- 406,410 ---- private void ensureCapacity(int l) { if (pos + l >= data.length) { ! char[] b = new char[(pos + l) * 2]; System.arraycopy(data, 0, b, 0, pos); data = b; |
From: Finn B. <bc...@us...> - 2002-03-11 13:22:41
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv18797 Modified Files: __builtin__.java Log Message: Fix for "[ 522558 ] list() is broken" Index: __builtin__.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/__builtin__.java,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** __builtin__.java 6 Jan 2002 21:19:13 -0000 2.42 --- __builtin__.java 11 Mar 2002 13:22:30 -0000 2.43 *************** *** 475,479 **** public static PyList list(PyObject o) { if (o instanceof PyList) ! return (PyList)o; if (o instanceof PyTuple) { // always make a copy, otherwise the list will share the --- 475,479 ---- public static PyList list(PyObject o) { if (o instanceof PyList) ! return (PyList) o.__getslice__(Py.None, Py.None, Py.One); if (o instanceof PyTuple) { // always make a copy, otherwise the list will share the |
From: Finn B. <bc...@us...> - 2002-03-11 12:54:32
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv7285 Added Files: test355.py Log Message: Test for [ 522558 ] list() is broken. Samuele have already been added a better testcase to the CPython testsuite, but for consistency I'll add it here as well. --- NEW FILE: test355.py --- """ [ 522558 ] list() is broken """ import support L = [1, 2, 3] L2 = list(L) L2.insert(0, 4) if L == L2: raise support.TestError('list() should create a copy') |
From: Finn B. <bc...@us...> - 2002-03-11 12:35:05
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv5559 Modified Files: cStringIO.java Log Message: Fix for "[ 522423 ] cStringIO has no reset() method" Index: cStringIO.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/cStringIO.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** cStringIO.java 6 Jan 2002 21:19:13 -0000 1.13 --- cStringIO.java 11 Mar 2002 12:35:02 -0000 1.14 *************** *** 120,123 **** --- 120,129 ---- } + /** + * Reset the file position to the beginning of the file. + */ + public void reset() { + pos = 0; + } /** |
From: Finn B. <bc...@us...> - 2002-03-11 12:33:30
|
Update of /cvsroot/jython/bugtests In directory usw-pr-cvs1:/tmp/cvs-serv5199 Added Files: test354.py Log Message: Test for [ 522423 ] cStringIO has no reset() method --- NEW FILE: test354.py --- """ [ 522423 ] cStringIO has no reset() method """ import support import cStringIO s = cStringIO.StringIO("abcdef") s.read(3) s.reset() support.compare(s.read(3), "abc") support.compare(s.read(3), "def") |
From: brian z. <bz...@us...> - 2002-01-26 15:45:03
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5053 Modified Files: isql.py Log Message: quit from within the interpreter no longer dumps a stacktrace; use connects with the same dbexts class Index: isql.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/isql.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** isql.py 2002/01/09 18:18:55 1.3 --- isql.py 2002/01/26 15:44:58 1.4 *************** *** 65,69 **** def do_use(self, arg): """\nUse a new database connection.\n""" ! self.db = dbexts.dbexts(arg.strip()) return None --- 65,70 ---- def do_use(self, arg): """\nUse a new database connection.\n""" ! # this allows custom dbexts ! self.db = self.db.__class__(arg.strip()) return None *************** *** 143,147 **** --- 144,150 ---- except: self.sqlbuffer = [] + print print sys.exc_info()[1] + print return None *************** *** 152,155 **** --- 155,170 ---- raise IsqlExit() + def cmdloop(self, intro=None): + while 1: + try: + cmd.Cmd.cmdloop(self, intro) + except IsqlExit, e: + break + except Exception, e: + print + print e + print + intro = None + if __name__ == '__main__': import getopt *************** *** 171,182 **** isql = IsqlCmd(dbname) ! while 1: ! try: ! isql.cmdloop(intro) ! except IsqlExit, e: ! break ! except Exception, e: ! print ! print e ! print ! intro = "" --- 186,188 ---- isql = IsqlCmd(dbname) ! isql.cmdloop() |
From: Finn B. <bc...@us...> - 2002-01-16 17:40:16
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv21440 Modified Files: build.xml Log Message: Copy the javadoc .css file to the net. Index: build.xml =================================================================== RCS file: /cvsroot/jython/htdocs/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 2001/12/03 21:39:58 1.4 --- build.xml 2002/01/16 17:40:13 1.5 *************** *** 79,83 **** </copy> <copy todir="docs/javadoc"> ! <fileset dir="${jython.home}/Doc/javadoc" includes="**/*.html"/> </copy> <execon executable="${python.home}/python" dir="docs"> --- 79,84 ---- </copy> <copy todir="docs/javadoc"> ! <fileset dir="${jython.home}/Doc/javadoc" ! includes="**/*.html,*.css"/> </copy> <execon executable="${python.home}/python" dir="docs"> |
From: Finn B. <bc...@us...> - 2002-01-16 17:39:41
|
Update of /cvsroot/jython/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv21305 Modified Files: index.ht Log Message: Added the "Jython for Java Programmers" book. Index: index.ht =================================================================== RCS file: /cvsroot/jython/htdocs/index.ht,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** index.ht 2001/12/31 13:42:05 1.27 --- index.ht 2002/01/16 17:39:38 1.28 *************** *** 43,46 **** --- 43,51 ---- <dl> + <p><dt><b>15-jan-2002</b> + <dd>The very first Jython book called + <i><a href="http://www.newriders.com/books/title.cfm?isbn=0735711119"> + Jython for Java Programmers</a></i> was written by Robert W. Bill + and published by <a href="http://www.newriders.com/">New Riders</a>. <p><dt><b>8-apr-2001</b> |
From: brian z. <bz...@us...> - 2002-01-14 04:28:44
|
Update of /cvsroot/jython/jython/Lib/test/zxjdbc In directory usw-pr-cvs1:/tmp/cvs-serv20896/Lib/test/zxjdbc Modified Files: zxtest.py Log Message: added .scroll() and .rownumber Index: zxtest.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/zxjdbc/zxtest.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** zxtest.py 2002/01/10 03:42:32 1.9 --- zxtest.py 2002/01/14 04:28:41 1.10 *************** *** 191,195 **** c.bestrow(None, None, "zxtesting") f = c.fetchall() ! if f is not None: # we might as well see that it worked self.assertEquals(1, len(f)) finally: --- 191,195 ---- c.bestrow(None, None, "zxtesting") f = c.fetchall() ! if f: # we might as well see that it worked self.assertEquals(1, len(f)) finally: *************** *** 210,213 **** --- 210,310 ---- c.close() + def _test_scrolling(self, dynamic=0): + c = self.cursor(dynamic) + try: + # set everything up + c.execute("select id, name, state from zxtesting order by id") + self.assertEquals(1, c.fetchone()[0]) + self.assertEquals(2, c.fetchone()[0]) + self.assertEquals(3, c.fetchone()[0]) + # move back two and fetch the row again + c.scroll(-2) + self.assertEquals(2, c.fetchone()[0]) + # move to the fifth row (0-based indexing) + c.scroll(4, "absolute") + self.assertEquals(5, c.fetchone()[0]) + # move back to the start + c.scroll(-5) + self.assertEquals(1, c.fetchone()[0]) + # move to the end + c.scroll(6, "absolute") + self.assertEquals(7, c.fetchone()[0]) + # make sure we get an IndexError + self.assertRaises(IndexError, c.scroll, 1, "relative") + self.assertRaises(IndexError, c.scroll, -1, "absolute") + self.assertRaises(zxJDBC.ProgrammingError, c.scroll, 1, "somethingelsealltogether") + finally: + c.close() + + def testDynamicCursorScrolling(self): + """testing the ability to scroll a dynamic cursor""" + self._test_scrolling(1) + + def testStaticCursorScrolling(self): + """testing the ability to scroll a static cursor""" + self._test_scrolling(0) + + def _test_rownumber(self, dynamic=0): + c = self.cursor(dynamic) + try: + if not dynamic: + # a dynamic cursor doesn't know if any rows really exist + # maybe the 'possibility' of rows should change .rownumber to 0? + c.execute("select * from zxtesting where 1=0") + self.assertEquals(None, c.rownumber) + c.execute("select * from zxtesting") + self.assertEquals(0, c.rownumber) + c.next() + self.assertEquals(1, c.rownumber) + c.next() + self.assertEquals(2, c.rownumber) + c.scroll(-1) + self.assertEquals(1, c.rownumber) + c.scroll(2, "absolute") + self.assertEquals(2, c.rownumber) + c.scroll(6, "absolute") + self.assertEquals(6, c.rownumber) + finally: + c.close() + self.assertEquals(None, c.rownumber) + + def testStaticRownumber(self): + """testing a static cursor's rownumber""" + self._test_rownumber(0) + + def testDynamicRownumber(self): + """testing a dynamic cursor's rownumber""" + self._test_rownumber(1) + + def _test_rowcount(self, dynamic=0): + c = self.cursor(dynamic) + try: + c.execute("select * from zxtesting") + c.next() + c.next() + c.next() + if dynamic: + # dynamic cursors only know about the number of rows encountered + self.assertEquals(3, c.rowcount) + else: + self.assertEquals(7, c.rowcount) + c.scroll(-1) + # make sure they don't change just because we scrolled backwards + if dynamic: + # dynamic cursors only know about the number of rows encountered + self.assertEquals(3, c.rowcount) + else: + self.assertEquals(7, c.rowcount) + finally: + c.close() + + def testStaticRowcount(self): + """testing a static cursor's rowcount""" + self._test_rowcount(0) + + def testDynamicRowcount(self): + """testing a dynamic cursor's rowcount""" + self._test_rowcount(1) + def testTableTypeInfo(self): """testing cursor.gettabletypeinfo()""" *************** *** 595,611 **** 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() --- 692,702 ---- c.close() ! def _test_fetching(self, dynamic=0): ! c = self.cursor(dynamic) try: + # make sure None is result from an empty result set + c.execute("select * from zxtesting where 1<0") + self.assertEquals(None, c.fetchall()) + # test some arraysize features c.execute("select * from zxtesting") f = c.fetchmany() *************** *** 619,622 **** --- 710,730 ---- f = c.fetchmany() assert len(f) == 7, "expecting [7] rows, got [%d]" % (len(f)) + finally: + c.close() + + def testStaticFetching(self): + """testing various static fetch methods""" + self._test_fetching(0) + + def testDynamicFetching(self): + """testing various dynamic fetch methods""" + self._test_fetching(1) + + def testFetchingBeforeExecute(self): + """testing fetch methods before execution""" + c = self.cursor() + try: + f = c.fetchall() + assert f is None, "expecting no results since no execute*() has been called" finally: c.close() |
From: brian z. <bz...@us...> - 2002-01-14 04:28:44
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql/connect In directory usw-pr-cvs1:/tmp/cvs-serv20896/com/ziclix/python/sql/connect Modified Files: Connect.java Log Message: added .scroll() and .rownumber Index: Connect.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/connect/Connect.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Connect.java 2002/01/11 21:46:01 1.2 --- Connect.java 2002/01/14 04:28:41 1.3 *************** *** 60,69 **** if (arg == Py.NoConversion) { Properties props = new Properties(); ! String url = null, user = null, password = null, driver = null; ! ! url = (String)parser.arg(0).__tojava__(String.class); ! user = (String)parser.arg(1).__tojava__(String.class); ! password = (String)parser.arg(2).__tojava__(String.class); ! driver = (String)parser.arg(3).__tojava__(String.class); if (url == null) { --- 60,67 ---- if (arg == Py.NoConversion) { Properties props = new Properties(); ! String url = (String)parser.arg(0).__tojava__(String.class); ! String user = (String)parser.arg(1).__tojava__(String.class); ! String password = (String)parser.arg(2).__tojava__(String.class); ! String driver = (String)parser.arg(3).__tojava__(String.class); if (url == null) { |
From: brian z. <bz...@us...> - 2002-01-14 04:28:44
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv20896/com/ziclix/python/sql Modified Files: Fetch.java PyCursor.java Log Message: added .scroll() and .rownumber Index: Fetch.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/Fetch.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Fetch.java 2002/01/11 21:46:01 1.6 --- Fetch.java 2002/01/14 04:28:41 1.7 *************** *** 39,45 **** abstract public class Fetch { ! /** Field rowcount */ protected int rowcount; /** Field cursor */ protected PyCursor cursor; --- 39,54 ---- abstract public class Fetch { ! /** ! * The total number of rows in the result set. ! * ! * Note: since JDBC provides no means to get this information without iterating ! * the entire result set, only those fetches which build the result statically ! * will have an accurate row count. ! */ protected int rowcount; + /** The current row of the cursor (-1 if off either end). */ + protected int rownumber; + /** Field cursor */ protected PyCursor cursor; *************** *** 57,60 **** --- 66,70 ---- this.rowcount = -1; + this.rownumber = -1; this.cursor = cursor; this.description = Py.None; *************** *** 171,174 **** --- 181,208 ---- /** + * Scroll the cursor in the result set to a new position according + * to mode. + * + * If mode is 'relative' (default), value is taken as offset to + * the current position in the result set, if set to 'absolute', + * value states an absolute target position. + * + * An IndexError should be raised in case a scroll operation would + * leave the result set. In this case, the cursor position is left + * undefined (ideal would be to not move the cursor at all). + * + * Note: This method should use native scrollable cursors, if + * available, or revert to an emulation for forward-only + * scrollable cursors. The method may raise NotSupportedErrors to + * signal that a specific operation is not supported by the + * database (e.g. backward scrolling). + * + * @param int value + * @param String mode + * + */ + public abstract void scroll(int value, String mode); + + /** * Cleanup any resources. */ *************** *** 385,404 **** return tuple; } - - /** - * Return the total row count. Note: since JDBC provides no means to get this information - * without iterating the entire result set, only those fetches which build the result - * statically will have an accurate row count. - */ - public int getRowCount() { - return this.rowcount; - } - - /** - * Return the description of the result. - */ - public PyObject getDescription() { - return this.description; - } } --- 419,422 ---- *************** *** 412,418 **** class StaticFetch extends Fetch { - /** Field counter */ - protected int counter; - /** Field results */ protected List results; --- 430,433 ---- *************** *** 431,435 **** this.results = new LinkedList(); this.descriptions = new LinkedList(); - this.counter = -1; } --- 446,449 ---- *************** *** 458,469 **** PyObject result = this.createResults(resultSet, skipCols, metadata); ! this.results.add(result); ! this.descriptions.add(metadata); ! // we want the rowcount of the first result set ! this.rowcount = ((PyObject)this.results.get(0)).__len__(); ! // we want the description of the first result set ! this.description = ((PyObject)this.descriptions.get(0)); } } catch (PyException e) { --- 472,488 ---- PyObject result = this.createResults(resultSet, skipCols, metadata); ! if (result.__len__() > 0) { ! this.results.add(result); ! this.descriptions.add(metadata); ! // we want the rowcount of the first result set ! this.rowcount = ((PyObject)this.results.get(0)).__len__(); ! // we want the description of the first result set ! this.description = ((PyObject)this.descriptions.get(0)); ! ! // set the current rownumber ! this.rownumber = 0; ! } } } catch (PyException e) { *************** *** 491,503 **** PyObject result = this.createResults(callableStatement, procedure, params); ! if (result != Py.None) { this.results.add(result); this.descriptions.add(this.createDescription(procedure)); // we want the description of the first result set this.description = ((PyObject)this.descriptions.get(0)); ! // we want the rowcount of the first result set ! this.rowcount = ((PyObject)this.results.get(0)).__len__(); } } catch (PyException e) { --- 510,525 ---- PyObject result = this.createResults(callableStatement, procedure, params); ! if ((result != Py.None) && (result.__len__() > 0)) { this.results.add(result); this.descriptions.add(this.createDescription(procedure)); + // we want the rowcount of the first result set + this.rowcount = ((PyObject)this.results.get(0)).__len__(); + // we want the description of the first result set this.description = ((PyObject)this.descriptions.get(0)); ! // set the current rownumber ! this.rownumber = 0; } } catch (PyException e) { *************** *** 557,565 **** } ! if ((counter + 1) < this.rowcount) { ! int start = counter + 1; ! ! counter += size; ! res = current.__getslice__(Py.newInteger(start), Py.newInteger(counter + 1), Py.newInteger(1)); } --- 579,585 ---- } ! if (this.rownumber < this.rowcount) { ! res = current.__getslice__(Py.newInteger(this.rownumber), Py.newInteger(this.rownumber + size), Py.newInteger(1)); ! this.rownumber += size; } *************** *** 568,571 **** --- 588,617 ---- /** + * Method scroll + * + * @param int value + * @param String mode 'relative' or 'absolute' + * + */ + public void scroll(int value, String mode) { + + int pos; + + if ("relative".equals(mode)) { + pos = this.rownumber + value; + } else if ("absolute".equals(mode)) { + pos = value; + } else { + throw zxJDBC.makeException(zxJDBC.ProgrammingError, "invalid cursor scroll mode [" + mode + "]"); + } + + if ((pos >= 0) && (pos < this.rowcount)) { + this.rownumber = pos; + } else { + throw zxJDBC.makeException(Py.IndexError, "cursor index [" + pos + "] out of range"); + } + } + + /** * Move the result pointer to the next set if available. * *************** *** 583,587 **** this.description = (PyObject)this.descriptions.get(0); this.rowcount = next.__len__(); ! this.counter = -1; } --- 629,633 ---- this.description = (PyObject)this.descriptions.get(0); this.rowcount = next.__len__(); ! this.rownumber = 0; } *************** *** 594,598 **** public void close() throws SQLException { ! this.counter = -1; this.results.clear(); --- 640,644 ---- public void close() throws SQLException { ! this.rownumber = -1; this.results.clear(); *************** *** 654,657 **** --- 700,709 ---- this.resultSet = resultSet; this.skipCols = skipCols; + + // it would be more compliant if we knew the resultSet actually + // contained some rows, but since we don't make a stab at it so + // everything else looks better + this.rowcount = 0; + this.rownumber = 0; } } catch (PyException e) { *************** *** 671,675 **** */ public void add(CallableStatement callableStatement, Procedure procedure, PyObject params) { ! return; } --- 723,727 ---- */ public void add(CallableStatement callableStatement, Procedure procedure, PyObject params) { ! throw zxJDBC.makeException(zxJDBC.NotSupportedError, "dynamic cursor does not support callproc(); use static cursors instead"); } *************** *** 710,715 **** res.append(tuple); ! // since the rowcount == -1 initially, bump it to one the first time through ! this.rowcount = (this.rowcount == -1) ? 1 : this.rowcount + 1; } } catch (PyException e) { --- 762,768 ---- res.append(tuple); ! this.rowcount++; ! ! this.rownumber = this.resultSet.getRow(); } } catch (PyException e) { *************** *** 730,733 **** --- 783,831 ---- /** + * Method scroll + * + * @param int value + * @param String mode + * + */ + public void scroll(int value, String mode) { + + try { + int type = this.resultSet.getType(); + + if ((type == ResultSet.TYPE_SCROLL_SENSITIVE) || (type == ResultSet.TYPE_SCROLL_INSENSITIVE)) { + if ("relative".equals(mode)) { + if (value < 0) { + value = Math.abs(this.rownumber + value); + } else if (value > 0) { + value = this.rownumber + value + 1; + } + } else if ("absolute".equals(mode)) { + if (value < 0) { + throw zxJDBC.makeException(Py.IndexError, "cursor index [" + value + "] out of range"); + } + } else { + throw zxJDBC.makeException(zxJDBC.ProgrammingError, "invalid cursor scroll mode [" + mode + "]"); + } + + if (value == 0) { + this.resultSet.beforeFirst(); + } else { + if (!this.resultSet.absolute(value)) { + throw zxJDBC.makeException(Py.IndexError, "cursor index [" + value + "] out of range"); + } + } + + // since .rownumber is the *next* row, then the JDBC value suits us fine + this.rownumber = this.resultSet.getRow(); + } else { + throw zxJDBC.makeException(zxJDBC.NotSupportedError, "dynamic result set does not support scrolling"); + } + } catch (SQLException e) { + throw zxJDBC.makeException(e); + } + } + + /** * Close the underlying ResultSet. */ *************** *** 738,744 **** } ! this.resultSet.close(); ! this.resultSet = null; } } --- 836,846 ---- } ! this.rownumber = -1; ! try { ! this.resultSet.close(); ! } finally { ! this.resultSet = null; ! } } } Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyCursor.java 2002/01/11 21:46:01 1.16 --- PyCursor.java 2002/01/14 04:28:41 1.17 *************** *** 123,134 **** m[7] = new PyString("next"); __methods__ = new PyList(m); ! m = new PyObject[7]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); ! m[2] = new PyString("description"); ! m[3] = new PyString("datahandler"); ! m[4] = new PyString("warnings"); ! m[5] = new PyString("lastrowid"); ! m[6] = new PyString("updatecount"); __members__ = new PyList(m); } --- 123,135 ---- m[7] = new PyString("next"); __methods__ = new PyList(m); ! m = new PyObject[8]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); ! m[2] = new PyString("rownumber"); ! m[3] = new PyString("description"); ! m[4] = new PyString("datahandler"); ! m[5] = new PyString("warnings"); ! m[6] = new PyString("lastrowid"); ! m[7] = new PyString("updatecount"); __members__ = new PyList(m); } *************** *** 175,181 **** return __members__; } else if ("description".equals(name)) { ! return this.fetch.getDescription(); } else if ("rowcount".equals(name)) { ! return Py.newInteger(this.fetch.getRowCount()); } else if ("warnings".equals(name)) { return warnings; --- 176,186 ---- return __members__; } else if ("description".equals(name)) { ! return this.fetch.description; } else if ("rowcount".equals(name)) { ! return Py.newInteger(this.fetch.rowcount); ! } else if ("rownumber".equals(name)) { ! int rn = this.fetch.rownumber; ! ! return (rn < 0) ? Py.None : Py.newInteger(rn); } else if ("warnings".equals(name)) { return warnings; *************** *** 213,216 **** --- 218,222 ---- dict.__setitem__("callproc", new CursorFunc("callproc", 8, 1, 4, "executes a stored procedure")); dict.__setitem__("executemany", new CursorFunc("executemany", 9, 1, 3, "execute sql with the parameter list")); + dict.__setitem__("scroll", new CursorFunc("scroll", 10, 1, 2, "scroll the cursor in the result set to a new position according to mode")); // hide from python *************** *** 663,666 **** --- 669,698 ---- /** + * Scroll the cursor in the result set to a new position according + * to mode. + * + * If mode is 'relative' (default), value is taken as offset to + * the current position in the result set, if set to 'absolute', + * value states an absolute target position. + * + * An IndexError should be raised in case a scroll operation would + * leave the result set. In this case, the cursor position is left + * undefined (ideal would be to not move the cursor at all). + * + * Note: This method should use native scrollable cursors, if + * available, or revert to an emulation for forward-only + * scrollable cursors. The method may raise NotSupportedErrors to + * signal that a specific operation is not supported by the + * database (e.g. backward scrolling). + * + * @param int value + * @param String mode + * + */ + public void scroll(int value, String mode) { + this.fetch.scroll(value, mode); + } + + /** * Adds a warning to the tuple and will follow the chain as necessary. */ *************** *** 903,906 **** --- 935,943 ---- return Py.None; + case 10 : + cursor.scroll(arg.__int__().getValue(), "relative"); + + return Py.None; + default : throw argCountError(1); *************** *** 938,941 **** --- 975,983 ---- case 9 : cursor.executemany(arga.__str__().toString(), argb, Py.None, Py.None); + + return Py.None; + + case 10 : + cursor.scroll(arga.__int__().getValue(), argb.toString()); return Py.None; |
From: Finn B. <bc...@us...> - 2002-01-13 19:32:31
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv1207 Modified Files: NEWS Log Message: Added news about pep-238. Index: NEWS =================================================================== RCS file: /cvsroot/jython/jython/NEWS,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** NEWS 2002/01/13 18:09:44 2.45 --- NEWS 2002/01/13 19:32:27 2.46 *************** *** 5,8 **** --- 5,9 ---- New features - Iterators (pep-234). + - Changing the Division Operator (pep-238) Bug fixes. |
From: Finn B. <bc...@us...> - 2002-01-13 19:24:46
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31656 Removed Files: imaplib.py random.py zipfile.py Log Message: Removed modified CPython-2.1 version. The modifications have been added to CPython-2.2 so our copy is not needed anymore. --- imaplib.py DELETED --- --- random.py DELETED --- --- zipfile.py DELETED --- |
From: Finn B. <bc...@us...> - 2002-01-13 19:14:29
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30057 Modified Files: javaos.py Log Message: Avoid a warnall warning. Index: javaos.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/javaos.py,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** javaos.py 2002/01/10 22:43:46 2.14 --- javaos.py 2002/01/13 19:14:26 2.15 *************** *** 21,24 **** --- 21,26 ---- """ + from __future__ import division + __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", "defpath", "name"] |
From: Finn B. <bc...@us...> - 2002-01-13 18:34:48
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv22193 Modified Files: PythonVisitor.py Log Message: Support truediv and floordiv (pep-238). Index: PythonVisitor.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonVisitor.py,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** PythonVisitor.py 2001/12/07 13:01:24 2.10 --- PythonVisitor.py 2002/01/13 18:34:46 2.11 *************** *** 391,395 **** def sub_2op(self, node): return self.binop(node, 'sub') def mul_2op(self, node): return self.binop(node, 'mul') ! def div_2op(self, node): return self.binop(node, 'div') def mod_2op(self, node): return self.binop(node, 'mod') def and_2op(self, node): return self.binop(node, 'and') --- 391,400 ---- def sub_2op(self, node): return self.binop(node, 'sub') def mul_2op(self, node): return self.binop(node, 'mul') ! def div_2op(self, node): ! if self.walker.getFutures().areDivisionOn(): ! return self.binop(node, 'truediv') ! else: ! return self.binop(node, 'div') ! def floordiv_2op(self, node): return self.binop(node, 'floordiv') def mod_2op(self, node): return self.binop(node, 'mod') def and_2op(self, node): return self.binop(node, 'and') *************** *** 420,424 **** def aug_minus(self, node): return self.aug_binaryop(node, "__isub__") def aug_multiply(self, node): return self.aug_binaryop(node, "__imul__") ! def aug_divide(self, node): return self.aug_binaryop(node, "__idiv__") def aug_modulo(self, node): return self.aug_binaryop(node, "__imod__") def aug_and(self, node): return self.aug_binaryop(node, "__iand__") --- 425,435 ---- def aug_minus(self, node): return self.aug_binaryop(node, "__isub__") def aug_multiply(self, node): return self.aug_binaryop(node, "__imul__") ! def aug_divide(self, node): ! if self.walker.getFutures().areDivisionOn(): ! return self.aug_binaryop(node, "__itruediv__") ! else: ! return self.aug_binaryop(node, "__idiv__") ! def aug_floordivide(self, node): ! return self.aug_binaryop(node, "__ifloordiv__") def aug_modulo(self, node): return self.aug_binaryop(node, "__imod__") def aug_and(self, node): return self.aug_binaryop(node, "__iand__") |