OSDN Git Service

More SQLState updates from Kim Ho at Redhat.
authorBarry Lind <barry@xythos.com>
Sat, 13 Sep 2003 04:02:16 +0000 (04:02 +0000)
committerBarry Lind <barry@xythos.com>
Sat, 13 Sep 2003 04:02:16 +0000 (04:02 +0000)
Also a patch from Kris Jurka to correctly report SQLState support.

 Modified Files:
  jdbc/org/postgresql/Driver.java.in
  jdbc/org/postgresql/core/QueryExecutor.java
  jdbc/org/postgresql/fastpath/Fastpath.java
  jdbc/org/postgresql/geometric/PGbox.java
  jdbc/org/postgresql/geometric/PGcircle.java
  jdbc/org/postgresql/geometric/PGline.java
  jdbc/org/postgresql/geometric/PGlseg.java
  jdbc/org/postgresql/geometric/PGpath.java
  jdbc/org/postgresql/geometric/PGpoint.java
  jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
  jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
  jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
  jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
  jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
  jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
  jdbc/org/postgresql/jdbc2/Array.java
  jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
  jdbc/org/postgresql/util/PGmoney.java
  jdbc/org/postgresql/util/PSQLState.java

19 files changed:
src/interfaces/jdbc/org/postgresql/Driver.java.in
src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
src/interfaces/jdbc/org/postgresql/fastpath/Fastpath.java
src/interfaces/jdbc/org/postgresql/geometric/PGbox.java
src/interfaces/jdbc/org/postgresql/geometric/PGcircle.java
src/interfaces/jdbc/org/postgresql/geometric/PGline.java
src/interfaces/jdbc/org/postgresql/geometric/PGlseg.java
src/interfaces/jdbc/org/postgresql/geometric/PGpath.java
src/interfaces/jdbc/org/postgresql/geometric/PGpoint.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/util/PGmoney.java
src/interfaces/jdbc/org/postgresql/util/PSQLState.java

index 85fea4c..7c1436b 100644 (file)
@@ -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;
 
 }
index fcb1d08..ebc055e 100644 (file)
@@ -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
                {
index 08015d1..6235651 100644 (file)
@@ -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();
        }
index 242a294..0f2d953 100644 (file)
@@ -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));
index 43f008a..1b0e562 100644 (file)
@@ -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);
                }
        }
 
index 5a108bd..b5e686f 100644 (file)
@@ -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));
index c29aac4..5ffc645 100644 (file)
@@ -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));
index 0c40ce3..13fc2d3 100644 (file)
@@ -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();
index c3c04b8..30283df 100644 (file)
@@ -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());
                }
        }
 
index 34a0f35..e3146a1 100644 (file)
@@ -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:
index bb68437..1f37dd3 100644 (file)
@@ -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 -------------------
index 681cc8b..fc0d5ee 100644 (file)
@@ -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];
        }
 }
index 2f35880..979ae4d 100644 (file)
@@ -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);
        }
 
 
index 3921516..e7f7233 100644 (file)
@@ -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 );
        }
 
index 8f83c74..d65634a 100644 (file)
@@ -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];
        }
 
index 418a094..e38b0c9 100644 (file)
@@ -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() )
index 781544e..7ebdf38 100644 (file)
@@ -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;
        }
 
        /**
index 970c836..175d166 100644 (file)
@@ -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);
                }
        }
 
index 96d1416..152170e 100644 (file)
        
        // 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");
        
 }