Re: streaming result sets: progress - Mailing list pgsql-jdbc
From | Nic Ferrier |
---|---|
Subject | Re: streaming result sets: progress |
Date | |
Msg-id | 87el9ljcv2.fsf@pooh-sticks-bridge.tapsellferrier.co.uk Whole thread Raw |
In response to | Re: streaming result sets: progress (snpe <snpe@snpe.co.yu>) |
Responses |
Re: streaming result sets: progress
|
List | pgsql-jdbc |
Message-ID: <87heehjcv3.fsf@pooh-sticks-bridge.tapsellferrier.co.uk> Lines: 19 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" --text follows this line-- --=-=-= snpe <snpe@snpe.co.yu> writes: > Hello Nic, > Please call patch with ; > diff -Naur olddir newdir > and add in message like attach > This is add PGResultSet > I can't open this patch > Here's a diff based patch. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=nic-diff Content-Description: patch for query stuff. diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/PGConnection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/PGConnection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/PGConnection.java Fri Sep 6 21:23:05 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/PGConnection.java Thu Nov 7 20:38:44 2002 @@ -77,5 +77,15 @@ public PGNotification[] getNotifications(); + + + // Added by Nic. + + /** Create a result set for the specified statement. + * This is the factory method provided by the various + * version specific implementations of the JDBC connection + * classes. + */ + public java.sql.ResultSet createResultSet (java.sql.Statement statement); } diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/PGResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/PGResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/PGResultSet.java Thu Jan 1 00:00:00 1970 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/PGResultSet.java Sat Nov 2 01:18:43 2002 @@ -0,0 +1,16 @@ +package org.postgresql; + + +import java.util.Vector; + + +/** PG base rep of a Res Set. + */ +public interface PGResultSet +{ + + /** The init method is what is used to put the data into a ResultSet. + */ + public void init (Field[] fields, Vector tuples, String status, + int update_count, long insert_oid, boolean binaryCursor); +} diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/core/Encoding.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/core/Encoding.java --- currentcvs/src/interfaces/jdbc/org/postgresql/core/Encoding.java Sat Nov 16 22:24:28 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/core/Encoding.java Fri Nov 15 09:30:46 2002 @@ -8,7 +8,7 @@ /* * Converts to and from the character encoding used by the backend. * - * $Id: Encoding.java,v 1.8 2002/11/14 05:35:45 barry Exp $ + * $Id: Encoding.java,v 1.7.2.1 2002/11/14 05:54:39 barry Exp $ */ public class Encoding diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java --- currentcvs/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java Sat Nov 16 22:24:28 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java Fri Nov 15 09:30:50 2002 @@ -13,17 +13,61 @@ * <p>The lifetime of a QueryExecutor object is from sending the query * until the response has been received from the backend. * - * $Id: QueryExecutor.java,v 1.17 2002/11/14 05:35:45 barry Exp $ + * $Id: QueryExecutor.java,v 1.16.2.1 2002/11/14 05:54:39 barry Exp $ */ public class QueryExecutor { + /** nic version - statically sets up the QE correctly. + */ + public static void execute (String[] p_sqlFrags, + Object[] p_binds, + java.sql.Statement statement, + java.sql.ResultSet rs, + PG_Stream pg_stream, + java.sql.Connection con) + throws SQLException + { + QueryExecutor qe = new QueryExecutor(); + // I think this should be a PGConnection and we should move + // everything we need for that from AbstractJdbc1... into PGConnection. + qe.connection = (org.postgresql.jdbc1.AbstractJdbc1Connection)con; + qe.m_sqlFrags = p_sqlFrags; + qe.m_binds = p_binds; + qe.statement = statement; + // Nic says: connection should wrap pg_stream. + qe.pg_stream = pg_stream; + if (statement != null) + qe.maxRows = statement.getMaxRows(); + else + qe.maxRows = 0; + // The result set. + qe.rs = rs; + qe.execute(); + } + + // This is the result set used to wrap the results. + // The type of this is whatever is passed into the static above. + private java.sql.ResultSet rs; + + // cons for the static above. + private QueryExecutor () + { + } + + + + + /*** pre-nic implementation ***/ + + + /// Nic has removed the final from ALL of these (to facilitate static method). + private String[] m_sqlFrags; + private Object[] m_binds; + private java.sql.Statement statement; + private PG_Stream pg_stream; + private org.postgresql.jdbc1.AbstractJdbc1Connection connection; - private final String[] m_sqlFrags; - private final Object[] m_binds; - private final java.sql.Statement statement; - private final PG_Stream pg_stream; - private final org.postgresql.jdbc1.AbstractJdbc1Connection connection; public QueryExecutor(String[] p_sqlFrags, Object[] p_binds, java.sql.Statement statement, @@ -33,7 +77,7 @@ { this.m_sqlFrags = p_sqlFrags; this.m_binds = p_binds; - this.statement = statement; + this.statement = statement; this.pg_stream = pg_stream; this.connection = (org.postgresql.jdbc1.AbstractJdbc1Connection)connection; @@ -43,6 +87,7 @@ maxRows = 0; } + private Field[] fields = null; private Vector tuples = new Vector(); private boolean binaryCursor = false; @@ -51,8 +96,10 @@ private long insert_oid = 0; private int maxRows; + /* * Execute a query on the backend. + * */ public java.sql.ResultSet execute() throws SQLException { @@ -130,7 +177,12 @@ if ( errorMessage != null ) throw new SQLException( errorMessage.toString() ); - return connection.getResultSet(statement, fields, tuples, status, update_count, insert_oid, binaryCursor); + + // Nic changes. + PGResultSet resSet = ((PGResultSet)rs); + // System.out.println(getClass().getName() + " resSet=" + resSet); + resSet.init(fields, tuples, status, update_count, insert_oid, binaryCursor); + return rs; } } diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java Sat Nov 16 22:24:29 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java Fri Nov 15 09:34:39 2002 @@ -14,7 +14,7 @@ import org.postgresql.util.*; -/* $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java,v 1.132002/11/14 05:35:45 barry Exp $ +/* $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java,v 1.12.2.12002/11/14 05:54:39 barry Exp $ * This class defines methods of the jdbc1 specification. This class is * extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2 * methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection @@ -350,9 +350,10 @@ // Set datestyle and fetch db encoding in a single call, to avoid making // more than one round trip to the backend during connection startup. - java.sql.ResultSet resultSet = - ExecSQL("set datestyle to 'ISO'; select version(), " + encodingQuery + ";"); + java.sql.ResultSet resultSet + = doQuery("set datestyle to 'ISO'; select version(), " + encodingQuery + ";"); + if (! resultSet.next()) { throw new PSQLException("postgresql.con.failed", "failed getting backend encoding"); @@ -373,7 +374,7 @@ if (haveMinimumServerVersion("7.3")) { java.sql.ResultSet acRset = - ExecSQL("set client_encoding = 'UNICODE'; show autocommit"); + doQuery("set client_encoding = 'UNICODE'; show autocommit"); //set encoding to be unicode encoding = Encoding.getEncoding("UNICODE", null); @@ -388,7 +389,7 @@ //to make the setting permanent if (acRset.getString(1).equals("off")) { - ExecSQL("set autocommit = on; commit;"); + doQuery("set autocommit = on; commit;"); } } @@ -409,13 +410,6 @@ return this_driver; } - // These methods used to be in the main Connection implementation. As they - // are common to all implementations (JDBC1 or 2), they are placed here. - // This should make it easy to maintain the two specifications. - - public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, Stringstatus, int updateCount, long insertOID, boolean binaryCursor) throws SQLException; - - public abstract java.sql.ResultSet getResultSet(Statement statement, org.postgresql.Field[] fields, Vector tuples, Stringstatus, int updateCount) throws SQLException; /* * This adds a warning to the warning chain. @@ -445,66 +439,40 @@ //} } - /* - * Send a query to the backend. Returns one of the ResultSet - * objects. - * - * <B>Note:</B> there does not seem to be any method currently - * in existance to return the update count. - * - * @param sql the SQL statement to be executed - * @return a ResultSet holding the results - * @exception SQLException if a database error occurs + /** Simple query execution. */ - public java.sql.ResultSet ExecSQL(String sql) throws SQLException + public java.sql.ResultSet doQuery (String s) throws SQLException { - return ExecSQL(sql, null); + final Object[] nullarr = new Object[0]; + java.sql.Statement stat = createStatement(); + java.sql.ResultSet rs = createResultSet(stat); + execSQL(new String[] { s }, nullarr, stat, rs); + return rs; } - /* - * Send a query to the backend. Returns one of the ResultSet - * objects. - * - * <B>Note:</B> there does not seem to be any method currently - * in existance to return the update count. - * - * @param sql the SQL statement to be executed - * @param stat The Statement associated with this query (may be null) - * @return a ResultSet holding the results - * @exception SQLException if a database error occurs - */ - public java.sql.ResultSet ExecSQL(String sql, java.sql.Statement stat) throws SQLException - { - if (isClosed()) - { - throw new PSQLException("postgresql.con.closed"); - } - return new QueryExecutor(new String[] {sql}, EMPTY_OBJECT_ARRAY, stat, pg_stream, (java.sql.Connection)this).execute(); - } - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - /* - * Send a query to the backend. Returns one of the ResultSet - * objects. - * - * <B>Note:</B> there does not seem to be any method currently - * in existance to return the update count. + /** Advanced query execution. * * @param p_sqlFragmentss the SQL statement parts to be executed * @param p_binds the SQL bind values - * @param stat The Statement associated with this query (may be null) - * @return a ResultSet holding the results + * @param stat the statement associated with this query. + * @param rs the ResultSet which will be initied for the results. * @exception SQLException if a database error occurs */ - public java.sql.ResultSet ExecSQL(String[] p_sqlFragments, Object[] p_binds, java.sql.Statement stat) throws SQLException - { - if (isClosed()) - { - throw new PSQLException("postgresql.con.closed"); - } - return new QueryExecutor(p_sqlFragments, p_binds, stat, pg_stream, (java.sql.Connection)this).execute(); + public void execSQL(String[] p_sqlFragments, + Object[] p_binds, + java.sql.Statement stat, + java.sql.ResultSet rs) + throws SQLException + { + QueryExecutor.execute(p_sqlFragments, + p_binds, + stat, + rs, + pg_stream, + (java.sql.Connection)this); } + /* * In SQL, a result table can be retrieved through a cursor that * is named. The current row of a result can be updated or deleted @@ -939,27 +907,27 @@ //We do the select to ensure a transaction is in process //before we do the commit to avoid warning messages //from issuing a commit without a transaction in process - ExecSQL("select 1; commit; set autocommit = on;"); + doQuery("select 1; commit; set autocommit = on;"); } else { - ExecSQL("end"); + doQuery("end"); } } else { if (haveMinimumServerVersion("7.3")) { - ExecSQL("set autocommit = off; " + getIsolationLevelSQL()); + doQuery("set autocommit = off; " + getIsolationLevelSQL()); } else if (haveMinimumServerVersion("7.1")) { - ExecSQL("begin;" + getIsolationLevelSQL()); + doQuery("begin;" + getIsolationLevelSQL()); } else { - ExecSQL("begin"); - ExecSQL(getIsolationLevelSQL()); + doQuery("begin"); + doQuery(getIsolationLevelSQL()); } } this.autoCommit = autoCommit; @@ -993,17 +961,17 @@ return ; if (haveMinimumServerVersion("7.3")) { - ExecSQL("commit; " + getIsolationLevelSQL()); + doQuery("commit; " + getIsolationLevelSQL()); } else if (haveMinimumServerVersion("7.1")) { - ExecSQL("commit;begin;" + getIsolationLevelSQL()); + doQuery("commit;begin;" + getIsolationLevelSQL()); } else { - ExecSQL("commit"); - ExecSQL("begin"); - ExecSQL(getIsolationLevelSQL()); + doQuery("commit"); + doQuery("begin"); + doQuery(getIsolationLevelSQL()); } } @@ -1024,17 +992,17 @@ //we don't automatically start a transaction //but let the server functionality automatically start //one when the first statement is executed - ExecSQL("rollback; " + getIsolationLevelSQL()); + doQuery("rollback; " + getIsolationLevelSQL()); } else if (haveMinimumServerVersion("7.1")) { - ExecSQL("rollback; begin;" + getIsolationLevelSQL()); + doQuery("rollback; begin;" + getIsolationLevelSQL()); } else { - ExecSQL("rollback"); - ExecSQL("begin"); - ExecSQL(getIsolationLevelSQL()); + doQuery("rollback"); + doQuery("begin"); + doQuery(getIsolationLevelSQL()); } } @@ -1049,14 +1017,14 @@ String sql = "show transaction isolation level"; String level = null; if (haveMinimumServerVersion("7.3")) { - ResultSet rs = ExecSQL(sql); + ResultSet rs = doQuery(sql); if (rs.next()) { level = rs.getString(1); } rs.close(); } else { clearWarnings(); - ExecSQL(sql); + doQuery(sql); SQLWarning warning = getWarnings(); if (warning != null) { @@ -1121,7 +1089,7 @@ new Integer(isolationLevel)); } } - ExecSQL(isolationLevelSQL); + doQuery(isolationLevelSQL); } /* @@ -1264,7 +1232,7 @@ } else { sql = "SELECT typname FROM pg_type WHERE oid = " +oid; } - ResultSet result = ExecSQL(sql); + ResultSet result = doQuery(sql); if (((AbstractJdbc1ResultSet)result).getColumnCount() != 1 || ((AbstractJdbc1ResultSet)result).getTupleCount()!= 1) { throw new PSQLException("postgresql.unexpected"); } @@ -1305,7 +1273,7 @@ } else { sql = "SELECT oid FROM pg_type WHERE typname='" + typeName + "'"; } - ResultSet result = ExecSQL(sql); + ResultSet result = doQuery(sql); if (((AbstractJdbc1ResultSet)result).getColumnCount() != 1 || ((AbstractJdbc1ResultSet)result).getTupleCount()!= 1) throw new PSQLException("postgresql.unexpected"); result.next(); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java Mon Nov 11 07:11:12 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java Fri Nov 15 09:31:00 2002 @@ -1913,7 +1913,9 @@ } rs.close(); - return connection.getResultSet(null, f, v, "OK", 1); + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -2199,7 +2201,10 @@ tuple[0] = types[i].getBytes(); v.addElement(tuple); } - return connection.getResultSet(null, f, v, "OK", 1); + + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -2366,7 +2371,9 @@ } rs.close(); - return connection.getResultSet(null, f, v, "OK", 1); + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -2478,7 +2485,10 @@ } } rs.close(); - return connection.getResultSet(null, f, v, "OK", 1); + + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -2580,7 +2590,9 @@ } rs.close(); - return connection.getResultSet(null, f, v, "OK", 1); + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } private static void sortStringArray(String s[]) { @@ -2773,7 +2785,10 @@ tuple[7] = Integer.toString(java.sql.DatabaseMetaData.bestRowNotPseudo).getBytes(); v.addElement(tuple); } - return connection.getResultSet(null, f, v, "OK", 1); + + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -2843,7 +2858,9 @@ /* Perhaps we should check that the given * catalog.schema.table actually exists. -KJ */ - return connection.getResultSet(null, f, v, "OK", 1); + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* @@ -3193,7 +3210,9 @@ tuples.addElement(tuple); } - return connection.getResultSet(null, f, tuples, "OK", 1); + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, tuples, "OK", 1, 0, false); + return retRs; } /* @@ -3478,7 +3497,10 @@ v.addElement(tuple); } rs.close(); - return connection.getResultSet(null, f, v, "OK", 1); + + java.sql.ResultSet retRs = connection.createResultSet(connection.createStatement()); + ((AbstractJdbc1ResultSet)retRs).init(f, v, "OK", 1, 0, false); + return retRs; } /* diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java Sat Oct 19 22:10:36 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java Fri Nov 15 23:29:26 2002 @@ -18,7 +18,7 @@ * extended by org.postgresql.jdbc2.AbstractJdbc2ResultSet which adds the jdbc2 * methods. The real ResultSet class (for jdbc1) is org.postgresql.jdbc1.Jdbc1ResultSet */ -public abstract class AbstractJdbc1ResultSet +public abstract class AbstractJdbc1ResultSet implements org.postgresql.PGResultSet { protected Vector rows; // The results @@ -42,7 +42,13 @@ public byte[][] rowBuffer = null; - public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, Statement statement, Field[] fields, Vector tuples,String status, int updateCount, long insertOID, boolean binaryCursor) + public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, + Statement statement, + Field[] fields, + Vector tuples, + String status, + int updateCount, + long insertOID, boolean binaryCursor) { this.connection = conn; this.statement = statement; @@ -50,6 +56,9 @@ this.rows = tuples; this.status = status; this.updateCount = updateCount; + + System.out.println(getClass().getName() + " updateCount = " + updateCount); + this.insertOID = insertOID; this.this_row = null; this.current_row = -1; @@ -57,13 +66,63 @@ } + /*** nic constructor: called by superclass which is called from Jdbc1Connection.createResultSet ***/ + public AbstractJdbc1ResultSet(org.postgresql.PGConnection conn, + Statement statement) + { + this.connection = conn; + this.statement = statement; + } + + /*** nic initializer. ***/ + public void init (Field[] fields, Vector tuples, String status, + int updateCount, long insertOID, boolean binaryCursor) + { + this.fields = fields; + + // on a reinit the size of this indicates how many we pulled + // back. If it's 0 then the res set has ended. + this.rows = tuples; + this.status = status; + this.updateCount = updateCount; + this.insertOID = insertOID; + this.this_row = null; + this.current_row = -1; + this.binaryCursor = binaryCursor; + } + + + + + // This slightly altered by nic. public boolean next() throws SQLException { if (rows == null) throw new PSQLException("postgresql.con.closed"); if (++current_row >= rows.size()) - return false; + { + int fetchSize = ((AbstractJdbc1Statement)statement).fetchSize; + // Must be false if we weren't batching. + if (fetchSize == 0) + return false; + // Use the ref to the statement to get + // the details we need to do another cursor + // query - it will use reinit() to repopulate this + // with the right data. + String[] sql = new String[1]; + String[] binds = new String[0]; + // Is this the correct query??? + String cursorName = ((AbstractJdbc1Statement)statement).m_statementName; + sql[0] = "FETCH FORWARD " + fetchSize + " FROM " + cursorName + " ;"; + ((AbstractJdbc1Connection)connection).execSQL(sql, binds, statement, (java.sql.ResultSet)this); + + // Test the new rows array. + if (rows.size() == 0) + return false; + // Otherwise reset the counter and let it go on... + current_row = 0; + } this_row = (byte [][])rows.elementAt(current_row); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java Sat Nov 16 22:24:29 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java Fri Nov 15 23:12:53 2002 @@ -8,7 +8,7 @@ import org.postgresql.largeobject.*; import org.postgresql.util.*; -/* $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v 1.13 2002/11/1405:35:45 barry Exp $ +/* $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v 1.12.2.12002/11/14 05:54:39 barry Exp $ * This class defines methods of the jdbc1 specification. This class is * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2 * methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement @@ -25,6 +25,9 @@ /** Maximum number of rows to return, 0 = unlimited */ protected int maxrows = 0; + /** Number of rows to get in a batch. */ + protected int fetchSize = 0; + /** Timeout (in seconds) for a query (not used) */ protected int timeout = 0; @@ -48,7 +51,7 @@ private String[] m_executeSqlFragments; protected Object[] m_binds = new Object[0]; private String[] m_bindTypes = new String[0]; - private String m_statementName = null; + protected String m_statementName = null; private boolean m_useServerPrepare = false; private static int m_preparedCount = 1; @@ -117,7 +120,7 @@ } - + /* * Execute a SQL statement that retruns a single ResultSet * @@ -133,7 +136,7 @@ //If we have already created a server prepared statement, we need //to deallocate the existing one if (m_statementName != null) { - ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " + m_statementName); + ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " + m_statementName); m_statementName = null; m_origSqlFragments = null; m_executeSqlFragments = null; @@ -150,7 +153,10 @@ */ public java.sql.ResultSet executeQuery() throws SQLException { - this.execute(); + if (fetchSize > 0) + this.nic_execute(); + else + this.execute(); while (result != null && !((AbstractJdbc1ResultSet)result).reallyResultSet()) result = ((AbstractJdbc1ResultSet)result).getNext(); if (result == null) @@ -175,7 +181,7 @@ //If we have already created a server prepared statement, we need //to deallocate the existing one if (m_statementName != null) { - ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " + m_statementName); + ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " + m_statementName); m_statementName = null; m_origSqlFragments = null; m_executeSqlFragments = null; @@ -219,7 +225,7 @@ //If we have already created a server prepared statement, we need //to deallocate the existing one if (m_statementName != null) { - ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " + m_statementName); + ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " + m_statementName); m_statementName = null; m_origSqlFragments = null; m_executeSqlFragments = null; @@ -317,7 +323,9 @@ } // New in 7.1, pass Statement so that ExecSQL can customise to it - result = ((AbstractJdbc1Connection)connection).ExecSQL(m_sqlFragments, m_binds, (java.sql.Statement)this); + result = ((AbstractJdbc1Connection)connection).createResultSet((java.sql.Statement)this); + ((AbstractJdbc1Connection)connection).execSQL(m_sqlFragments, m_binds, + (java.sql.Statement)this, result); //If we are executing a callable statement function set the return data if (isFunction) @@ -341,6 +349,110 @@ } } + /** version of execute which converts the query to a cursor. + */ + public boolean nic_execute() throws SQLException + { + if (isFunction && !returnTypeSet) + throw new PSQLException("postgresql.call.noreturntype"); + if (isFunction) + { // set entry 1 to dummy entry.. + m_binds[0] = ""; // dummy entry which ensured that no one overrode + m_bindTypes[0] = PG_TEXT; + // and calls to setXXX (2,..) really went to first arg in a function call.. + } + + // New in 7.1, if we have a previous resultset then force it to close + // This brings us nearer to compliance, and helps memory management. + // Internal stuff will call ExecSQL directly, bypassing this. + if (result != null) + { + java.sql.ResultSet rs = getResultSet(); + if (rs != null) + rs.close(); + } + + // I've pretty much ignored server prepared statements... can declare and prepare be + // used together? + // It's trivial to change this: you just have to resolve this issue + // of how to work out whether there's a function call. If there isn't then the first + // element of the array must be the bit that you extend to become the cursor + // decleration. + // The last thing that can go wrong is when the user supplies a cursor statement + // directly: the translation takes no account of that. I think we should just look + // for declare and stop the translation if we find it. + + // The first thing to do is transform the statement text into the cursor form. + String[] origSqlFragments = m_sqlFragments; + if (origSqlFragments.length > 1) + m_sqlFragments = new String[origSqlFragments.length + 1]; + else + m_sqlFragments = new String[origSqlFragments.length]; + System.arraycopy(origSqlFragments, 0, m_sqlFragments, 0, origSqlFragments.length); + // Pinch the prepared count for our own nefarious purposes. + m_statementName = "JDBC_CURS_" + m_preparedCount++; + // The static bit to prepend to all querys. + String cursDecl = "BEGIN; DECLARE " + m_statementName + " CURSOR FOR "; + String endCurs = " FETCH FORWARD " + fetchSize + " FROM " + m_statementName + ";"; + + // Add the real query to the curs decleration. + // This is the bit that really makes the presumption about + // m_sqlFragments not being a function call. + if (m_sqlFragments.length < 1) + m_sqlFragments[0] = cursDecl + "SELECT NULL;"; + + else if (m_sqlFragments.length < 2) + { + if (m_sqlFragments[0].endsWith(";")) + m_sqlFragments[0] = cursDecl + m_sqlFragments[0] + endCurs; + else + m_sqlFragments[0] = cursDecl + m_sqlFragments[0] + ";" + endCurs; + } + else + { + m_sqlFragments[0] = cursDecl + m_sqlFragments[0]; + if (m_sqlFragments[m_sqlFragments.length - 2].endsWith(";")) + m_sqlFragments[m_sqlFragments.length - 1] = endCurs; + else + m_sqlFragments[m_sqlFragments.length - 1] = ";" + endCurs; + } + + // Make the call to the query executor. + AbstractJdbc1Connection execr = (AbstractJdbc1Connection)connection; + java.sql.Statement st = (java.sql.Statement)this; + result = (java.sql.ResultSet) execr.createResultSet(st); + // Nic says: + // we don't need to collect the result here, rs is altered to + // be the result set so "result = rs" would do ok after this call. + execr.execSQL(m_sqlFragments, m_binds, st, result); + + //If we are executing a callable statement function set the return data + if (isFunction) + { + if (!((AbstractJdbc1ResultSet)result).reallyResultSet()) + throw new PSQLException("postgresql.call.noreturnval"); + if (!result.next ()) + throw new PSQLException ("postgresql.call.noreturnval"); + callResult = result.getObject(1); + int columnType = result.getMetaData().getColumnType(1); + if (columnType != functionReturnType) + { + Object[] arr = + { "java.sql.Types=" + columnType, + "java.sql.Types=" + functionReturnType + }; + throw new PSQLException ("postgresql.call.wrongrtntype",arr); + } + result.close (); + return true; + } + else + { + return (result != null && ((AbstractJdbc1ResultSet)result).reallyResultSet()); + } + } + + /* * setCursorName defines the SQL cursor name that will be used by * subsequent execute methods. This name can then be used in SQL @@ -593,7 +705,7 @@ // If using server prepared statements deallocate them if (m_useServerPrepare && m_statementName != null) { - ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " + m_statementName); + ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " + m_statementName); } // Disasociate it from us (For Garbage Collection) @@ -1912,7 +2024,7 @@ //If turning server prepared statements off deallocate statement //and reset statement name if (m_useServerPrepare != flag && !flag) - ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " + m_statementName); + ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " + m_statementName); m_statementName = null; m_useServerPrepare = flag; } else { diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Connection.java Thu Nov 7 22:27:15 2002 @@ -46,6 +46,12 @@ return new Jdbc1ResultSet(this, stat, fields, tuples, status, updateCount, 0, false); } + + public java.sql.ResultSet createResultSet (java.sql.Statement stat) throws SQLException + { + // This needs doing. + return null; + } } diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java Sat Oct 12 19:37:33 2002 @@ -6,6 +6,7 @@ import java.sql.*; import org.postgresql.util.PSQLException; + /* $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v 1.2 2002/09/0621:23:06 momjian Exp $ * This class defines methods of the jdbc2 specification. This class extends * org.postgresql.jdbc1.AbstractJdbc1Connection which provides the jdbc1 @@ -17,7 +18,7 @@ * The current type mappings */ protected java.util.Map typemap; - + public java.sql.Statement createStatement() throws SQLException { // The spec says default of TYPE_FORWARD_ONLY but everyone is used to diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java Mon Nov 4 06:42:33 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java Fri Nov 15 09:52:10 2002 @@ -38,6 +38,11 @@ protected PreparedStatement deleteStatement = null; private PreparedStatement selectStatement = null; + + AbstractJdbc2ResultSet (org.postgresql.PGConnection conn, Statement statement) + { + super(conn, statement); + } public AbstractJdbc2ResultSet(org.postgresql.PGConnection conn, Statement statement, Field[] fields, Vector tuples,String status, int updateCount, long insertOID, boolean binaryCursor) @@ -142,6 +147,14 @@ { return getString(columnIndex); } + else if (type.equals("refcursor")) + { + // We must return a ResultSet with the results packaged. + // We should probably check that auto commit is turned off. + String cursorName = getString(columnIndex); + // return new RefCursorResultSet(cursorName); + return null; + } else { return connection.getObject(field.getPGType(), getString(columnIndex)); @@ -366,9 +379,7 @@ public int getFetchSize() throws SQLException { - // In this implementation we return the entire result set, so - // here return the number of rows we have. Sub-classes can return a proper - // value + // Returning the current batch size seems the right thing to do. return rows.size(); } @@ -754,7 +765,6 @@ } updateValue(columnIndex, theData); - } @@ -787,7 +797,6 @@ throw new PSQLException("postgresql.updateable.ioerror" + ie); } updateValue(columnIndex, theData); - } diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java Wed Oct 30 04:33:29 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java Fri Nov 15 09:47:27 2002 @@ -115,7 +115,7 @@ public int getFetchSize() throws SQLException { - return 0; + return super.fetchSize; } public int getResultSetConcurrency() throws SQLException @@ -130,12 +130,14 @@ public void setFetchDirection(int direction) throws SQLException { - throw org.postgresql.Driver.notImplemented(); + // I don't think this should happen, since it's a hint it should just + // fail quietly. + // throw org.postgresql.Driver.notImplemented(); } public void setFetchSize(int rows) throws SQLException { - throw org.postgresql.Driver.notImplemented(); + super.fetchSize = rows; } public void setResultSetConcurrency(int value) throws SQLException diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java Thu Nov 7 23:32:30 2002 @@ -343,7 +343,10 @@ default: throw org.postgresql.Driver.notImplemented(); } - return ((AbstractJdbc2Connection)conn).getResultSet(null, fields, rows, "OK", 1 ); + java.sql.Statement stat = ((AbstractJdbc2Connection)conn).createStatement(); + java.sql.ResultSet retRs = ((AbstractJdbc2Connection)conn).createResultSet(stat); + ((AbstractJdbc2ResultSet)retRs).init(fields, rows, "OK", 1, 0, false); + return retRs; } public String toString() diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Connection.java Thu Nov 7 23:29:13 2002 @@ -46,6 +46,38 @@ return metadata; } + + + // the new method override which re-inits existing resultsets + public java.sql.ResultSet getResultSet(java.sql.Statement stat, + org.postgresql.jdbc1.AbstractJdbc1ResultSet rs, + Field[] fields, + Vector tuples, + String status, + int updateCount, long insertOID, boolean binaryCursor) + throws SQLException + { + if (rs == null) + return new Jdbc2ResultSet(this, stat, fields, + tuples, status, + updateCount, insertOID, binaryCursor); + else + { + rs.init(fields, tuples, status, updateCount, insertOID, binaryCursor); + return (java.sql.ResultSet) rs; + } + } + + + + + /** new nic method **/ + public java.sql.ResultSet createResultSet (Statement statement) + { + return new Jdbc2ResultSet(this, statement); + } + + public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount,long insertOID, boolean binaryCursor) throws SQLException { return new Jdbc2ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java Wed Sep 11 05:38:45 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java Wed Nov 6 12:19:43 2002 @@ -13,6 +13,12 @@ public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet { + Jdbc2ResultSet (org.postgresql.PGConnection conn, Statement statement) + { + super (conn, statement); + } + + public Jdbc2ResultSet(Jdbc2Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount,long insertOID, boolean binaryCursor) { super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java Thu Nov 14 23:14:05 2002 @@ -12,6 +12,12 @@ public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet { + AbstractJdbc3ResultSet (org.postgresql.PGConnection conn, Statement statement) + { + super(conn, statement); + } + + public AbstractJdbc3ResultSet(org.postgresql.PGConnection conn, Statement statement, org.postgresql.Field[] fields,Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) { super (conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java Fri Sep 6 21:23:06 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Connection.java Thu Nov 14 23:12:57 2002 @@ -46,14 +46,16 @@ return metadata; } - public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount,long insertOID, boolean binaryCursor) throws SQLException - { - return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor); - } - public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount)throws SQLException + + + + + + /** new nic method **/ + public java.sql.ResultSet createResultSet (Statement statement) { - return new Jdbc3ResultSet(this, statement, fields, tuples, status, updateCount, 0, false); + return new Jdbc3ResultSet(this, statement); } } diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java --- currentcvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java Wed Sep 11 05:38:45 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java Thu Nov 14 23:13:35 2002 @@ -13,6 +13,13 @@ public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet { + Jdbc3ResultSet (org.postgresql.PGConnection conn, Statement statement) + { + super (conn, statement); + } + + + public Jdbc3ResultSet(Jdbc3Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount,long insertOID, boolean binaryCursor) { super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor); diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java --- currentcvs/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java Mon Nov 11 07:11:12 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java Fri Nov 15 09:31:03 2002 @@ -9,7 +9,7 @@ * * PS: Do you know how difficult it is to type on a train? ;-) * - * $Id: DatabaseMetaDataTest.java,v 1.16 2002/11/11 07:11:12 barry Exp $ + * $Id: DatabaseMetaDataTest.java,v 1.15.2.1 2002/11/11 07:30:08 barry Exp $ */ public class DatabaseMetaDataTest extends TestCase diff --exclude .#* --exclude Makefile --exclude build.xml --exclude filelis* --exclude Driver.java --exclude CVS --exclude*.jar --exclude *.class --exclude *~ -Naur currentcvs/src/interfaces/jdbc/org/postgresql/util/Serialize.java pgsql-cvs/src/interfaces/jdbc/org/postgresql/util/Serialize.java --- currentcvs/src/interfaces/jdbc/org/postgresql/util/Serialize.java Tue Oct 1 00:39:02 2002 +++ pgsql-cvs/src/interfaces/jdbc/org/postgresql/util/Serialize.java Thu Nov 7 23:29:29 2002 @@ -405,7 +405,7 @@ if (Driver.logDebug) Driver.debug("Serialize.store: " + sb.toString() ); - ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL(sb.toString()); + ResultSet rs = ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).doQuery(sb.toString()); // fetch the OID for returning if (update) --=-=-= Nic --=-=-=--
pgsql-jdbc by date: