cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/acting DatabaseUpdateAction.java DatabaseDeleteAction.java DatabaseAddAction.java
Date Thu, 08 Mar 2001 15:37:14 GMT
bloritsch    01/03/08 07:37:13

  Modified:    src/org/apache/cocoon/acting Tag: xml-cocoon2
                        DatabaseUpdateAction.java DatabaseDeleteAction.java
                        DatabaseAddAction.java
  Log:
  Make the database actions easier to debug.  When Exceptions are thrown, we
  pass the value of the current column we are processing.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +5 -3      xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseUpdateAction.java
  
  Index: DatabaseUpdateAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseUpdateAction.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- DatabaseUpdateAction.java	2001/03/02 20:26:34	1.1.2.10
  +++ DatabaseUpdateAction.java	2001/03/08 15:37:04	1.1.2.11
  @@ -40,7 +40,7 @@
    * only one table at a time to update.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/02 20:26:34 $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/08 15:37:04 $
    */
   public class DatabaseUpdateAction extends AbstractDatabaseAction {
       private static final Map updateStatements = new HashMap();
  @@ -53,6 +53,7 @@
       public Map act(EntityResolver resolver, Map objectModel, String source, Parameters
param) throws Exception {
           DataSourceComponent datasource = null;
           Connection conn = null;
  +        int currentIndex = 0;
   
           try {
               Configuration conf = this.getConfiguration(param.getParameter("form-descriptor",
null));
  @@ -66,7 +67,7 @@
   
               Iterator keys = conf.getChild("table").getChild("keys").getChildren("key");
               Iterator values = conf.getChild("table").getChild("values").getChildren("value");
  -            int currentIndex = 1;
  +            currentIndex = 1;
   
               for (int i = currentIndex; values.hasNext(); i++) {
                   Configuration itemConf = (Configuration) values.next();
  @@ -77,6 +78,7 @@
               for (int i = currentIndex + 1; keys.hasNext(); i++) {
                   Configuration itemConf = (Configuration) keys.next();
                   this.setColumn(statement, i, request, itemConf);
  +                currentIndex = i;
               }
   
               statement.execute();
  @@ -87,7 +89,7 @@
                   conn.rollback();
               }
   
  -            throw new ProcessingException("Could not update record", e);
  +            throw new ProcessingException("Could not update record :position = " + currentIndex,
e);
           } finally {
               if (conn != null) {
                   try {
  
  
  
  1.1.2.7   +6 -4      xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseDeleteAction.java
  
  Index: DatabaseDeleteAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseDeleteAction.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- DatabaseDeleteAction.java	2001/03/02 20:26:31	1.1.2.6
  +++ DatabaseDeleteAction.java	2001/03/08 15:37:06	1.1.2.7
  @@ -43,7 +43,7 @@
    * the keys.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/03/02 20:26:31 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/03/08 15:37:06 $
    */
   public final class DatabaseDeleteAction extends AbstractDatabaseAction {
       private static final Map deleteStatements = new HashMap();
  @@ -56,6 +56,7 @@
       public final Map act(EntityResolver resolver, Map objectModel, String source, Parameters
param) throws Exception {
           DataSourceComponent datasource = null;
           Connection conn = null;
  +        int currentIndex = 0;
   
           try {
               Configuration conf = this.getConfiguration(param.getParameter("form-descriptor",
null));
  @@ -69,9 +70,9 @@
   
               Iterator keys = conf.getChild("table").getChild("keys").getChildren("key");
   
  -            for (int i = 1; keys.hasNext(); i++) {
  +            for (currentIndex = 1; keys.hasNext(); currentIndex++) {
                   Configuration itemConf = (Configuration) keys.next();
  -                this.setColumn(statement, i, request, itemConf);
  +                this.setColumn(statement, currentIndex, request, itemConf);
               }
   
               statement.execute();
  @@ -81,7 +82,8 @@
               if (conn != null) {
                   conn.rollback();
               }
  -            throw new ProcessingException("Could not delete record", e);
  +
  +            throw new ProcessingException("Could not delete record :position = " + currentIndex,
e);
           } finally {
               if (conn != null) {
                   try {
  
  
  
  1.1.2.11  +5 -3      xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java
  
  Index: DatabaseAddAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- DatabaseAddAction.java	2001/03/07 22:18:34	1.1.2.10
  +++ DatabaseAddAction.java	2001/03/08 15:37:08	1.1.2.11
  @@ -40,7 +40,7 @@
    * only one table at a time to update.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/07 22:18:34 $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/08 15:37:08 $
    */
   public class DatabaseAddAction extends AbstractDatabaseAction {
       private static final Map addStatements = new HashMap();
  @@ -54,6 +54,7 @@
       public Map act(EntityResolver resolver, Map objectModel, String source, Parameters
param) throws Exception {
           DataSourceComponent datasource = null;
           Connection conn = null;
  +        int currentIndex = 0;
   
           try {
               Configuration conf = this.getConfiguration(param.getParameter("form-descriptor",
null));
  @@ -67,7 +68,7 @@
   
               Iterator keys = conf.getChild("table").getChild("keys").getChildren("key");
               Iterator values = conf.getChild("table").getChild("values").getChildren("value");
  -            int currentIndex = 1;
  +            currentIndex = 1;
   
               while (keys.hasNext()) {
                   Configuration key = (Configuration) keys.next();
  @@ -99,7 +100,8 @@
               if (conn != null) {
                   conn.rollback();
               }
  -            throw new ProcessingException("Could not add record", e);
  +
  +            throw new ProcessingException("Could not add record :position = " + currentIndex,
e);
           } finally {
               if (conn != null) {
                   try {
  
  
  

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