コード例 #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);
        }
コード例 #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);
        }
コード例 #3
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);
        }
コード例 #4
0
        public void insert()
        {
            UpdateScan us = (UpdateScan)s;

            us.insert();
        }
コード例 #5
0
        public RID getRid()
        {
            UpdateScan us = (UpdateScan)s;

            return(us.getRid());
        }
コード例 #6
0
        public void delete()
        {
            UpdateScan us = (UpdateScan)s;

            us.delete();
        }
コード例 #7
0
        public void setString(string fldname, string val)
        {
            UpdateScan us = (UpdateScan)s;

            us.setString(fldname, val);
        }
コード例 #8
0
        public void setInt(string fldname, int val)
        {
            UpdateScan us = (UpdateScan)s;

            us.setInt(fldname, val);
        }
コード例 #9
0
        //实现UpdateScan中所有接口
        public void setVal(string fldname, Constant val)
        {
            UpdateScan us = (UpdateScan)s;

            us.setVal(fldname, val);
        }
コード例 #10
0
        public void moveToRid(RID rid)
        {
            UpdateScan us = (UpdateScan)s;

            us.moveToRid(rid);
        }