Exemple #1
0
        public DBWorkPool GetReadDbByName(string table_name)
        {
            DBWorkPool db = null;

            ReadTableList.TryGetValue(table_name, out db);
            return(db);
        }
Exemple #2
0
        public DBWorkPool GetDbByName(string nick_name)
        {
            DBWorkPool db = null;

            DBNameList.TryGetValue(nick_name, out db);
            return(db);
        }
Exemple #3
0
        public void Call(AbstractDBOperater query, int index, string table_name = DBProxyDefault.DefaultTableName, DBOperateType type = DBProxyDefault.DefaultOperateType, DBCallback callback = null)
        {
            DBWorkPool dbPool = GetDbByTable(table_name, type);

            if (dbPool == null)
            {
                Log.Error("db call {0} failed: can not find table {1} type {2} db", query.GetCmd(), table_name, type.ToString());
                return;
            }
            dbPool.Call(query, index, callback);
        }
Exemple #4
0
        public void AddTableDb(string table_name, DBWorkPool db, DBOperateType operate_type)
        {
            switch (operate_type)
            {
            case DBOperateType.Write:
                WriteTableList.Add(table_name, db);
                break;

            case DBOperateType.Read:
                ReadTableList.Add(table_name, db);
                break;

            default:
                Console.WriteLine("add table db failed: got invalid opetate type {0}", operate_type);
                break;
            }
        }
Exemple #5
0
        public DBWorkPool GetDbByTable(string table_name, DBOperateType type)
        {
            DBWorkPool db = null;

            switch (type)
            {
            case DBOperateType.Write:
                WriteTableList.TryGetValue(table_name, out db);
                break;

            case DBOperateType.Read:
                ReadTableList.TryGetValue(table_name, out db);
                break;

            default:
                break;
            }
            return(db);
        }
Exemple #6
0
 public void AddNameDb(string nick_name, DBWorkPool db)
 {
     DBNameList.Add(nick_name, db);
 }