You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/09/26 20:39:06 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/sql UpdateTag.java QueryTag.java
jstrachan 2002/09/26 11:39:06
Modified: jelly/src/java/org/apache/commons/jelly/tags/sql
UpdateTag.java QueryTag.java
Log:
Patch for bug scarab#12889
Revision Changes Path
1.6 +10 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/sql/UpdateTag.java
Index: UpdateTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/sql/UpdateTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UpdateTag.java 1 Jun 2002 10:21:14 -0000 1.5
+++ UpdateTag.java 26 Sep 2002 18:39:06 -0000 1.6
@@ -127,15 +127,17 @@
throw new JellyException(Resources.getMessage("SQL_NO_STATEMENT"));
}
+ Statement statement = null;
int result = 0;
try {
if ( hasParameters() ) {
PreparedStatement ps = conn.prepareStatement(sqlStatement);
+ statement = ps;
setParameters(ps);
result = ps.executeUpdate();
}
else {
- Statement statement = conn.createStatement();
+ statement = conn.createStatement();
result = statement.executeUpdate(sqlStatement);
}
if (var != null) {
@@ -146,6 +148,13 @@
throw new JellyException(sqlStatement + ": " + e.getMessage(), e);
}
finally {
+ if (statement != null) {
+ try {
+ statement.close();
+ }
+ catch (SQLException e) {
+ } // Not much we can do
+ }
if (conn != null && !isPartOfTransaction) {
try {
conn.close();
1.11 +1 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/sql/QueryTag.java
Index: QueryTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/sql/QueryTag.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- QueryTag.java 26 Sep 2002 18:35:23 -0000 1.10
+++ QueryTag.java 26 Sep 2002 18:39:06 -0000 1.11
@@ -206,8 +206,8 @@
if ( hasParameters() ) {
PreparedStatement ps = conn.prepareStatement(sqlStatement);
- setParameters(ps);
statement = ps;
+ setParameters(ps);
rs = ps.executeQuery();
}
else {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>