cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/acting AbstractAction.java DatabaseUpdateAction.java DatabaseDeleteAction.java
Date Fri, 27 Jul 2001 18:08:01 GMT
vgritsenko    01/07/27 11:08:01

  Modified:    src/org/apache/cocoon/acting Tag: cocoon_20_branch
                        AbstractAction.java DatabaseUpdateAction.java
                        DatabaseDeleteAction.java
  Log:
  Fix bug reported by Robert Marcano (robmv@promca.com):
  - return empty map on successful database update/delete action
  - populate request attribute "rows" with number (String object) of rows updated/deleted
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +11 -1     xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java
  
  Index: AbstractAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -r1.2.2.3 -r1.2.2.4
  --- AbstractAction.java	2001/07/23 16:30:40	1.2.2.3
  +++ AbstractAction.java	2001/07/27 18:08:01	1.2.2.4
  @@ -7,6 +7,10 @@
    *****************************************************************************/
   package org.apache.cocoon.acting;
   
  +import java.util.Map;
  +import java.util.TreeMap;
  +import java.util.Collections;
  +
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
  @@ -19,10 +23,16 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
  - * @version CVS $Revision: 1.2.2.3 $ $Date: 2001/07/23 16:30:40 $
  + * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/07/27 18:08:01 $
    */
   public abstract class AbstractAction extends AbstractLoggable
   implements Action, Configurable, Disposable {
  +
  +    /**
  +     * Empty unmodifiable map. Replace with Collections.EMPTY_MAP when
  +     * pre-jdk1.3 support is dropped.
  +     */
  +    protected static final Map EMPTY_MAP = Collections.unmodifiableMap(new TreeMap());
   
       /**
        * Configures the Action.
  
  
  
  1.3.2.5   +7 -2      xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java
  
  Index: DatabaseUpdateAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseUpdateAction.java,v
  retrieving revision 1.3.2.4
  retrieving revision 1.3.2.5
  diff -u -r1.3.2.4 -r1.3.2.5
  --- DatabaseUpdateAction.java	2001/07/13 19:46:07	1.3.2.4
  +++ DatabaseUpdateAction.java	2001/07/27 18:08:01	1.3.2.5
  @@ -35,7 +35,7 @@
    * only one table at a time to update.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.3.2.4 $ $Date: 2001/07/13 19:46:07 $
  + * @version CVS $Revision: 1.3.2.5 $ $Date: 2001/07/27 18:08:01 $
    */
   public class DatabaseUpdateAction extends AbstractDatabaseAction {
       private static final Map updateStatements = new HashMap();
  @@ -83,9 +83,14 @@
                   this.setColumn(statement, currentIndex, request, keys[i]);
               }
   
  -            statement.execute();
  +            int rows = statement.executeUpdate();
               conn.commit();
               statement.close();
  +
  +            if(rows > 0){
  +                request.setAttribute("rows", Integer.toString(rows));
  +                return EMPTY_MAP;
  +            }
           } catch (Exception e) {
               if (conn != null) {
                   conn.rollback();
  
  
  
  1.3.2.5   +7 -2      xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java
  
  Index: DatabaseDeleteAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/DatabaseDeleteAction.java,v
  retrieving revision 1.3.2.4
  retrieving revision 1.3.2.5
  diff -u -r1.3.2.4 -r1.3.2.5
  --- DatabaseDeleteAction.java	2001/07/13 19:46:06	1.3.2.4
  +++ DatabaseDeleteAction.java	2001/07/27 18:08:01	1.3.2.5
  @@ -38,7 +38,7 @@
    * the keys.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.3.2.4 $ $Date: 2001/07/13 19:46:06 $
  + * @version CVS $Revision: 1.3.2.5 $ $Date: 2001/07/27 18:08:01 $
    */
   public final class DatabaseDeleteAction extends AbstractDatabaseAction {
       private static final Map deleteStatements = new HashMap();
  @@ -80,9 +80,14 @@
                   this.setColumn(statement, i + 1, request, keys[i]);
               }
   
  -            statement.execute();
  +            int rows = statement.executeUpdate();
               conn.commit();
               statement.close();
  +
  +            if(rows > 0){
  +                request.setAttribute("rows", Integer.toString(rows));
  +                return EMPTY_MAP;
  +            }
           } catch (Exception e) {
               if (conn != null) {
                   conn.rollback();
  
  
  

----------------------------------------------------------------------
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