avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions BasicDeleteRows.java BasicSelect.java
Date Fri, 23 Nov 2001 07:24:57 GMT
hammant     01/11/22 23:24:57

  Modified:    apps/db/src/java/org/apache/avalon/db/basic/actions
                        BasicDeleteRows.java BasicSelect.java
  Log:
  DELETE works - for basic
  
  Revision  Changes    Path
  1.4       +17 -15    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicDeleteRows.java
  
  Index: BasicDeleteRows.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicDeleteRows.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicDeleteRows.java	2001/11/18 20:47:20	1.3
  +++ BasicDeleteRows.java	2001/11/23 07:24:57	1.4
  @@ -16,6 +16,7 @@
   import org.apache.avalon.framework.logger.LogEnabled;
   
   import java.util.Iterator;
  +import java.util.Vector;
   
   
   /**
  @@ -23,10 +24,10 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class BasicDeleteRows extends AbstractAction
  -        implements DeleteRows, LogEnabled, SimpleWhereClauseMatchingRowCallback {
  +        implements DeleteRows, LogEnabled {
   
       private SimpleWhereClause mWhereClause;
       private AbstractQueryable mQueryable;
  @@ -56,20 +57,21 @@
        */
       public void execute() throws ActionException {
   
  +        Vector pendingDeletes = new Vector();
           Iterator it = mQueryable.getRows().iterator();
  -        mWhereClause.testActionRows(it, this);
  -
  -    }
  -
  -    /**
  -     * Method rowMatches
  -     *
  -     * This is the callback from JavaScript
  -     */
  -    public void rowMatches(BasicRow row, boolean matches) {
  -        if (matches) {
  -            mQueryable.deleteRow(row);
  -            mRecordCount++;
  +        //mWhereClause.testActionRows(it, this);
  +        while(it.hasNext()) {
  +            /** iterate rows and select only the needed cols */
  +            BasicRow row = (BasicRow)it.next();
  +            if (mWhereClause.testActionRow(row)) {
  +                pendingDeletes.add(row);
  +            }
  +        }
  +        // TODO ConcurrentModificationException potential for other selects at the same
time
  +        it = pendingDeletes.iterator();
  +        while (it.hasNext()) {
  +            it.next();
  +            it.remove();
           }
       }
   
  
  
  
  1.30      +5 -5      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicSelect.java
  
  Index: BasicSelect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicSelect.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- BasicSelect.java	2001/11/20 16:43:53	1.29
  +++ BasicSelect.java	2001/11/23 07:24:57	1.30
  @@ -74,7 +74,7 @@
           Object[] selectedRow = null;
           selectedRows = new Vector();
   
  -        try {
  +//        try {
               for(int i=0; i < mTablenames.length; i++) {
                   /** get the table, should be only one */
                   mTable = (BasicTable)mDatabasePersistor.getQueryable(mTablenames[i]);
  @@ -82,7 +82,7 @@
                   while(it.hasNext()) {
                       /** iterate rows and select only the needed cols */
                       BasicRow row = (BasicRow)it.next();
  -                    if (swc.testDataRow(row)) {
  +                    if (swc.testActionRow(row)) {
                           getLogger().debug("specific select=" + mCols);
                           selectedRow = new Object[mCols.length];
                           for (int j=0; j < mCols.length; j++) {
  @@ -98,9 +98,9 @@
                   mColumns = new BasicColumns();
                   mRowSet = new BasicRowSet(mColumns,selectedRows);
               }
  -        } catch(Exception e) {
  -            getLogger().error("execute(): Exception:",e);
  -        }
  +  //      } catch(Exception e) {
  +    //        getLogger().error("execute(): Exception:",e);
  +      //  }
       }
   
       private boolean checkSelectStructure(Element rootElement) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message