aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/jdbc/org/postgresql/Driver.java.in17
-rw-r--r--src/interfaces/jdbc/org/postgresql/errors.properties3
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java4
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java13
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java3
5 files changed, 33 insertions, 7 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/Driver.java.in b/src/interfaces/jdbc/org/postgresql/Driver.java.in
index e37428491ac..96754e5b846 100644
--- a/src/interfaces/jdbc/org/postgresql/Driver.java.in
+++ b/src/interfaces/jdbc/org/postgresql/Driver.java.in
@@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.30 2003/05/29 04:39:51 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.31 2003/06/30 16:38:30 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -272,6 +272,17 @@ public class Driver implements java.sql.Driver
l_urlArgs = url.substring(l_qPos+1);
}
+ // look for an IPv6 address that is enclosed by []
+ // the upcoming parsing that uses colons as identifiers can't handle
+ // the colons in an IPv6 address.
+ int ipv6start = l_urlServer.indexOf("[");
+ int ipv6end = l_urlServer.indexOf("]");
+ String ipv6address = null;
+ if (ipv6start != -1 && ipv6end > ipv6start) {
+ ipv6address = l_urlServer.substring(ipv6start+1,ipv6end);
+ l_urlServer = l_urlServer.substring(0,ipv6start)+"ipv6host"+l_urlServer.substring(ipv6end+1);
+ }
+
//parse the server part of the url
StringTokenizer st = new StringTokenizer(l_urlServer, ":/", true);
for (int count = 0; (st.hasMoreTokens()); count++)
@@ -346,6 +357,10 @@ public class Driver implements java.sql.Driver
}
}
+ // if we extracted an IPv6 address out earlier put it back
+ if (ipv6address != null)
+ urlProps.put("PGHOST",ipv6address);
+
//parse the args part of the url
StringTokenizer qst = new StringTokenizer(l_urlArgs, "&");
for (int count = 0; (qst.hasMoreTokens()); count++)
diff --git a/src/interfaces/jdbc/org/postgresql/errors.properties b/src/interfaces/jdbc/org/postgresql/errors.properties
index d75ca97e9d5..b3f6e1ad210 100644
--- a/src/interfaces/jdbc/org/postgresql/errors.properties
+++ b/src/interfaces/jdbc/org/postgresql/errors.properties
@@ -97,3 +97,6 @@ postgresql.call.funcover:Cannot execute Query a call to setXXX (1, ..) was made
postgresql.call.wrongget:Parameter of type {0} was registered but call to get{1} (sqltype={2}) was made.
postgresql.call.noreturnval:A CallableStatement Function was executed with nothing returned.
postgresql.call.wrongrtntype:A CallableStatement Function was executed and the return was of type ({0}) however type={1} was registered.
+postgresql.input.fetch.gt0:Fetch size must be a value greater than or equal to 0.
+postgresql.input.query.gt0:Query Timeout must be a value greater than or equal to 0.
+postgresql.input.rows.gt0:Maximum number of rows must be a value greater than or equal to 0.
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
index 93d4fcae33a..c3d7af25137 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
@@ -25,7 +25,7 @@ import java.sql.Timestamp;
import java.sql.Types;
import java.util.Vector;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.24 2003/05/29 04:52:44 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.25 2003/06/30 16:38:30 barry Exp $
* This class defines methods of the jdbc1 specification. This class is
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
@@ -554,6 +554,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
*/
public void setMaxRows(int max) throws SQLException
{
+ if (max<0) throw new PSQLException("postgresql.input.rows.gt0");
maxrows = max;
}
@@ -590,6 +591,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
*/
public void setQueryTimeout(int seconds) throws SQLException
{
+ if (seconds<0) throw new PSQLException("postgresql.input.query.gt0");
timeout = seconds;
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
index 21514235027..2f0ad3cb277 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.19 2003/05/03 20:40:45 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.20 2003/06/30 16:38:30 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -687,10 +687,15 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
throw new PSQLException( "postgresql.updateable.notupdateable" );
}
- this_row = (byte[][]) rows.elementAt(current_row);
+ if (current_row < 0) {
+ this_row = null;
+ rowBuffer = null;
+ } else {
+ this_row = (byte[][]) rows.elementAt(current_row);
- rowBuffer = new byte[this_row.length][];
- System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ rowBuffer = new byte[this_row.length][];
+ System.arraycopy(this_row, 0, rowBuffer, 0, this_row.length);
+ }
onInsertRow = false;
doingUpdates = false;
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
index 510cc4242b0..2512a9790ef 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
@@ -9,7 +9,7 @@ import org.postgresql.Driver;
import org.postgresql.largeobject.*;
import org.postgresql.util.PSQLException;
-/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.14 2003/05/29 04:52:44 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.15 2003/06/30 16:38:30 barry Exp $
* This class defines methods of the jdbc2 specification. This class extends
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
@@ -151,6 +151,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
public void setFetchSize(int rows) throws SQLException
{
+ if (rows<0) throw new PSQLException("postgresql.input.fetch.gt0");
super.fetchSize = rows;
}