RawrUniversal / xerial

Automatically exported from code.google.com/p/xerial
0 stars 1 forks source link

Error trapping in executeBatch (JDBC 3.6.20.1) #76

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Please describe a summary of the new feature (in a paragraph):
When an error occurs during a JDBC batch processing, there is no way to get the 
failed query.
The reason is that the method executeBatch (Stmt.java) does not tags the array 
of changes if an exception is rise by db.executeUpdate();
I suggest to add changes[i] = Statement.EXECUTE_FAILED before to throw a 
BatchUpdateException:
try {
      this.sql = (String) batch[i];
      db.prepare(this);
      changes[i] = db.executeUpdate(this, null);
      }
catch (SQLException e) {
      changes[i] = Statement.EXECUTE_FAILED // SUGGESTION HERE
      throw new BatchUpdateException("batch entry " + i + ": " +  e.getMessage(), changes);
      }
      finally {
      db.finalize(this);
      }

Please provide any additional information below:

Original issue reported on code.google.com by laurent.mistahl@gmail.com on 21 Jul 2010 at 2:14