]> granicus.if.org Git - postgresql/commitdiff
add missing SQLState by Patrick Higgins
authorDave Cramer <davec@fastcrypt.com>
Fri, 12 Dec 2003 18:36:20 +0000 (18:36 +0000)
committerDave Cramer <davec@fastcrypt.com>
Fri, 12 Dec 2003 18:36:20 +0000 (18:36 +0000)
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
src/interfaces/jdbc/org/postgresql/util/PSQLException.java

index 54aaf2eb8aa7ce77f89185ba38257b6275206118..c8644f42ac9756ad1d9f5be1b4830bd40e0d0394 100644 (file)
@@ -26,7 +26,7 @@ import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.Vector;
 
-/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v 1.43 2003/12/12 00:26:20 davec Exp $
+/* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v 1.44 2003/12/12 18:36:19 davec 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
@@ -526,7 +526,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
                        callResult = result.getObject(1);
                        int columnType = result.getMetaData().getColumnType(1);
                        if (columnType != functionReturnType)
-                               throw new PSQLException ("postgresql.call.wrongrtntype",
+                               throw new PSQLException ("postgresql.call.wrongrtntype", PSQLState.DATA_TYPE_MISMATCH,
                                                                                 new Object[]{
                                                                                         "java.sql.Types=" + columnType, "java.sql.Types=" + functionReturnType });
                        result.close ();
index 7232bb11166ee32e954bab1a85941e08e28579ea..c085139acf34abb0be30df3cac68ab7caff33bc5 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PSQLException.java,v 1.14 2003/11/29 19:52:11 pgsql Exp $
+ *       $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/util/PSQLException.java,v 1.15 2003/12/12 18:36:20 davec Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,6 +224,8 @@ public class PSQLException extends SQLException
        
        public String getSQLState()
        {
+               if (state == null)
+                       return PSQLState.UNKNOWN_STATE.getState();
                return state.getState();
        }
 }