Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 77ce535

Browse files
author
Barry Lind
committed
Improved error message and added some log messages in batch update functionality
Modified Files: jdbc/org/postgresql/errors.properties jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/util/PSQLException.java
1 parent 7931bfa commit 77ce535

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/interfaces/jdbc/org/postgresql/errors.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ postgresql.serial.namelength:Class & Package name length cannot be longer than 6
6969
postgresql.serial.noclass:No class found for {0}
7070
postgresql.serial.table:The table for {0} is not in the database. Contact the DBA, as the database is in an inconsistent state.
7171
postgresql.serial.underscore:Class names may not have _ in them. You supplied {0}.
72-
postgresql.stat.batch.error:Batch entry {0} {1} was aborted.
72+
postgresql.stat.batch.error:Batch entry {0} {1} was aborted. Call getNextException() to see the cause.
7373
postgresql.stat.maxfieldsize:An attempt to setMaxFieldSize() failed - compile time default in force.
7474
postgresql.stat.noresult:No results were returned by the query.
7575
postgresql.stat.result:A result was returned when none was expected.

src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.postgresql.largeobject.*;
1010
import org.postgresql.util.PSQLException;
1111

12-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.12 2003/03/07 18:39:45 barry Exp $
12+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.13 2003/03/14 01:21:47 barry Exp $
1313
* This class defines methods of the jdbc2 specification. This class extends
1414
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
1515
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
@@ -105,7 +105,7 @@ public int[] executeBatch() throws SQLException
105105

106106
PBatchUpdateException updex =
107107
new PBatchUpdateException("postgresql.stat.batch.error",
108-
new Integer(i), batch.elementAt(i), resultSucceeded);
108+
new Integer(i), m_sqlFragments[0], resultSucceeded);
109109
updex.setNextException(e);
110110

111111
throw updex;

src/interfaces/jdbc/org/postgresql/util/PSQLException.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 2003, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PSQLException.java,v 1.10 2003/03/08 06:06:55 barry Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/util/Attic/PSQLException.java,v 1.11 2003/03/14 01:21:47 barry Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -16,6 +16,7 @@
1616
import java.io.ByteArrayOutputStream;
1717
import java.io.PrintWriter;
1818
import java.sql.SQLException;
19+
import org.postgresql.Driver;
1920

2021
public class PSQLException extends SQLException
2122
{
@@ -29,6 +30,8 @@ public PSQLException(String error)
2930
{
3031
super();
3132
translate(error, null);
33+
if (Driver.logDebug)
34+
Driver.debug("Exception: " + this);
3235
}
3336

3437
/*
@@ -40,6 +43,8 @@ public PSQLException(String error, Object[] args)
4043
{
4144
super();
4245
translate(error, args);
46+
if (Driver.logDebug)
47+
Driver.debug("Exception: " + this);
4348
}
4449

4550
/*
@@ -51,6 +56,8 @@ public PSQLException(String error, Object arg)
5156
Object[] argv = new Object[1];
5257
argv[0] = arg;
5358
translate(error, argv);
59+
if (Driver.logDebug)
60+
Driver.debug("Exception: " + this);
5461
}
5562

5663
/*
@@ -82,6 +89,8 @@ public PSQLException(String error, Exception ex)
8289
}
8390

8491
translate(error, argv);
92+
if (Driver.logDebug)
93+
Driver.debug("Exception: " + this);
8594
}
8695

8796
/*
@@ -94,6 +103,8 @@ public PSQLException(String error, Object arg1, Object arg2)
94103
argv[0] = arg1;
95104
argv[1] = arg2;
96105
translate(error, argv);
106+
if (Driver.logDebug)
107+
Driver.debug("Exception: " + this);
97108
}
98109

99110
private void translate(String error, Object[] args)

0 commit comments

Comments
 (0)