66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
#include "precompile.h"
|
|
|
|
#include <a8/openssl.h>
|
|
|
|
#include "dbengine.h"
|
|
|
|
void DBEngine::Init()
|
|
{
|
|
f8::DBPool::Instance()->Init();
|
|
f8::DBPool::Instance()->SetThreadNum(16);
|
|
}
|
|
|
|
void DBEngine::UnInit()
|
|
{
|
|
f8::DBPool::Instance()->UnInit();
|
|
}
|
|
|
|
void DBEngine::ExecAsyncQuery(a8::XObject conn_info,
|
|
const char* querystr,
|
|
std::vector<a8::XValue> args,
|
|
a8::XParams param,
|
|
f8::AsyncDBOnOkFunc on_ok,
|
|
f8::AsyncDBOnErrorFunc on_error,
|
|
long long hash_code)
|
|
{
|
|
f8::DBPool::Instance()->ExecAsyncQuery(
|
|
conn_info,
|
|
querystr,
|
|
args,
|
|
param,
|
|
on_ok,
|
|
on_error,
|
|
hash_code
|
|
);
|
|
}
|
|
|
|
void DBEngine::ExecAsyncScript(a8::XObject conn_info,
|
|
const char* querystr,
|
|
std::vector<a8::XValue> args,
|
|
a8::XParams param,
|
|
f8::AsyncDBOnOkFunc on_ok,
|
|
f8::AsyncDBOnErrorFunc on_error,
|
|
long long hash_code)
|
|
{
|
|
f8::DBPool::Instance()->ExecAsyncScript(
|
|
conn_info,
|
|
querystr,
|
|
args,
|
|
param,
|
|
on_ok,
|
|
on_error,
|
|
hash_code
|
|
);
|
|
}
|
|
|
|
a8::XObject DBEngine::GetConnInfo(const std::string& data)
|
|
{
|
|
return GetConnInfo(a8::openssl::Crc32((unsigned char*)data.data(), data.size()));
|
|
}
|
|
|
|
a8::XObject DBEngine::GetConnInfo(long long data)
|
|
{
|
|
a8::XObject conn_info;
|
|
return conn_info;
|
|
}
|