From: Fujii Masao <masao.fujii@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: SQLState of BatchUpdateException
Date: Tue, 26 May 2009 13:00:14 +0900
Message-ID: <3f0b79eb0905252100hef29e77k8230f8fd49bec067@mail.gmail.com> (raw)
Hi,
Unlike PSQLException, BatchUpdateException always doesn't haveSQLState.
This might cause unexpected behavior, e.g. fireConnectionError() would
misunderstand that the exception is fatal even if it's a mere transaction error.
Here is the patch to add SQLState into BatchUpdateException.
Thought?
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:add_sqlstate.patch (application/octet-stream, 1.3K) download
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.113
diff -c -r1.113 AbstractJdbc2Statement.java
*** org/postgresql/jdbc2/AbstractJdbc2Statement.java 28 Jan 2009 09:50:21 -0000 1.113
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java 25 May 2009 13:12:19 -0000
***************
*** 2569,2574 ****
--- 2569,2575 ----
batchException = new BatchUpdateException(GT.tr("Batch entry {0} {1} was aborted. Call getNextException to see the cause.",
new Object[]{ new Integer(resultIndex),
queryString}),
+ newError.getSQLState(),
successCounts);
}
***************
*** 2634,2639 ****
--- 2635,2641 ----
batchException = new BatchUpdateException(GT.tr("Batch entry {0} {1} was aborted. Call getNextException to see the cause.",
new Object[]{ new Integer(resultIndex),
queryString}),
+ newError.getSQLState(),
successCounts);
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: masao.fujii@gmail.com
Subject: Re: SQLState of BatchUpdateException
In-Reply-To: <3f0b79eb0905252100hef29e77k8230f8fd49bec067@mail.gmail.com>
References: <3f0b79eb0905252100hef29e77k8230f8fd49bec067@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox