Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public int executeInsert(InsertData data, Transaction tx)
        {
            Plan       p  = new TablePlan(data.tableName(), tx);
            UpdateScan us = (UpdateScan)p.open();

            us.insert();
            string   fldname;
            Constant val;

            for (int i = 0; i < data.fields().Count; i++)
            {
                fldname = data.fields()[i];
                val     = data.vals()[i];
                us.setVal(fldname, val);//一对一,对应的设置
            }
            us.close();
            return(1);
        }
Ejemplo n.º 3
0
        //实现UpdateScan中所有接口
        public void setVal(string fldname, Constant val)
        {
            UpdateScan us = (UpdateScan)s;

            us.setVal(fldname, val);
        }