示例#1
0
 public DataBase(DataBuffer parent)
 {
     this.parent = parent;
     conn = new NpgsqlConnection (parent.parent.parent.strConn);
 }
示例#2
0
        //
        private bool initTables()
        {
            XmlTextReader xml = new XmlTextReader("Config\\tables.xml");
            XmlDocument doc = new XmlDocument();
            xml.Read();
            doc.Load(xml);

            //сначала считаем данные для базового потока
            XmlNodeList cnl = doc["tables"].ChildNodes;
            int countTables = cnl.Count;

            for (int i = 0; i < countTables; i++)
            {
                XmlAttributeCollection atr = cnl[i].Attributes;

                tableInfo tb = new tableInfo(atr["name"].Value);
                tb.l_dellAllType = atr["del_all_type"].Value;
                if (atr["use_broker_id"].Value=="1")
                    tb.l_UseBrokerId = true;

                if (atr["rev"].Value == "1")
                    tb.l_Rev = true;

                this.tablesT.Add(atr["name"].Value,atr["thread"].Value);

                this.parent.listSteams_Add(atr["name"].Value);

                if (this.DataBufferThreads.ContainsKey(atr["thread"].Value)){
                    DataBuffer db=(DataBuffer)this.DataBufferThreads[atr["thread"].Value];
                    db.addTable(tb);
                }
                else{
                    DataBuffer db=new DataBuffer(atr["thread"].Value,this);
                    this.parent.listDataThreads_Add(atr["thread"].Value);
                    db.addTable(tb);
                    this.DataBufferThreads.Add(atr["thread"].Value, db);
                }
            }

            xml.Close();
            System.Windows.Forms.Application.DoEvents();
            return true;
        }