summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/Connection.java
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2000-06-15 04:12:41 +0000
committerBruce Momjian <bruce@momjian.us>2000-06-15 04:12:41 +0000
commitc545ec54f8139e7f02e39a138fc5f21ebdc33b7b (patch)
tree9c2a97b57fe003b2556246be2005f0a0a2c1c163 /src/interfaces/jdbc/org/postgresql/Connection.java
parent3a82b67b22ab61812b06e4051b003e3854d55b99 (diff)
Backpatch jdbc fixes into 7.0.X.
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/Connection.java')
-rw-r--r--src/interfaces/jdbc/org/postgresql/Connection.java40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/Connection.java b/src/interfaces/jdbc/org/postgresql/Connection.java
index 045ddec0fcf..69d9d052ff3 100644
--- a/src/interfaces/jdbc/org/postgresql/Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/Connection.java
@@ -10,7 +10,7 @@ import org.postgresql.largeobject.*;
import org.postgresql.util.*;
/**
- * $Id: Connection.java,v 1.1 2000/04/26 05:39:32 peter Exp $
+ * $Id: Connection.java,v 1.1.2.1 2000/06/15 04:12:28 momjian Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
@@ -317,11 +317,14 @@ public abstract class Connection
int fqp = 0;
boolean hfr = false;
String recv_status = null, msg;
- int update_count = 1;
+ int update_count = 1;
+ int insert_oid = 0;
SQLException final_error = null;
- if (sql.length() > 8192)
- throw new PSQLException("postgresql.con.toolong",sql);
+ // Commented out as the backend can now handle queries
+ // larger than 8K. Peter June 6 2000
+ //if (sql.length() > 8192)
+ //throw new PSQLException("postgresql.con.toolong",sql);
try
{
pg_stream.SendChar('Q');
@@ -357,12 +360,19 @@ public abstract class Connection
recv_status = pg_stream.ReceiveString(8192);
// Now handle the update count correctly.
- if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE")) {
+ if(recv_status.startsWith("INSERT") || recv_status.startsWith("UPDATE") || recv_status.startsWith("DELETE")) {
try {
update_count = Integer.parseInt(recv_status.substring(1+recv_status.lastIndexOf(' ')));
} catch(NumberFormatException nfe) {
throw new PSQLException("postgresql.con.fathom",recv_status);
}
+ if(recv_status.startsWith("INSERT")) {
+ try {
+ insert_oid = Integer.parseInt(recv_status.substring(1+recv_status.indexOf(' '),recv_status.lastIndexOf(' ')));
+ } catch(NumberFormatException nfe) {
+ throw new PSQLException("postgresql.con.fathom",recv_status);
+ }
+ }
}
if (fields != null)
hfr = true;
@@ -423,7 +433,7 @@ public abstract class Connection
if (final_error != null)
throw final_error;
- return getResultSet(this, fields, tuples, recv_status, update_count);
+ return getResultSet(this, fields, tuples, recv_status, update_count, insert_oid);
}
}
@@ -701,14 +711,14 @@ public abstract class Connection
// the full class name of the handling class.
//
private static final String defaultObjectTypes[][] = {
- {"box", "postgresql.geometric.PGbox"},
- {"circle", "postgresql.geometric.PGcircle"},
- {"line", "postgresql.geometric.PGline"},
- {"lseg", "postgresql.geometric.PGlseg"},
- {"path", "postgresql.geometric.PGpath"},
- {"point", "postgresql.geometric.PGpoint"},
- {"polygon", "postgresql.geometric.PGpolygon"},
- {"money", "postgresql.util.PGmoney"}
+ {"box", "org.postgresql.geometric.PGbox"},
+ {"circle", "org.postgresql.geometric.PGcircle"},
+ {"line", "org.postgresql.geometric.PGline"},
+ {"lseg", "org.postgresql.geometric.PGlseg"},
+ {"path", "org.postgresql.geometric.PGpath"},
+ {"point", "org.postgresql.geometric.PGpoint"},
+ {"polygon", "org.postgresql.geometric.PGpolygon"},
+ {"money", "org.postgresql.util.PGmoney"}
};
// This initialises the objectTypes hashtable
@@ -725,7 +735,7 @@ public abstract class Connection
* This returns a resultset. It must be overridden, so that the correct
* version (from jdbc1 or jdbc2) are returned.
*/
- protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException;
+ protected abstract java.sql.ResultSet getResultSet(org.postgresql.Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException;
public abstract void close() throws SQLException;