Example #1
0
        public int executeDelete(DeleteData data, Transaction tx)
        {
            Plan p = new TablePlan(data.tableName(), tx);

            p = new SelectPlan(p, data.pred());
            UpdateScan us    = (UpdateScan)p.open();
            int        count = 0;

            while (us.next())
            {
                us.delete();
                count++;
            }
            us.close();
            return(count);
        }
Example #2
0
        public int executeModify(ModifyData data, Transaction tx)
        {
            Plan p = new TablePlan(data.tableName(), tx);

            p = new SelectPlan(p, data.pred());
            UpdateScan us    = (UpdateScan)p.open();
            int        count = 0;

            while (us.next())
            {
                Constant val = data.newValue().evaluate(us); //返回此处的表达式的常量值
                us.setVal(data.targetField(), val);          //设置要更改字段处的值
                count++;
            }
            us.close();
            return(count);
        }