private static object[] GetTableIDs(string tblname, object[] ids, string[] dbnames) { DataTable[] tables = new DataTable[dbnames.Length]; int index = 0; foreach (string db in dbnames) { TableUnitManager tm = TableHelper.GetTableUnitManangerByDbname(db); TableUnit unit = tm.GetTableUnit(tblname); tables[index] = unit.GetTable(); index++; } bool bRet = false; while (!bRet) { bRet = true; foreach (DataTable table in tables) { if (ExistID(table, ids)) { bRet = false; break; } } if (!bRet) { ids[0] = (int)(ids[0]) + 1; } } return(ids); }
public static void ReloadRemoteTable() { string[] dbnames = TableHelper.GetAllDBNames(); foreach (string dbname in dbnames) { TableUnitManager mgr = TableHelper.GetTableUnitManangerByDbname(dbname); mgr.ReleaseTable("sys_TableRemoting"); mRemoteTables[dbname] = mgr.GetTableUnit("sys_TableRemoting").GetTable(); } }
public static int[] UniteTables(string tblname, string todbname, string[] dblist) { DataTable[] tables = new DataTable[dblist.Length - 1]; DataTable totable = null; DataTable untable = null; int nInsert = 0; int nModify = 0; int index = 0; bool priority = true; foreach (string db in dblist) { TableUnitManager tm = TableHelper.GetTableUnitManangerByDbname(db); TableUnit unit = tm.GetTableUnit(tblname); if (db != todbname) { tables[index] = unit.GetTable(); index++; } else { priority = false; totable = unit.GetTable(); } DataTable tbl = unit.GetTable(); tbl.ExtendedProperties["dbname"] = priority; } int count = 0; foreach (DataTable table in tables) { if (table != null) { bool cover = Convert.ToBoolean(table.ExtendedProperties["dbname"]); int[] result = UniteTables(totable, table, cover); nInsert += result[0]; nModify += result[1]; } } TableUnitManager totm = TableHelper.GetTableUnitManangerByDbname(todbname); totm.SaveTable(tblname); return(new int[] { nInsert, nModify }); }
public LogHelper(string clientkey) { mClientkey = clientkey; NetClient client = NetClientManager.GetNetClient(clientkey); if (client.Database != "monitor") { mTableUnitManager = TableHelper.GetTableUnitManager(clientkey); TableUnit unit = mTableUnitManager.GetTableUnit("sys_remote_log"); mLogTable = unit.GetTable(); } int length = Convert.ToInt32(LogType.END); mConsoleFlag = new bool[length]; mFileFlag = new bool[length]; for (int i = 0; i < length; ++i) { mConsoleFlag[i] = true; mFileFlag[i] = true; } }