Exemple #1
0
        public bool commit()
        {
            bool ret = false;

            if (!isDirty)
            {
                return(ret);
            }
            string colNames = ""; foreach (DbField f in bscTbl.Fields.from(2))

            {
                colNames += ", " + f.sql(db);
            }
            colNames = colNames.Substring(2);

            if (isInDb)
            {
                db.exec(bscTbl.sR(db.cd(bscTbl.Fields[1].sql(db)).EQ((long)(this[1]))).sC(colNames).UPD(values.from(2).array()));
            }
            else
            {
                db.push(bscTbl.INS(bscTbl.sC("Max(id) + 1, " + Db.ds(values.from(2).array())).SLD));
                db.push(bscTbl.sR(db.cd("id").EQ(bscTbl.sC("Max(id)").SLD0)).SLD0);
                Recs.Push(clone(db.exec()[1].Rows[1]));
                ret = true;
            }
            ori     = val.Clone();
            isDirty = false;
            return(ret);
        }
Exemple #2
0
        public DbObj readVrb(long top, bool distinct, string order, params DbCnd[] cnd)
        {
            initializing = true;
            DbObj ret = Clone();
            DbSlc s   = vrbTbl.sR(cnd).SLC;

            if (top > -1)
            {
                s = s.TOP(top);
            }
            if (distinct)
            {
                s = s.DST;
            }
            if (order.Trim().Length > 0)
            {
                s = s.ORD(order);
            }
            ret.loadRecsSlc = s;
            ret.reload();
            initializing = false;
            isDirty      = false;
            return(ret);
        }