You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ba...@locus.apache.org on 2000/05/12 19:27:46 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/processor/sql SQLProcessor.java
balld 00/05/12 10:27:46
Modified: src/org/apache/cocoon/processor/sql SQLProcessor.java
Log:
fixed autocommit bug reported by Matthew Langham <ml...@sundn.de>
Revision Changes Path
1.12 +9 -3 xml-cocoon/src/org/apache/cocoon/processor/sql/SQLProcessor.java
Index: SQLProcessor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/sql/SQLProcessor.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SQLProcessor.java 2000/03/29 06:45:35 1.11
+++ SQLProcessor.java 2000/05/12 17:27:45 1.12
@@ -62,7 +62,7 @@
* A processor that performs SQL database queries.
*
* @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
- * @version $Revision: 1.11 $ $Date: 2000/03/29 06:45:35 $
+ * @version $Revision: 1.12 $ $Date: 2000/05/12 17:27:45 $
*/
public class SQLProcessor extends AbstractActor implements Processor, Status {
@@ -150,6 +150,7 @@
* Process a single query node
*/
protected void processQuery(Document document, Dictionary parameters, Element query_element, Properties query_props, Connection conn) throws Exception {
+ boolean auto_commit = conn.getAutoCommit();
HttpServletRequest req = (HttpServletRequest)parameters.get("request");
String doc_element_name = query_props.getProperty("doc-element");
String row_element_name = query_props.getProperty("row-element");
@@ -290,12 +291,17 @@
}
rs.close();
}
- st.close(); conn.commit();
+ st.close();
+ if (!auto_commit) {
+ conn.commit();
+ }
query_element.getParentNode().replaceChild(results_node,query_element);
} catch (Exception e) {
Element error_element = Utils.createErrorElement(document,namespace,query_props,e);
query_element.getParentNode().replaceChild(error_element,query_element);
- conn.rollback();
+ if (!auto_commit) {
+ conn.rollback();
+ }
} finally {
conn.close();
}