aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/example/basic.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/example/basic.java
parent23b5ca91aa92abf518fe1e86eb2b7b478414192b (diff)
downloadpostgresql-4bc8c8dd95367a1dd0e9af3f1805bb85018ec307.tar.gz
postgresql-4bc8c8dd95367a1dd0e9af3f1805bb85018ec307.zip
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/example/basic.java')
-rw-r--r--src/interfaces/jdbc/example/basic.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interfaces/jdbc/example/basic.java b/src/interfaces/jdbc/example/basic.java
index f01cb9cb8c5..9a4469d83a0 100644
--- a/src/interfaces/jdbc/example/basic.java
+++ b/src/interfaces/jdbc/example/basic.java
@@ -6,7 +6,7 @@ import java.text.*;
/*
*
- * $Id: basic.java,v 1.10 2001/11/19 23:16:44 momjian Exp $
+ * $Id: basic.java,v 1.11 2001/11/25 23:26:56 barry Exp $
*
* This example tests the basic components of the JDBC driver, and shows
* how even the simplest of queries can be implemented.
@@ -89,7 +89,7 @@ public class basic
// This shows how to get the oid of a just inserted row
// updated for 7.1
st.executeUpdate("insert into basic values (4,1)");
- int insertedOID = ((org.postgresql.Statement)st).getInsertedOID();
+ long insertedOID = ((org.postgresql.Statement)st).getLastOID();
System.out.println("Inserted row with oid " + insertedOID);
// Now change the value of b from 1 to 8