aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/jdbc/org/postgresql/Driver.java.in8
-rw-r--r--src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java6
-rw-r--r--src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java10
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGbox.java10
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java8
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGline.java10
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java10
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGpath.java10
-rw-r--r--src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java6
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java4
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java8
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java3
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java20
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java4
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java3
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc2/Array.java6
-rw-r--r--src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java2
-rw-r--r--src/interfaces/jdbc/org/postgresql/util/PGmoney.java4
-rw-r--r--src/interfaces/jdbc/org/postgresql/util/PSQLState.java32
19 files changed, 92 insertions, 72 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/Driver.java.in b/src/interfaces/jdbc/org/postgresql/Driver.java.in
index 85fea4cadc1..7c1436b8128 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.35 2003/09/08 17:30:22 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.36 2003/09/13 04:02:12 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -142,7 +142,7 @@ public class Driver implements java.sql.Driver
{
if (Driver.logDebug)
Driver.debug("error", ex);
- throw new PSQLException("postgresql.jvm.version", ex);
+ throw new PSQLException("postgresql.jvm.version", PSQLState.SYSTEM_ERROR, ex);
}
catch (PSQLException ex1)
{
@@ -155,7 +155,7 @@ public class Driver implements java.sql.Driver
if (Driver.logDebug) {
Driver.debug("error", ex2);
}
- throw new PSQLException("postgresql.unusual", ex2);
+ throw new PSQLException("postgresql.unusual", PSQLState.UNEXPECTED_ERROR, ex2);
}
}
@@ -504,6 +504,6 @@ public class Driver implements java.sql.Driver
//The build number should be incremented for every new build
- private static int m_buildNumber = 208;
+ private static int m_buildNumber = 209;
}
diff --git a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
index fcb1d0827e9..ebc055e7ebc 100644
--- a/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
+++ b/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
@@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.25 2003/09/09 10:49:16 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.26 2003/09/13 04:02:13 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -311,7 +311,7 @@ public class QueryExecutor
for ( int i = 0; i < m_binds.length ; i++ )
{
if ( m_binds[i] == null )
- throw new PSQLException("postgresql.prep.param", PSQLState.PARAMETER_ERROR, new Integer(i + 1));
+ throw new PSQLException("postgresql.prep.param", PSQLState.INVALID_PARAMETER_VALUE, new Integer(i + 1));
}
try
{
@@ -352,7 +352,7 @@ public class QueryExecutor
for ( int i = 0; i < m_binds.length ; i++ )
{
if ( m_binds[i] == null )
- throw new PSQLException("postgresql.prep.param", PSQLState.PARAMETER_ERROR, new Integer(i + 1));
+ throw new PSQLException("postgresql.prep.param", PSQLState.INVALID_PARAMETER_VALUE, new Integer(i + 1));
}
try
{
diff --git a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
index 08015d18dbf..6235651fed3 100644
--- a/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
+++ b/src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
@@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/Fastpath.java,v 1.15 2003/09/08 17:30:22 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/fastpath/Attic/Fastpath.java,v 1.16 2003/09/13 04:02:13 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -178,7 +178,7 @@ public class Fastpath
break;
default:
- throw new PSQLException("postgresql.fp.protocol", new Character((char)c));
+ throw new PSQLException("postgresql.fp.protocol", PSQLState.COMMUNICATION_ERROR, new Character((char)c));
}
}
@@ -279,12 +279,12 @@ public class Fastpath
break;
default:
- throw new PSQLException("postgresql.fp.protocol", new Character((char)c));
+ throw new PSQLException("postgresql.fp.protocol", PSQLState.COMMUNICATION_ERROR, new Character((char)c));
}
}
if ( errorMessage != null )
- throw new PSQLException("postgresql.fp.error", errorMessage.toString());
+ throw new PSQLException("postgresql.fp.error", PSQLState.COMMUNICATION_ERROR, errorMessage.toString());
return result;
}
@@ -422,7 +422,7 @@ public class Fastpath
// so, until we know we can do this (needs testing, on the TODO list)
// for now, we throw the exception and do no lookups.
if (id == null)
- throw new PSQLException("postgresql.fp.unknown", name);
+ throw new PSQLException("postgresql.fp.unknown", PSQLState.UNEXPECTED_ERROR, name);
return id.intValue();
}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java b/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
index 242a29413fd..0f2d95305d6 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
@@ -6,17 +6,19 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGbox.java,v 1.4 2003/03/07 18:39:42 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGbox.java,v 1.5 2003/09/13 04:02:14 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
-import java.sql.SQLException;
-import java.io.Serializable;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import java.io.Serializable;
+import java.sql.SQLException;
public class PGbox extends PGobject implements Serializable, Cloneable
{
@@ -78,7 +80,7 @@ public class PGbox extends PGobject implements Serializable, Cloneable
{
PGtokenizer t = new PGtokenizer(value, ',');
if (t.getSize() != 2)
- throw new PSQLException("postgresql.geo.box", value);
+ throw new PSQLException("postgresql.geo.box", PSQLState.DATA_TYPE_MISMATCH, value);
point[0] = new PGpoint(t.getToken(0));
point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java b/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
index 43f008a5102..1b0e5621095 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
@@ -7,7 +7,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGcircle.java,v 1.5 2003/05/29 04:39:48 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGcircle.java,v 1.6 2003/09/13 04:02:14 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,6 +16,8 @@ package org.postgresql.geometric;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
import java.io.Serializable;
import java.sql.SQLException;
@@ -78,7 +80,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
{
PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s), ',');
if (t.getSize() != 2)
- throw new PSQLException("postgresql.geo.circle", s);
+ throw new PSQLException("postgresql.geo.circle", PSQLState.DATA_TYPE_MISMATCH, s);
try
{
@@ -87,7 +89,7 @@ public class PGcircle extends PGobject implements Serializable, Cloneable
}
catch (NumberFormatException e)
{
- throw new PSQLException("postgresql.geo.circle", e);
+ throw new PSQLException("postgresql.geo.circle", PSQLState.DATA_TYPE_MISMATCH, e);
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGline.java b/src/interfaces/jdbc/org/postgresql/geometric/PGline.java
index 5a108bd0b7a..b5e686fc450 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGline.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGline.java
@@ -6,17 +6,19 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.4 2003/03/07 18:39:42 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.5 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
-import java.io.Serializable;
-import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import java.io.Serializable;
+import java.sql.SQLException;
/*
* Currently line is not yet implemented in the backend, but this class
@@ -77,7 +79,7 @@ public class PGline extends PGobject implements Serializable, Cloneable
{
PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ',');
if (t.getSize() != 2)
- throw new PSQLException("postgresql.geo.line", s);
+ throw new PSQLException("postgresql.geo.line", PSQLState.DATA_TYPE_MISMATCH, s);
point[0] = new PGpoint(t.getToken(0));
point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java b/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
index c29aac4b98e..5ffc645fc3e 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
@@ -6,17 +6,19 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGlseg.java,v 1.4 2003/03/07 18:39:42 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGlseg.java,v 1.5 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
-import java.io.Serializable;
-import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import java.io.Serializable;
+import java.sql.SQLException;
public class PGlseg extends PGobject implements Serializable, Cloneable
{
@@ -73,7 +75,7 @@ public class PGlseg extends PGobject implements Serializable, Cloneable
{
PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ',');
if (t.getSize() != 2)
- throw new PSQLException("postgresql.geo.lseg");
+ throw new PSQLException("postgresql.geo.lseg", PSQLState.DATA_TYPE_MISMATCH);
point[0] = new PGpoint(t.getToken(0));
point[1] = new PGpoint(t.getToken(1));
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java b/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
index 0c40ce301ba..13fc2d316fd 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
@@ -6,17 +6,19 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpath.java,v 1.5 2003/03/07 18:39:42 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpath.java,v 1.6 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
package org.postgresql.geometric;
-import java.io.Serializable;
-import java.sql.SQLException;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
+import java.io.Serializable;
+import java.sql.SQLException;
public class PGpath extends PGobject implements Serializable, Cloneable
{
@@ -77,7 +79,7 @@ public class PGpath extends PGobject implements Serializable, Cloneable
s = PGtokenizer.removePara(s);
}
else
- throw new PSQLException("postgresql.geo.path");
+ throw new PSQLException("postgresql.geo.path", PSQLState.DATA_TYPE_MISMATCH);
PGtokenizer t = new PGtokenizer(s, ',');
int npoints = t.getSize();
diff --git a/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java b/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
index c3c04b8ef66..30283df961e 100644
--- a/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
+++ b/src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
@@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpoint.java,v 1.5 2003/05/29 04:39:48 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGpoint.java,v 1.6 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,6 +15,8 @@ package org.postgresql.geometric;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
import java.awt.Point;
import java.io.Serializable;
import java.sql.SQLException;
@@ -80,7 +82,7 @@ public class PGpoint extends PGobject implements Serializable, Cloneable
}
catch (NumberFormatException e)
{
- throw new PSQLException("postgresql.geo.point", e.toString());
+ throw new PSQLException("postgresql.geo.point", PSQLState.DATA_TYPE_MISMATCH, e.toString());
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
index 34a0f3596ea..e3146a11c9d 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.25 2003/09/09 10:49:16 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.26 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -373,7 +373,7 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
case AUTH_REQ_SCM:
if (Driver.logDebug)
Driver.debug("postgresql: SCM");
- throw new PSQLException("postgresql.con.scm");
+ throw new PSQLException("postgresql.con.scm", PSQLState.CONNECTION_REJECTED);
case AUTH_REQ_PASSWORD:
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
index bb68437335a..1f37dd34c65 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
@@ -9,7 +9,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.17 2003/09/09 10:49:16 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.18 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -211,7 +211,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
}
catch (NumberFormatException e)
{
- throw new PSQLException("postgresql.res.badbyte", s);
+ throw new PSQLException("postgresql.res.badbyte", PSQLState.NUMERIC_VALUE_OUT_OF_RANGE, s);
}
}
return 0; // SQL NULL
@@ -565,7 +565,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
Field field;
if (columnIndex < 1 || columnIndex > fields.length)
- throw new PSQLException("postgresql.res.colrange");
+ throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
field = fields[columnIndex - 1];
// some fields can be null, mainly from those returned by MetaData methods
@@ -788,7 +788,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
if ( this_row == null )
throw new PSQLException("postgresql.res.nextrequired");
if ( column < 1 || column > fields.length )
- throw new PSQLException("postgresql.res.colrange" );
+ throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE );
}
//----------------- Formatting Methods -------------------
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
index 681cc8b18f4..fc0d5ee33ae 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
@@ -3,6 +3,7 @@ package org.postgresql.jdbc1;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Vector;
@@ -454,7 +455,7 @@ public abstract class AbstractJdbc1ResultSetMetaData
private Field getField(int columnIndex) throws SQLException
{
if (columnIndex < 1 || columnIndex > fields.length)
- throw new PSQLException("postgresql.res.colrange");
+ throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
return fields[columnIndex - 1];
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
index 2f35880effb..979ae4d1ec9 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
@@ -26,7 +26,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.35 2003/09/09 10:49:16 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.36 2003/09/13 04:02:15 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
@@ -292,7 +292,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
public boolean execute() throws SQLException
{
if (isFunction && !returnTypeSet)
- throw new PSQLException("postgresql.call.noreturntype");
+ throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (isFunction)
{ // set entry 1 to dummy entry..
m_binds[0] = ""; // dummy entry which ensured that no one overrode
@@ -1641,9 +1641,9 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
if (parameterIndex != 1)
- throw new PSQLException ("postgresql.call.noinout");
+ throw new PSQLException ("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (!isFunction)
- throw new PSQLException ("postgresql.call.procasfunc", originalSql);
+ throw new PSQLException ("postgresql.call.procasfunc", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,originalSql);
// functionReturnType contains the user supplied value to check
// testReturn contains a modified version to make it easier to
@@ -1955,7 +1955,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
private void bind(int paramIndex, Object s, String type) throws SQLException
{
if (paramIndex < 1 || paramIndex > m_binds.length)
- throw new PSQLException("postgresql.prep.range", PSQLState.PARAMETER_ERROR);
+ throw new PSQLException("postgresql.prep.range", PSQLState.INVALID_PARAMETER_VALUE);
if (paramIndex == 1 && isFunction) // need to registerOut instead
throw new PSQLException ("postgresql.call.funcover");
m_binds[paramIndex - 1] = s;
@@ -1997,7 +1997,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
isValid = false;
index = l_sql.indexOf ("call");
if (index == -1 || !isValid)
- throw new PSQLException ("postgresql.call.malformed",
+ throw new PSQLException ("postgresql.call.malformed",PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL,
new Object[]{l_sql, JDBC_SYNTAX});
l_sql = l_sql.replace ('{', ' '); // replace these characters
l_sql = l_sql.replace ('}', ' ');
@@ -2027,7 +2027,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
{
checkIndex (parameterIndex);
if (type1 != this.testReturn && type2 != this.testReturn)
- throw new PSQLException("postgresql.call.wrongget",
+ throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
"java.sql.Types=" + type1});
@@ -2040,7 +2040,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
{
checkIndex (parameterIndex);
if (type != this.testReturn)
- throw new PSQLException("postgresql.call.wrongget",
+ throw new PSQLException("postgresql.call.wrongget", PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH,
new Object[]{"java.sql.Types=" + testReturn,
getName,
"java.sql.Types=" + type});
@@ -2053,9 +2053,9 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
private void checkIndex (int parameterIndex) throws SQLException
{
if (!isFunction)
- throw new PSQLException("postgresql.call.noreturntype");
+ throw new PSQLException("postgresql.call.noreturntype", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
if (parameterIndex != 1)
- throw new PSQLException("postgresql.call.noinout");
+ throw new PSQLException("postgresql.call.noinout", PSQLState.STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL);
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
index 3921516928b..e7f723365f8 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.22 2003/09/08 17:30:22 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.23 2003/09/13 04:02:15 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -261,7 +261,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
return null;
if (i < 1 || i > fields.length)
- throw new PSQLException("postgresql.res.colrange");
+ throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
return (java.sql.Array) new org.postgresql.jdbc2.Array( connection, i, fields[i - 1], this );
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
index 8f83c74273e..d65634a60db 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
@@ -3,6 +3,7 @@ package org.postgresql.jdbc2;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Vector;
@@ -450,7 +451,7 @@ public abstract class AbstractJdbc2ResultSetMetaData extends org.postgresql.jdbc
private Field getField(int columnIndex) throws SQLException
{
if (columnIndex < 1 || columnIndex > fields.length)
- throw new PSQLException("postgresql.res.colrange");
+ throw new PSQLException("postgresql.res.colrange", PSQLState.INVALID_PARAMETER_VALUE);
return fields[columnIndex - 1];
}
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
index 418a0942630..e38b0c92edc 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
@@ -5,6 +5,8 @@ import org.postgresql.core.BaseResultSet;
import org.postgresql.core.BaseStatement;
import org.postgresql.core.Field;
import org.postgresql.util.PSQLException;
+import org.postgresql.util.PSQLState;
+
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
@@ -77,7 +79,7 @@ public class Array implements java.sql.Array
throw org.postgresql.Driver.notImplemented();
if (index < 1)
- throw new PSQLException("postgresql.arr.range");
+ throw new PSQLException("postgresql.arr.range", PSQLState.DATA_ERROR);
Object retVal = null;
ArrayList array = new ArrayList();
@@ -127,7 +129,7 @@ public class Array implements java.sql.Array
count = arrayContents.length;
index--;
if ( index + count > arrayContents.length )
- throw new PSQLException("postgresql.arr.range");
+ throw new PSQLException("postgresql.arr.range", PSQLState.DATA_ERROR);
int i = 0;
switch ( getBaseType() )
diff --git a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
index 781544e16e5..7ebdf38271d 100644
--- a/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
+++ b/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
@@ -323,7 +323,7 @@ public abstract class AbstractJdbc3DatabaseMetaData extends org.postgresql.jdbc2
*/
public int getSQLStateType() throws SQLException
{
- throw org.postgresql.Driver.notImplemented();
+ return DatabaseMetaData.sqlStateSQL99;
}
/**
diff --git a/src/interfaces/jdbc/org/postgresql/util/PGmoney.java b/src/interfaces/jdbc/org/postgresql/util/PGmoney.java
index 970c8367b7f..175d166e2db 100644
--- a/src/interfaces/jdbc/org/postgresql/util/PGmoney.java
+++ b/src/interfaces/jdbc/org/postgresql/util/PGmoney.java
@@ -6,7 +6,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGmoney.java,v 1.5 2003/03/07 18:39:46 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PGmoney.java,v 1.6 2003/09/13 04:02:16 barry Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,7 @@ public class PGmoney extends PGobject implements Serializable, Cloneable
}
catch (NumberFormatException e)
{
- throw new PSQLException("postgresql.money", e);
+ throw new PSQLException("postgresql.money", PSQLState.NUMERIC_CONSTANT_OUT_OF_RANGE, e);
}
}
diff --git a/src/interfaces/jdbc/org/postgresql/util/PSQLState.java b/src/interfaces/jdbc/org/postgresql/util/PSQLState.java
index 96d14167a53..152170e0c97 100644
--- a/src/interfaces/jdbc/org/postgresql/util/PSQLState.java
+++ b/src/interfaces/jdbc/org/postgresql/util/PSQLState.java
@@ -27,21 +27,25 @@
// begin constant state codes
public final static PSQLState UNKNOWN_STATE = new PSQLState("");
+ public final static PSQLState NO_DATA = new PSQLState("02000");
+ public final static PSQLState INVALID_PARAMETER_TYPE = new PSQLState("07006");
+ public final static PSQLState CONNECTION_UNABLE_TO_CONNECT = new PSQLState("08001");
+ public final static PSQLState CONNECTION_DOES_NOT_EXIST = new PSQLState("08003");
+ public final static PSQLState CONNECTION_REJECTED = new PSQLState("08004");
+ public final static PSQLState CONNECTION_FAILURE = new PSQLState("08006");
+ public final static PSQLState CONNECTION_FAILURE_DURING_TRANSACTION = new PSQLState("08007");
public final static PSQLState COMMUNICATION_ERROR = new PSQLState("08S01");
- public final static PSQLState NO_DATA = new PSQLState("02000");
- public final static PSQLState CONNECTION_FAILURE_DURING_TRANSACTION = new PSQLState("08007");
- public final static PSQLState UNEXPECTED_ERROR = new PSQLState("99999");
- public final static PSQLState NUMERIC_VALUE_OUT_OF_RANGE = new PSQLState("22003");
- public final static PSQLState BAD_DATETIME_FORMAT = new PSQLState("22007");
- public final static PSQLState DATA_ERROR = new PSQLState("22000");
- public final static PSQLState CONNECTION_DOES_NOT_EXIST = new PSQLState("08003");
- public final static PSQLState CONNECTION_REJECTED = new PSQLState("08004");
- public final static PSQLState CONNECTION_UNABLE_TO_CONNECT = new PSQLState("08001");
- public final static PSQLState CONNECTION_FAILURE = new PSQLState("08006");
- public final static PSQLState CONNECTION_CLOSED = new PSQLState("08003");
- public final static PSQLState NOT_IMPLEMENTED = new PSQLState("0A000");
- public final static PSQLState INVALID_PARAMETER_TYPE = new PSQLState("07006");
- public final static PSQLState PARAMETER_ERROR = new PSQLState("07001");
+ public final static PSQLState NOT_IMPLEMENTED = new PSQLState("0A000");
+ public final static PSQLState DATA_ERROR = new PSQLState("22000");
+ public final static PSQLState NUMERIC_VALUE_OUT_OF_RANGE = new PSQLState("22003");
+ public final static PSQLState BAD_DATETIME_FORMAT = new PSQLState("22007");
+ public final static PSQLState MOST_SPECIFIC_TYPE_DOES_NOT_MATCH = new PSQLState("2200G");
+ public final static PSQLState INVALID_PARAMETER_VALUE = new PSQLState("22023");
public final static PSQLState TRANSACTION_STATE_INVALID = new PSQLState("25000");
+ public final static PSQLState STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL = new PSQLState("2F003");
+ public final static PSQLState NUMERIC_CONSTANT_OUT_OF_RANGE = new PSQLState("42820'");
+ public final static PSQLState DATA_TYPE_MISMATCH = new PSQLState("42821");
+ public final static PSQLState SYSTEM_ERROR = new PSQLState("60000");
+ public final static PSQLState UNEXPECTED_ERROR = new PSQLState("99999");
}