amxmodx/dlls/mysqlx/module.cpp

49 lines
940 B
C++
Raw Normal View History

2006-04-23 05:10:06 +04:00
#include "amxxmodule.h"
#include "mysql2_header.h"
2006-05-19 05:54:28 +04:00
#include "sqlheaders.h"
2006-04-23 05:10:06 +04:00
2006-05-08 01:40:12 +04:00
static g_ident = 0;
2006-05-19 05:54:28 +04:00
SqlFunctions g_MysqlFuncs =
{
&g_Mysql,
SetMysqlAffinity,
NULL
};
int SetMysqlAffinity(AMX *amx)
{
MF_AmxReRegister(amx, g_BaseSqlNatives, -1);
MF_AmxReRegister(amx, g_ThreadSqlNatives, -1);
2006-06-04 03:13:22 +04:00
return 1;
2006-05-19 05:54:28 +04:00
}
2006-04-23 05:10:06 +04:00
void OnAmxxAttach()
{
MF_AddNatives(g_BaseSqlNatives);
MF_AddNatives(g_ThreadSqlNatives);
2006-05-19 05:54:28 +04:00
g_MysqlFuncs.prev = (SqlFunctions *)MF_RegisterFunctionEx(&g_MysqlFuncs, SQL_DRIVER_FUNC);
2006-06-04 03:13:22 +04:00
if (!MF_RequestFunction("GetDbDriver")
&& !MF_FindLibrary("SQLITE", LibType_Library)
&& !MF_FindLibrary("sqlitex", LibType_Library))
{
MF_AddNatives(g_OldCompatNatives);
2006-05-08 01:40:12 +04:00
MF_AddLibraries("dbi", LibType_Class, &g_ident);
}
}
2006-05-08 01:40:12 +04:00
void OnAmxxDetach()
{
ShutdownThreading();
MF_RemoveLibraries(&g_ident);
}
void OnPluginsUnloaded()
{
FreeAllHandles(Handle_OldResult);
FreeAllHandles(Handle_OldDb);
FreeAllHandles(Handle_Connection);
2006-04-23 05:10:06 +04:00
}
2006-04-24 19:14:34 +04:00