From: brian z. <bz...@us...> - 2001-12-04 03:09:47
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv28814/ziclix/python/sql Modified Files: DataHandler.java FilterDataHandler.java PyCursor.java Log Message: added .rowid to PyCursor and .getRowId(Statement) to DataHandlers Index: DataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/DataHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataHandler.java 2001/11/20 04:55:18 1.1 --- DataHandler.java 2001/12/04 03:09:44 1.2 *************** *** 41,53 **** /** ! * A callback prior to each execution of the statement. If the statement is a PreparedStatement, all the ! * parameters will have been set. */ ! public void preExecute(Statement stmt) throws SQLException {} /** * A callback after successfully executing the statement. */ ! public void postExecute(Statement stmt) throws SQLException {} /** --- 41,71 ---- /** ! * Returns the row id of the last executed statement. ! * ! * @param Statement stmt ! * ! * @return PyObject ! * ! * @throws SQLException ! * */ ! public PyObject getRowId(Statement stmt) throws SQLException { ! return Py.None; ! } /** + * A callback prior to each execution of the statement. If the statement is + * a PreparedStatement, all the parameters will have been set. + */ + public void preExecute(Statement stmt) throws SQLException { + return; + } + + /** * A callback after successfully executing the statement. */ ! public void postExecute(Statement stmt) throws SQLException { ! return; ! } /** *************** *** 67,71 **** * Any .execute() which uses prepared statements will receive a callback for deciding * how to map the PyObject to the appropriate JDBC type. The <i>type</i> is the JDBC ! * as obtained from <i>java.sql.Types</i>. * * @param stmt the current PreparedStatement --- 85,89 ---- * Any .execute() which uses prepared statements will receive a callback for deciding * how to map the PyObject to the appropriate JDBC type. The <i>type</i> is the JDBC ! * type as obtained from <i>java.sql.Types</i>. * * @param stmt the current PreparedStatement Index: FilterDataHandler.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/FilterDataHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FilterDataHandler.java 2001/11/20 04:55:18 1.1 --- FilterDataHandler.java 2001/12/04 03:09:44 1.2 *************** *** 39,42 **** --- 39,56 ---- /** + * Returns the row id of the last executed statement. + * + * @param Statement stmt + * + * @return PyObject + * + * @throws SQLException + * + */ + public PyObject getRowId(Statement stmt) throws SQLException { + return this.delegate.getRowId(stmt); + } + + /** * Method preExecute * Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyCursor.java 2001/11/27 10:48:04 1.3 --- PyCursor.java 2001/12/04 03:09:44 1.4 *************** *** 36,39 **** --- 36,42 ---- protected PyObject warnings; + /** Field warnings */ + protected PyObject rowid; + /** Field dynamicFetch */ protected boolean dynamicFetch; *************** *** 112,116 **** m[6] = new PyString("callproc"); __methods__ = new PyList(m); ! m = new PyObject[5]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); --- 115,119 ---- m[6] = new PyString("callproc"); __methods__ = new PyList(m); ! m = new PyObject[6]; m[0] = new PyString("arraysize"); m[1] = new PyString("rowcount"); *************** *** 118,121 **** --- 121,125 ---- m[3] = new PyString("datahandler"); m[4] = new PyString("warnings"); + m[5] = new PyString("rowid"); __members__ = new PyList(m); } *************** *** 167,170 **** --- 171,176 ---- } else if ("warnings".equals(name)) { return warnings; + } else if ("rowid".equals(name)) { + return rowid; } else if ("datahandler".equals(name)) { return Py.java2py(this.datahandler); *************** *** 366,370 **** /** ! * Perform the execution of a statement. */ protected void execute(PyObject params, PyObject bindings) throws SQLException { --- 372,382 ---- /** ! * Method execute ! * ! * @param PyObject params ! * @param PyObject bindings ! * ! * @throws SQLException ! * */ protected void execute(PyObject params, PyObject bindings) throws SQLException { *************** *** 428,431 **** --- 440,446 ---- this.datahandler.preExecute(this.sqlStatement); this.sqlStatement.execute(); + + this.rowid = this.datahandler.getRowId(this.sqlStatement); + create(this.sqlStatement.getResultSet()); this.datahandler.postExecute(this.sqlStatement); *************** *** 556,559 **** --- 571,575 ---- this.warnings = Py.None; + this.rowid = Py.None; try { |