cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ba...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/sql SQLProcessor.java
Date Fri, 12 May 2000 17:27:46 GMT
balld       00/05/12 10:27:46

  Modified:    src/org/apache/cocoon/processor/sql SQLProcessor.java
  Log:
  fixed autocommit bug reported by Matthew Langham <mlangham@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();
           }
  
  
  

Mime
View raw message