Ejemplo n.º 1
0
        public bool Exec(ref RecordInfo r)
        {
            try
            {
                if (this.parent.tables.ContainsKey(r.tableName))
                {
                    tableInfo tb=(tableInfo)this.parent.tables[r.tableName];

                    try
                    {
                        //добавляем в переменную значения полей и их форматов
                        r.fieldsNames = tb.fields;
                        r.fieldsSortList = tb.fieldsL;

                        if (r.type == 0)
                        {
                            tb.execInsertCmd(r.fields);
                            if (tb.l_Rev)
                                this.parent.parent.mRevHash.setRevision(tb.m_name , Convert.ToInt64(r.iDRecord));

                        }
                        else if (r.type == 1)
                        {
                            tb.execUpdateCmd(r.iDRecord, r.fields);
                        }
                        else
                        {
                            tb.execDeleteCmd(r.iDRecord);
                        }
                    }
                    catch (Exception e)
                    {
                        this.parent.parent.parent.toLog(0, "Ошибка " + e.Message + "  "+tb.insertStr+ "  "+tb.updateStr,1,r);
                    }

                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception exp)
            {

                this.parent.parent.parent.toLog(0, "Ошибка " + exp.Message + "  " ,1);
                if (this.TestConnection())
                    return true;
                else
                    return false;
            }
        }
Ejemplo n.º 2
0
        public bool updateRow(int IDRecord, object Fields, string tableName)
        {
            if (this.tables.ContainsKey(tableName))
            {
                lock (xlock)
                {
                    RecordInfo r = new RecordInfo();
                    r.iDRecord = IDRecord;
                    r.fields = Fields;
                    r.type = 1; // insert
                    r.tableName = tableName;
                    //r.strExec = t.buildInsertString(IDRecord, o);
                    {
                        this.buffer.Add(r);
                        this.parent.ldb.setAmount(this.id, this.buffer.Count);
                    }
                }
            }

            return true;
        }
Ejemplo n.º 3
0
 public bool deleteRow(int IDRecord, string tableName)
 {
     if (this.tables.ContainsKey(tableName))
     {
         lock (xlock)
         {
             tableInfo t = (tableInfo)this.tables[tableName];
             RecordInfo r = new RecordInfo();
             r.iDRecord = IDRecord;
             r.type = 2; // delete
             r.tableName = tableName;
             {
                 this.buffer.Add(r);
                 this.parent.ldb.setAmount(this.id, this.buffer.Count);
             }
         }
     }
     return true;
 }