querythread.cpp
来自「著名的SecureBlackBox控件完整源码」· C++ 代码 · 共 48 行
CPP
48 行
//---------------------------------------------------------------------------
#pragma hdrstop
#include "QueryThread.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
TQueryThread::TQueryThread(const AnsiString DBName, AnsiString Username, AnsiString Password, AnsiString Query)
: TThread(true)
{
FSQLConnection = new TSQLConnection(NULL);
FSQLDataSet = new TSQLDataSet(NULL);
FSQLConnection->DriverName = "MySQL";
FSQLConnection->LibraryName = "dbexpmysql.dll";
FSQLConnection->VendorLib = "LIBMYSQL.dll";
FSQLDataSet->SQLConnection = FSQLConnection;
FSQLConnection->Params->Values["User_Name"] = Username;
FSQLConnection->Params->Values["Password"] = Password;
FSQLConnection->Params->Values["Database"] = DBName;
FSQLConnection->Params->Values["HostName"] = "127.0.0.1";
FSQLConnection->Params->Values["DriverName"] = "MySQL";
FSQLConnection->Params->Values["BlobSize"] = "-1";
FSQLConnection->Params->Values["LocaleCode"] = "0001";
FSQLConnection->LoginPrompt = false;
FSQLConnection->GetDriverFunc = "getSQLDriverMYSQL";
FSQLDataSet->CommandText = Query;
FRowCount = 0;
}
//---------------------------------------------------------------------------
__fastcall TQueryThread::~TQueryThread()
{
delete FSQLConnection;
delete FSQLDataSet;
}
//---------------------------------------------------------------------------
void __fastcall TQueryThread::Execute(void)
{
FSQLDataSet->Active = true;
FRowCount = FSQLDataSet->RecordCount;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?