logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r564479 - /logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java
Date Fri, 10 Aug 2007 06:16:17 GMT
Author: sdeboy
Date: Thu Aug  9 23:16:16 2007
New Revision: 564479

URL: http://svn.apache.org/viewvc?view=rev&rev=564479
Log:
Apply suggested fix to prevent NPE if generated keys supported. 

http://issues.apache.org/bugzilla/show_bug.cgi?id=42870

Modified:
    logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java

Modified: logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java?view=diff&rev=564479&r1=564478&r2=564479
==============================================================================
--- logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java
(original)
+++ logging/log4j/companions/receivers/trunk/src/main/java/org/apache/log4j/db/DBAppender.java
Thu Aug  9 23:16:16 2007
@@ -212,8 +212,12 @@
           connection = connectionSource.getConnection();
           connection.setAutoCommit(false);
           
-          PreparedStatement insertStatement =
-              connection.prepareStatement(insertSQL);
+          PreparedStatement insertStatement;
+          if (cnxSupportsGetGeneratedKeys) {
+        	  insertStatement = connection.prepareStatement(insertSQL, Statement.RETURN_GENERATED_KEYS);
+          } else {
+              insertStatement = connection.prepareStatement(insertSQL);
+          }
 
 /*          insertStatement.setLong(1, event.getSequenceNumber());*/
 		  insertStatement.setLong(1, 0);



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message