diff options
author | Peter Mount <peter@retep.org.uk> | 2001-01-31 08:26:02 +0000 |
---|---|---|
committer | Peter Mount <peter@retep.org.uk> | 2001-01-31 08:26:02 +0000 |
commit | 8439a83d84fb159a790ed2b6d14d4151b9890857 (patch) | |
tree | 867314ef119cc9a0713548c2ed0e676a124d0aad /src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java | |
parent | dca0762efc1b4f84c0185b5464f94f7d66bbe566 (diff) | |
download | postgresql-8439a83d84fb159a790ed2b6d14d4151b9890857.tar.gz |
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.
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java')
-rw-r--r-- | src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java index 04315c096a..a0a40c1469 100644 --- a/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java +++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Statement.java @@ -32,6 +32,7 @@ public class Statement implements java.sql.Statement private Vector batch=null; int resultsettype; // the resultset type to return int concurrency; // is it updateable or not? + int maxrows=0; // the maximum number of rows to return 0=unlimited /** * Constructor for a Statement. It simply sets the connection @@ -134,7 +135,7 @@ public class Statement implements java.sql.Statement */ public int getMaxRows() throws SQLException { - return connection.maxrows; + return maxrows; } /** @@ -146,7 +147,7 @@ public class Statement implements java.sql.Statement */ public void setMaxRows(int max) throws SQLException { - connection.maxrows = max; + maxrows = max; } /** @@ -274,7 +275,8 @@ public class Statement implements java.sql.Statement if(escapeProcessing) sql=connection.EscapeSQL(sql); - result = connection.ExecSQL(sql); + // New in 7.1, pass Statement so that ExecSQL can customise to it + result = connection.ExecSQL(sql,this); // New in 7.1, required for ResultSet.getStatement() to work ((org.postgresql.jdbc2.ResultSet)result).setStatement(this); @@ -388,11 +390,6 @@ public class Statement implements java.sql.Statement throw org.postgresql.Driver.notImplemented(); } - //public int getKeysetSize() throws SQLException - //{ -// throw org.postgresql.Driver.notImplemented(); - //} - public int getResultSetConcurrency() throws SQLException { // new in 7.1 @@ -415,11 +412,6 @@ public class Statement implements java.sql.Statement throw org.postgresql.Driver.notImplemented(); } - //public void setKeysetSize(int keys) throws SQLException - //{ -// throw org.postgresql.Driver.notImplemented(); - //} - public void setResultSetConcurrency(int value) throws SQLException { concurrency=value; @@ -430,4 +422,17 @@ public class Statement implements java.sql.Statement resultsettype=value; } + /** + * New in 7.1: Returns the Last inserted oid. This should be used, rather + * than the old method using getResultSet, which for executeUpdate returns + * null. + * @return OID of last insert + */ + public int getInsertedOID() throws SQLException + { + if(result!=null) + return ((org.postgresql.ResultSet)result).getInsertedOID(); + return 0; + } + } |