整理初版
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "sqstdmath.h"
|
||||
#include "sqstdstring.h"
|
||||
#include "sqstdsystem.h"
|
||||
#include "CConnectPool.h"
|
||||
#include "croncpp.h"
|
||||
#include "l_socket.h"
|
||||
#include <openssl/md5.h>
|
||||
@@ -398,36 +397,6 @@ static SQInteger L_GetDataByIdFromPvf(HSQUIRRELVM v)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 创建数据库连接池
|
||||
static SQInteger L_CreatCConnectPool(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger MinConnectCount, MaxConnectCount, Port;
|
||||
const SQChar* Host;
|
||||
const SQChar* Account;
|
||||
const SQChar* Passwd;
|
||||
|
||||
sq_getinteger(v, 2, &MinConnectCount);
|
||||
sq_getinteger(v, 3, &MaxConnectCount);
|
||||
sq_getstring(v, 4, &Host);
|
||||
sq_getinteger(v, 5, &Port);
|
||||
sq_getstring(v, 6, &Account);
|
||||
sq_getstring(v, 7, &Passwd);
|
||||
|
||||
// 初始化数据库
|
||||
CConnectPool::CreatePool(MinConnectCount, MaxConnectCount, Host, Port, Account, Passwd);
|
||||
return 0;
|
||||
}
|
||||
// 阻塞线程的数据库操作 无返回值
|
||||
static SQInteger L_MysqlExecNoRet(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar* Sql;
|
||||
sq_getstring(v, 2, &Sql);
|
||||
|
||||
MYSQL* MysqlObject = CConnectPool::GetConnect();
|
||||
mysql_query(MysqlObject, Sql);
|
||||
CConnectPool::PutConnect(MysqlObject);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct CreateSocketInfo
|
||||
{
|
||||
@@ -1179,9 +1148,7 @@ static void RegisterGame(HSQUIRRELVM v)
|
||||
// 通过ID从Pvf中查询Data
|
||||
register_World_func(v, L_GetDataByIdFromPvf, _SC("Sq_GetDataByIdFromPvf"));
|
||||
// 创建数据库连接池
|
||||
register_World_func(v, L_CreatCConnectPool, _SC("Sq_CreatCConnectPool"));
|
||||
// 阻塞线程的数据库操作 无返回值
|
||||
register_World_func(v, L_MysqlExecNoRet, _SC("Sq_MysqlExecNoRet"));
|
||||
// 创建Socket连接
|
||||
register_World_func(v, L_CreatSocketConnect, _SC("Sq_CreatSocketConnect"));
|
||||
// 动态调用Call
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "sqstdmath.h"
|
||||
#include "sqstdstring.h"
|
||||
#include "sqstdsystem.h"
|
||||
#include "CConnectPool.h"
|
||||
#include "inline_hook.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
Reference in New Issue
Block a user