cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: xml-cocoon2/scratchpad/src/org/apache/cocoon/acting ModularDatabaseAction.java
Date Thu, 06 Dec 2001 14:04:08 GMT
haul        01/12/06 06:04:08

  Modified:    scratchpad/src/org/apache/cocoon/acting
                        ModularDatabaseAction.java
  Log:
  Complain if transactions are not present. Configuration
  option to run without transactions.
  
  Revision  Changes    Path
  1.5       +13 -3     xml-cocoon2/scratchpad/src/org/apache/cocoon/acting/ModularDatabaseAction.java
  
  Index: ModularDatabaseAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/scratchpad/src/org/apache/cocoon/acting/ModularDatabaseAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ModularDatabaseAction.java	2001/12/04 04:14:33	1.4
  +++ ModularDatabaseAction.java	2001/12/06 14:04:08	1.5
  @@ -86,7 +86,7 @@
    * components can utilize the helper components.
    *
    * @author <a href="mailto:haul@apache.org">Christian Haul</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/12/04 04:14:33 $
  + * @version CVS $Revision: 1.5 $ $Date: 2001/12/06 14:04:08 $
    */
   public abstract class ModularDatabaseAction extends AbstractDatabaseAction 
       implements Disposable, ThreadSafe, Contextualizable {
  @@ -536,7 +536,16 @@
               datasource = this.getDataSource(conf, param);
               conn = datasource.getConnection();
               if (conn.getAutoCommit() == true) {
  -                conn.setAutoCommit(false);
  +                try {
  +                    conn.setAutoCommit(false);
  +                } catch (Exception ex) {
  +                    String tmp = param.getParameter("use-transactions",(String) this.settings.get("use-transactions",null));
  +                    if (tmp != null &&  (tmp.equalsIgnoreCase("no") || tmp.equalsIgnoreCase("false")
|| tmp.equalsIgnoreCase("0"))) {
  +                        if (getLogger().isErrorEnabled()) 
  +                            getLogger().error("This DB connection does not support transactions.
If you want to risk your data's integrity by continuing nonetheless set parameter \"use-transactions\"
to \"no\".");
  +                        throw ex;
  +                    }
  +                }
               }
   
               Configuration[] tables = conf.getChildren("table");
  @@ -593,7 +602,8 @@
                   }
               }
               
  -            conn.commit();
  +            if (conn.getAutoCommit()==false)
  +                conn.commit();
               OutputHelper oh = (OutputHelper) outputMapping.select( (String) defaultModeNames.get(
MODE_OUTPUT ) );
               oh.commit( null, request );
               outputMapping.release( oh );
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message