summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/ResultSet.java
diff options
context:
space:
mode:
authorBarry Lind <barry@xythos.com>2001-11-25 23:26:59 +0000
committerBarry Lind <barry@xythos.com>2001-11-25 23:26:59 +0000
commit4bc8c8dd95367a1dd0e9af3f1805bb85018ec307 (patch)
treecb1ae41232cde0100e91e4c74e382f0db1de497a /src/interfaces/jdbc/org/postgresql/ResultSet.java
parent23b5ca91aa92abf518fe1e86eb2b7b478414192b (diff)
This patch fixes a bug reported by Graham Leggett (minfrin@sharp.fm).
The bug was that any insert or update would fail if the returned oid was larger than a signed int. Since OIDs are unsigned int's it was a bug that the code used a java signed int to deal with the values. The bug would result in the error message: "Unable to fathom update count". While fixing the bug, it became apparent that other code made a similar assumption about OIDs being signed ints. Therefore some methods that returned or took OIDs are arguements also needed to be changed. Since we are so close to the 7.2 release I have added new methods that return longs and deprecated the old methods returning ints. Therefore all old code should still work without requiring a code change to cast from long to int. Also note that the methods below are PostgreSQL specific extensions to the JDBC api are are not part of the spec from Sun, thus it is unlikely that they are used much or at all. The deprecated methods are: ResultSet.getInsertedOID() Statement.getInsertedOID() Serialize.store() Connection.putObject() and are replaced by: ResultSet.getLastOID() Statement.getLastOID() Serialize.storeObject() Connection.storeObject() All the deprecated methods returned int, while their replacements return long This patch also fixes two comments in MD5Digest that the author Jeremy Wohl submitted. --Barry
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/ResultSet.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/ResultSet.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/ResultSet.java b/src/interfaces/jdbc/org/postgresql/ResultSet.java
index 22a49fa6e21..a9da22d4f46 100644
--- a/src/interfaces/jdbc/org/postgresql/ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/ResultSet.java
@@ -20,7 +20,7 @@ public abstract class ResultSet
protected String status; // Status of the result
protected boolean binaryCursor = false; // is the data binary or Strings
protected int updateCount; // How many rows did we get back?
- protected int insertOID; // The oid of an inserted row
+ protected long insertOID; // The oid of an inserted row
protected int current_row; // Our pointer to where we are at
protected byte[][] this_row; // the current row result
protected Connection connection; // the connection which we returned from
@@ -42,7 +42,7 @@ public abstract class ResultSet
* @param updateCount the number of rows affected by the operation
* @param cursor the positioned update/delete cursor name
*/
- public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount, int insertOID, boolean binaryCursor)
+ public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
{
this.connection = conn;
this.fields = fields;
@@ -170,10 +170,22 @@ public abstract class ResultSet
}
/*
- * returns the OID of the last inserted row
+ * returns the OID of the last inserted row. Deprecated in 7.2 because
+ * range for OID values is greater than java signed int.
+ * @deprecated Replaced by getLastOID() in 7.2
*/
public int getInsertedOID()
{
+ return (int) getLastOID();
+ }
+
+
+ /*
+ * returns the OID of the last inserted row
+ * @since 7.2
+ */
+ public long getLastOID()
+ {
return insertOID;
}