1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Tue Jan 30 22:24:00 GMT 2001 peter@retep.org.uk

- Fixed bug where Statement.setMaxRows() was a global setting. Now
          limited to just itself.
        - Changed LargeObject.read(byte[],int,int) to return the actual number
          of bytes read (used to be void).
        - LargeObject now supports InputStream's!
        - PreparedStatement.setBinaryStream() now works!
        - ResultSet.getBinaryStream() now returns an InputStream that doesn't
          copy the blob into memory first!
        - Connection.isClosed() now tests to see if the connection is still alive
          rather than if it thinks it's alive.
This commit is contained in:
Peter Mount
2001-01-31 08:26:02 +00:00
parent dca0762efc
commit 8439a83d84
12 changed files with 442 additions and 97 deletions

View File

@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*;
/**
* $Id: Connection.java,v 1.5 2001/01/18 17:37:14 peter Exp $
* $Id: Connection.java,v 1.6 2001/01/31 08:26:02 peter Exp $
*
* A Connection represents a session with a specific database. Within the
* context of a Connection, SQL statements are executed and results are
@ -265,7 +265,27 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
*/
public boolean isClosed() throws SQLException
{
return (pg_stream == null);
// If the stream is gone, then close() was called
if(pg_stream == null)
return true;
// ok, test the connection
try {
// by sending an empty query. If we are dead, then an SQLException should
// be thrown
java.sql.ResultSet rs = ExecSQL(" ");
if(rs!=null)
rs.close();
// By now, we must be alive
return false;
} catch(SQLException se) {
// Why throw an SQLException as this may fail without throwing one,
// ie isClosed() is called incase the connection has died, and we don't
// want to find out by an Exception, so instead we return true, as its
// most likely why it was thrown in the first place.
return true;
}
}
/**