本来准备在服务程序中加入一个内存表,客户端随时可以读取服务端的登录情况,但是内存表放在ServerContainer中不行,原因不太明白,似乎是马上就释放了
只好放在一个实数据库中了,感觉很不好
/*
// 建立一个临时内存表,作为当前在线用户表显示在主窗体,UI程序可以调用显示在线情况 不行啊,不能放在服务中
TFDMemTable *FDMemTable1 = new TFDMemTable(this);
FDMemTable1->FieldDefs->Add("LogTime",ftString,20);
FDMemTable1->FieldDefs->Add("SessionId",10);
FDMemTable1->FieldDefs->Add("UserName",10);
FDMemTable1->FieldDefs->Add("ClientIP",20);
FDMemTable1->FieldDefs->Add("State",10);
FDMemTable1->Open();
FDMemTable1->AppendRecord(ARRAYOFCONST((FormatDateTime(L"yyyy-MM-dd HH:mm:ss",Now()),
"0","系统启动","127.0.0.1",L"OnLine")));
*/
/*
//建立一个内存数据库,存放当前登录信息
FDConn_Mem->Params->Add("DriverID=sqlite");
FDConn_Mem->Params->Add("Database=:memory:");
FDConn_Mem->Open();
String str = "CREATE TABLE Log(Id integer PRIMARY KEY AUTOINCREMENT,LogTime NVARCHAR(10),SessionId NVARCHAR(10),UserName NVARCHAR(10),ClientIP NVARCHAR(20),State NVARCHAR(10))";
FDConn_Mem->Execsql(str);
//记录当前登录信息
str = "INSERT INTO Log (LogTime,SessionId,UserName,ClientIP,State) VALUES('"
+ FormatDateTime("YYYY-MM-DD HH:mm:ss",Now())
+ "','"
+ "0" + "','"
+ "系统启动" + "','"
+ "127.0.0.1" + "','"
+ "OnLine"
+ "')";
FDConn_Mem->Execsql(str);
*/
/* if(!jh_ReportServer->FDMemTable1->Active)
jh_ReportServer->FDMemTable1->Open();
jh_ReportServer->FDMemTable1->AppendRecord(ARRAYOFCONST((FormatDateTime(L"yyyy-MM-dd HH:mm:ss",
Key,str,L"OnLine")));
*/
// if(FDMemTable1->Locate("SessionId",currSessionId,TLocateOptions()))
// FDMemTable1->Delete();