From: brian z. <bz...@us...> - 2002-05-09 21:44:32
|
Update of /cvsroot/jython/jython/com/ziclix/python/sql In directory usw-pr-cvs1:/tmp/cvs-serv6142/ziclix/python/sql Modified Files: Fetch.java PyCursor.java PyStatement.java Log Message: api cleanup Index: Fetch.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/Fetch.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Fetch.java 9 May 2002 01:03:37 -0000 1.9 --- Fetch.java 9 May 2002 21:44:28 -0000 1.10 *************** *** 94,98 **** /** ! * The number of rows in the current result set. */ public int getRowCount() { --- 94,98 ---- /** ! * The number of rows in the current result set. */ public int getRowCount() { Index: PyCursor.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyCursor.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PyCursor.java 9 May 2002 01:03:37 -0000 1.25 --- PyCursor.java 9 May 2002 21:44:29 -0000 1.26 *************** *** 391,398 **** if (sql instanceof PyStatement) { stmt = (PyStatement)sql; - - if (stmt.closed) { - throw zxJDBC.makeException(zxJDBC.ProgrammingError, "statement is closed"); - } } else { Statement sqlStatement = null; --- 391,394 ---- *************** *** 482,490 **** } ! this.statement = new PyStatement(stmt, procedure, params); ! // prepare the statement ! this.statement.prepare(this, params, callableBindings); ! this.execute(); } else { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString("noStoredProc")); --- 478,484 ---- } ! this.statement = new PyStatement(stmt, procedure); ! this.execute(params, callableBindings); } else { throw zxJDBC.makeException(zxJDBC.NotSupportedError, zxJDBC.getString("noStoredProc")); *************** *** 577,591 **** PyObject param = params.__getitem__(i); ! this.statement.prepare(this, param, bindings); ! this.execute(); } } else { ! this.statement.prepare(this, params, bindings); ! this.execute(); } } else { // execute the sql string straight up ! execute(); } } --- 571,583 ---- PyObject param = params.__getitem__(i); ! this.execute(param, bindings); } } else { ! this.execute(params, bindings); } } else { // execute the sql string straight up ! this.execute(Py.None, Py.None); } } *************** *** 609,613 **** * as updating the lastrowid and updatecount occur as well. */ ! protected void execute() { try { --- 601,605 ---- * as updating the lastrowid and updatecount occur as well. */ ! protected void execute(PyObject params, PyObject bindings) { try { *************** *** 617,621 **** // this performs the SQL execution and fetch per the Statement type ! this.statement.execute(this); this.lastrowid = this.datahandler.getRowId(stmt); --- 609,613 ---- // this performs the SQL execution and fetch per the Statement type ! this.statement.execute(this, params, bindings); this.lastrowid = this.datahandler.getRowId(stmt); Index: PyStatement.java =================================================================== RCS file: /cvsroot/jython/jython/com/ziclix/python/sql/PyStatement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyStatement.java 21 Apr 2002 14:22:15 -0000 1.2 --- PyStatement.java 9 May 2002 21:44:29 -0000 1.3 *************** *** 36,52 **** /** Field style */ ! protected int style; /** Field sql */ ! protected Object sql; /** Field closed */ ! boolean closed; ! ! /** Field params */ ! protected PyObject params; /** Field statement */ ! protected Statement statement; /** --- 36,49 ---- /** Field style */ ! private int style; /** Field sql */ ! private Object sql; /** Field closed */ ! private boolean closed; /** Field statement */ ! Statement statement; /** *************** *** 71,82 **** * @param statement * @param procedure - * @param params * */ ! public PyStatement(Statement statement, Procedure procedure, PyObject params) { ! this(statement, procedure, STATEMENT_CALLABLE); - - this.params = params; } --- 68,75 ---- * @param statement * @param procedure * */ ! public PyStatement(Statement statement, Procedure procedure) { this(statement, procedure, STATEMENT_CALLABLE); } *************** *** 195,200 **** dict.__setitem__("classDictInit", null); dict.__setitem__("statement", null); - dict.__setitem__("params", null); dict.__setitem__("execute", null); dict.__setitem__("STATEMENT_STATIC", null); dict.__setitem__("STATEMENT_PREPARED", null); --- 188,193 ---- dict.__setitem__("classDictInit", null); dict.__setitem__("statement", null); dict.__setitem__("execute", null); + dict.__setitem__("prepare", null); dict.__setitem__("STATEMENT_STATIC", null); dict.__setitem__("STATEMENT_PREPARED", null); *************** *** 213,227 **** * Method execute * ! * @param cursor ! * * * @throws SQLException */ ! void execute(PyCursor cursor) throws SQLException { ! if (closed) { throw zxJDBC.makeException(zxJDBC.ProgrammingError, "statement is closed"); } Fetch fetch = cursor.fetch; --- 206,224 ---- * Method execute * ! * @param PyCursor cursor ! * @param PyObject params ! * @param PyObject bindings * * @throws SQLException + * */ ! public void execute(PyCursor cursor, PyObject params, PyObject bindings) throws SQLException { ! if (this.closed) { throw zxJDBC.makeException(zxJDBC.ProgrammingError, "statement is closed"); } + this.prepare(cursor, params, bindings); + Fetch fetch = cursor.fetch; *************** *** 267,271 **** * */ ! void prepare(PyCursor cursor, PyObject params, PyObject bindings) throws SQLException { if ((params == Py.None) || (this.style == STATEMENT_STATIC)) { --- 264,268 ---- * */ ! private void prepare(PyCursor cursor, PyObject params, PyObject bindings) throws SQLException { if ((params == Py.None) || (this.style == STATEMENT_STATIC)) { |