Improved error message and added some log messages in batch update functionality
authorBarry Lind
Fri, 14 Mar 2003 01:21:47 +0000 (01:21 +0000)
committerBarry Lind
Fri, 14 Mar 2003 01:21:47 +0000 (01:21 +0000)
 Modified Files:
  jdbc/org/postgresql/errors.properties
  jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
  jdbc/org/postgresql/util/PSQLException.java

src/interfaces/jdbc/org/postgresql/errors.properties
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
src/interfaces/jdbc/org/postgresql/util/PSQLException.java

index cb6cdc38421cce4fc25848c48534d058a9ce8997..9a6c556101118bfa68638942e7c01d1c033a9319 100644 (file)
@@ -69,7 +69,7 @@ postgresql.serial.namelength:Class & Package name length cannot be longer than 6
 postgresql.serial.noclass:No class found for {0}
 postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state.
 postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}.
-postgresql.stat.batch.error:Batch entry {0} {1} was aborted.
+postgresql.stat.batch.error:Batch entry {0} {1} was aborted. Call getNextException() to see the cause.
 postgresql.stat.maxfieldsize:An attempt to setMaxFieldSize() failed - compile time default in force.
 postgresql.stat.noresult:No results were returned by the query.
 postgresql.stat.result:A result was returned when none was expected.
index d56a168ec8c87d152942b8513207e97616c0e50d..f3c06f3c52927df5bd25d7393e80d055197b8e31 100644 (file)
@@ -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.12 2003/03/07 18:39:45 barry Exp $
+/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.13 2003/03/14 01:21:47 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
@@ -105,7 +105,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
 
            PBatchUpdateException updex =
                new PBatchUpdateException("postgresql.stat.batch.error",
-                                         new Integer(i), batch.elementAt(i), resultSucceeded);
+                                         new Integer(i), m_sqlFragments[0], resultSucceeded);
            updex.setNextException(e);
 
            throw updex;
index 3dbf2573021b99768896f2136852148f0c58cd24..f043fded085fc2257337a13068defdad04c4eff9 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PSQLException.java,v 1.10 2003/03/08 06:06:55 barry Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PSQLException.java,v 1.11 2003/03/14 01:21:47 barry Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -16,6 +16,7 @@ package org.postgresql.util;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
 import java.sql.SQLException;
+import org.postgresql.Driver;
 
 public class PSQLException extends SQLException
 {
@@ -29,6 +30,8 @@ public class PSQLException extends SQLException
    {
        super();
        translate(error, null);
+       if (Driver.logDebug)
+           Driver.debug("Exception: " + this);
    }
 
    /*
@@ -40,6 +43,8 @@ public class PSQLException extends SQLException
    {
        super();
        translate(error, args);
+       if (Driver.logDebug)
+           Driver.debug("Exception: " + this);
    }
 
    /*
@@ -51,6 +56,8 @@ public class PSQLException extends SQLException
        Object[] argv = new Object[1];
        argv[0] = arg;
        translate(error, argv);
+       if (Driver.logDebug)
+           Driver.debug("Exception: " + this);
    }
 
    /*
@@ -82,6 +89,8 @@ public class PSQLException extends SQLException
        }
 
        translate(error, argv);
+       if (Driver.logDebug)
+           Driver.debug("Exception: " + this);
    }
 
    /*
@@ -94,6 +103,8 @@ public class PSQLException extends SQLException
        argv[0] = arg1;
        argv[1] = arg2;
        translate(error, argv);
+       if (Driver.logDebug)
+           Driver.debug("Exception: " + this);
    }
 
    private void translate(String error, Object[] args)