From: | snpe <snpe(at)snpe(dot)co(dot)yu> |
---|---|
To: | Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: streaming result sets: progress |
Date: | 2002-11-16 20:45:47 |
Message-ID: | 200211162045.47865.snpe@snpe.co.yu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
Thanks
Haris Peco
On Friday 15 November 2002 11:50 pm, Nic Ferrier wrote:
> This is the patch which should fix the meta data problem. It makes
> the use of nic_execute (ie: the cursor based fetch) dependant on the
> setting of fetch size.
>
>
> I have come to the view that this has been a bit of a waste of
> time. I don't think it's reasonable to put this into a release
> because the block based querys will always be interfering with other
> statements.
>
> Basically, unless everything goes cursor based (not very promising
> idea) or it's possible to declare a cursor in postgresql's default,
> non-transactional mode (more promising idea, maybe it would be
> possible to alter the backend to allow that?) I think this is a
> non-starter.
>
>
> It has been valuable in as much as I've had a good look at how it
> might be possible to rip out some of the duplicate query execution
> stuff. I believe the query execution stuff expressed by my patch is
> now pretty good.
>
>
> The other interesting thing is that a PGRefCursorResultSet (as
> dreamed up by Barry) would be able to deal row selection, so one
> could always call a proc if one wanted a batch return.
>
>
>
> Anyway, here's the patch.
>
>
> Nic
>
>
> Index: org/postgresql/PGConnection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/PGConnect
>ion.java,v retrieving revision 1.3
> diff -r1.3 PGConnection.java
> 79a80,89
>
> > // 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);
>
> cvs server: Diffing org/postgresql/core
> Index: org/postgresql/core/QueryExecutor.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/core/Quer
>yExecutor.java,v retrieving revision 1.16.2.1
> diff -r1.16.2.1 QueryExecutor.java
> 20a21,69
>
> > /** 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;
>
> 22,26d70
> < 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;
> 36c80
> < this.statement = statement;
> ---
>
> > this.statement = statement;
>
> 45a90
>
> 53a99
>
> 55a102
>
> > *
>
> 133c180,185
> < 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;
>
> Index: org/postgresql/jdbc1/AbstractJdbc1Connection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Abs
>tractJdbc1Connection.java,v retrieving revision 1.12.2.1
> diff -r1.12.2.1 AbstractJdbc1Connection.java
> 353,354d352
> < java.sql.ResultSet resultSet =
> < ExecSQL("set datestyle to 'ISO'; select version(), " + encodingQuery +
> ";"); 355a354,356
>
> > java.sql.ResultSet resultSet
> > = doQuery("set datestyle to 'ISO'; select version(), " + encodingQuery
> > + ";");
>
> 376c377
> < ExecSQL("set client_encoding = 'UNICODE'; show autocommit");
> ---
>
> > doQuery("set client_encoding = 'UNICODE'; show autocommit");
>
> 391c392
> < ExecSQL("set autocommit = on; commit;");
> ---
>
> > doQuery("set autocommit = on; commit;");
>
> 412,418d412
> < // 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, String status, int
> updateCount, long insertOID, boolean binaryCursor) throws SQLException; <
> < public abstract java.sql.ResultSet getResultSet(Statement statement,
> org.postgresql.Field[] fields, Vector tuples, String status, int
> updateCount) throws SQLException; 448,457c442
> < /*
> < * 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.
>
> 459c444
> < public java.sql.ResultSet ExecSQL(String sql) throws SQLException
> ---
>
> > public java.sql.ResultSet doQuery (String s) throws SQLException
>
> 461c446,450
> < 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;
>
> 464,491c453
> < /*
> < * 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.
>
> 495,496c457,458
> < * @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.
>
> 499,505c461,472
> < 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);
>
> 507a475
>
> 942c910
> < ExecSQL("select 1; commit; set autocommit = on;");
> ---
>
> > doQuery("select 1; commit; set autocommit = on;");
>
> 946c914
> < ExecSQL("end");
> ---
>
> > doQuery("end");
>
> 953c921
> < ExecSQL("set autocommit = off; " + getIsolationLevelSQL());
> ---
>
> > doQuery("set autocommit = off; " + getIsolationLevelSQL());
>
> 957c925
> < ExecSQL("begin;" + getIsolationLevelSQL());
> ---
>
> > doQuery("begin;" + getIsolationLevelSQL());
>
> 961,962c929,930
> < ExecSQL("begin");
> < ExecSQL(getIsolationLevelSQL());
> ---
>
> > doQuery("begin");
> > doQuery(getIsolationLevelSQL());
>
> 996c964
> < ExecSQL("commit; " + getIsolationLevelSQL());
> ---
>
> > doQuery("commit; " + getIsolationLevelSQL());
>
> 1000c968
> < ExecSQL("commit;begin;" + getIsolationLevelSQL());
> ---
>
> > doQuery("commit;begin;" + getIsolationLevelSQL());
>
> 1004,1006c972,974
> < ExecSQL("commit");
> < ExecSQL("begin");
> < ExecSQL(getIsolationLevelSQL());
> ---
>
> > doQuery("commit");
> > doQuery("begin");
> > doQuery(getIsolationLevelSQL());
>
> 1027c995
> < ExecSQL("rollback; " + getIsolationLevelSQL());
> ---
>
> > doQuery("rollback; " + getIsolationLevelSQL());
>
> 1031c999
> < ExecSQL("rollback; begin;" + getIsolationLevelSQL());
> ---
>
> > doQuery("rollback; begin;" + getIsolationLevelSQL());
>
> 1035,1037c1003,1005
> < ExecSQL("rollback");
> < ExecSQL("begin");
> < ExecSQL(getIsolationLevelSQL());
> ---
>
> > doQuery("rollback");
> > doQuery("begin");
> > doQuery(getIsolationLevelSQL());
>
> 1052c1020
> < ResultSet rs = ExecSQL(sql);
> ---
>
> > ResultSet rs = doQuery(sql);
>
> 1059c1027
> < ExecSQL(sql);
> ---
>
> > doQuery(sql);
>
> 1124c1092
> < ExecSQL(isolationLevelSQL);
> ---
>
> > doQuery(isolationLevelSQL);
>
> 1267c1235
> < ResultSet result = ExecSQL(sql);
> ---
>
> > ResultSet result = doQuery(sql);
>
> 1308c1276
> < ResultSet result = ExecSQL(sql);
> ---
>
> > ResultSet result = doQuery(sql);
>
> Index: org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Abs
>tractJdbc1DatabaseMetaData.java,v retrieving revision 1.10.2.1
> diff -r1.10.2.1 AbstractJdbc1DatabaseMetaData.java
> 1916c1916,1918
> < 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;
>
> 2202c2204,2207
> < 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;
>
> 2369c2374,2376
> < 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;
>
> 2481c2488,2491
> < 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;
>
> 2583c2593,2595
> < 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;
>
> 2776c2788,2791
> < 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;
>
> 2846c2861,2863
> < 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;
>
> 3196c3213,3215
> < 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;
>
> 3481c3500,3503
> < 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;
>
> Index: org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Abs
>tractJdbc1ResultSet.java,v retrieving revision 1.7
> diff -r1.7 AbstractJdbc1ResultSet.java
> 21c21
> < public abstract class AbstractJdbc1ResultSet
> ---
>
> > public abstract class AbstractJdbc1ResultSet implements
> > org.postgresql.PGResultSet
>
> 45c45,51
> < 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)
>
> 52a59,61
>
> > System.out.println(getClass().getName() + " updateCount = " +
> > updateCount);
>
> 59a69,97
>
> > /*** 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.
>
> 66c104,125
> < 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;
> > }
>
> Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Abs
>tractJdbc1Statement.java,v retrieving revision 1.12.2.1
> diff -r1.12.2.1 AbstractJdbc1Statement.java
> 27a28,30
>
> > /** Number of rows to get in a batch. */
> > protected int fetchSize = 0;
>
> 51c54
> < private String m_statementName = null;
> ---
>
> > protected String m_statementName = null;
>
> 120c123
> <
> ---
>
> 136c139
> < ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
> m_statementName); ---
>
> > ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " +
> > m_statementName);
>
> 153c156,159
> < this.execute();
> ---
>
> > if (fetchSize > 0)
> > this.nic_execute();
> > else
> > this.execute();
>
> 178c184
> < ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
> m_statementName); ---
>
> > ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " +
> > m_statementName);
>
> 222c228
> < ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
> m_statementName); ---
>
> > ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " +
> > m_statementName);
>
> 320c326,328
> < 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);
>
> 343a352,455
>
> > /** 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()); }
> > }
>
> 596c708
> < ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
> m_statementName); ---
>
> > ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " +
> > m_statementName);
>
> 1915c2027
> < ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
> m_statementName); ---
>
> > ((AbstractJdbc1Connection)connection).doQuery("DEALLOCATE " +
> > m_statementName);
>
> Index: org/postgresql/jdbc1/Jdbc1Connection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Jdb
>c1Connection.java,v retrieving revision 1.5
> diff -r1.5 Jdbc1Connection.java
> 48a49,54
>
> > public java.sql.ResultSet createResultSet (java.sql.Statement stat)
> > throws SQLException {
> > // This needs doing.
> > return null;
> > }
>
> cvs server: Diffing org/postgresql/jdbc2
> Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Abs
>tractJdbc2Connection.java,v retrieving revision 1.2
> diff -r1.2 AbstractJdbc2Connection.java
> 8a9
>
> 20c21
> <
> ---
>
> Index: org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Abs
>tractJdbc2ResultSet.java,v retrieving revision 1.10
> diff -r1.10 AbstractJdbc2ResultSet.java
> 40a41,45
>
> > AbstractJdbc2ResultSet (org.postgresql.PGConnection conn, Statement
> > statement) {
> > super(conn, statement);
> > }
>
> 144a150,157
>
> > 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;
> > }
>
> 369,371c382
> < // 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.
>
> 757d767
> <
> 790d799
> <
> Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Abs
>tractJdbc2Statement.java,v retrieving revision 1.8
> diff -r1.8 AbstractJdbc2Statement.java
> 118c118
> < return 0;
> ---
>
> > return super.fetchSize;
>
> 133c133,135
> < 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();
>
> 138c140
> < throw org.postgresql.Driver.notImplemented();
> ---
>
> > super.fetchSize = rows;
>
> Index: org/postgresql/jdbc2/Array.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Arr
>ay.java,v retrieving revision 1.18
> diff -r1.18 Array.java
> 346c346,349
> < 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;
>
> Index: org/postgresql/jdbc2/Jdbc2Connection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Jdb
>c2Connection.java,v retrieving revision 1.5
> diff -r1.5 Jdbc2Connection.java
> 48a49,80
>
> > // 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);
> > }
>
> Index: org/postgresql/jdbc2/Jdbc2ResultSet.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/Jdb
>c2ResultSet.java,v retrieving revision 1.6
> diff -r1.6 Jdbc2ResultSet.java
> 15a16,21
>
> > Jdbc2ResultSet (org.postgresql.PGConnection conn, Statement statement)
> > {
> > super (conn, statement);
> > }
>
> Index: org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc3/Abs
>tractJdbc3ResultSet.java,v retrieving revision 1.2
> diff -r1.2 AbstractJdbc3ResultSet.java
> 14a15,20
>
> > AbstractJdbc3ResultSet (org.postgresql.PGConnection conn, Statement
> > statement) {
> > super(conn, statement);
> > }
>
> Index: org/postgresql/jdbc3/Jdbc3Connection.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc3/Jdb
>c3Connection.java,v retrieving revision 1.2
> diff -r1.2 Jdbc3Connection.java
> 49,52d48
> < 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); < }
> 54c50,56
> < 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)
>
> 56c58
> < return new Jdbc3ResultSet(this, statement, fields, tuples, status,
> updateCount, 0, false); ---
>
> > return new Jdbc3ResultSet(this, statement);
>
> Index: org/postgresql/jdbc3/Jdbc3ResultSet.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc3/Jdb
>c3ResultSet.java,v retrieving revision 1.3
> diff -r1.3 Jdbc3ResultSet.java
> 15a16,22
>
> > Jdbc3ResultSet (org.postgresql.PGConnection conn, Statement statement)
> > {
> > super (conn, statement);
> > }
>
> Index: org/postgresql/util/Serialize.java
> ===================================================================
> RCS file:
> /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/util/Seri
>alize.java,v retrieving revision 1.14
> diff -r1.14 Serialize.java
> 408c408
> < ResultSet rs =
> ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).ExecSQL(sb.toString())
>; ---
>
> > ResultSet rs =
> > ((org.postgresql.jdbc1.AbstractJdbc1Connection)conn).doQuery(sb.toString(
> >));
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Nic Ferrier | 2002-11-16 23:47:44 | Re: streaming result sets: progress |
Previous Message | snpe | 2002-11-16 19:57:29 | Query for DatabaseMetaData.getImportedKey |