예제 #1
0
        public override void exec_batch(string table, string sql, string fields, string where, JToken values)
        {
            //加载结构
            this.m_table = this.table(table);
            var field_all = this.m_table.SelectToken("fields");
            var field_sel = this.selFields(fields, field_all);
            var field_cdt = this.selFields(where, field_all);

            DbHelper db  = new DbHelper();
            var      cmd = db.GetCommand(sql);

            this.m_pc.create(cmd, field_sel);
            this.m_pc.create(cmd, field_cdt);

            cmd.Connection.Open();
            cmd.Prepare();

            OracleValueSetter pvs = new OracleValueSetter();

            //设置条件
            foreach (var v in values)
            {
                pvs.setVal(cmd, field_sel, v);
                pvs.setVal(cmd, field_cdt, v);
                cmd.ExecuteNonQuery();
            }

            cmd.Connection.Close();
        }
예제 #2
0
        public override void delete_batch(string table, SqlParam[] ws, JToken values, string predicate = "and")
        {
            //加载结构
            this.m_table = this.table(table);
            var field_all = this.m_table.SelectToken("fields");
            var field_sel = this.selFields(ws, field_all);

            JObject o   = new JObject();
            string  sql = string.Format("delete from {0} where {1}"
                                        , table
                                        , this.toSqlCondition(ws, predicate));

            DbHelper db  = new DbHelper();
            var      cmd = db.GetCommand(sql);

            this.m_parSetter.setVal(cmd, field_sel, ws);
            cmd.Connection.Open();
            cmd.Prepare();

            OracleValueSetter pvs = new OracleValueSetter();

            foreach (var v in values)
            {
                pvs.setVal(cmd, field_sel, v);
                cmd.ExecuteNonQuery();
            }

            cmd.Connection.Close();
        }