amxmodx/modules/mysqlx/module.cpp

65 lines
1.3 KiB
C++
Raw Permalink Normal View History

// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// MySQL Module
//
2006-04-23 01:10:06 +00:00
#include "amxxmodule.h"
#include "mysql2_header.h"
2006-05-19 01:54:28 +00:00
#include "sqlheaders.h"
2006-04-23 01:10:06 +00:00
2006-06-04 07:42:46 +00:00
static int g_ident = 0;
2006-05-07 21:40:12 +00:00
2006-05-19 01:54:28 +00: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-03 23:13:22 +00:00
return 1;
2006-05-19 01:54:28 +00:00
}
2006-04-23 01:10:06 +00:00
void OnAmxxAttach()
{
MF_AddNatives(g_BaseSqlNatives);
MF_AddNatives(g_ThreadSqlNatives);
2006-05-19 01:54:28 +00:00
g_MysqlFuncs.prev = (SqlFunctions *)MF_RegisterFunctionEx(&g_MysqlFuncs, SQL_DRIVER_FUNC);
2006-06-03 23:13:22 +00:00
if (!MF_RequestFunction("GetDbDriver")
&& !MF_FindLibrary("SQLITE", LibType_Library))
{
MF_AddNatives(g_OldCompatNatives);
2006-05-07 21:40:12 +00:00
MF_AddLibraries("dbi", LibType_Class, &g_ident);
}
}
2006-05-07 21:40:12 +00:00
void OnAmxxDetach()
{
ShutdownThreading();
MF_RemoveLibraries(&g_ident);
}
void OnPluginsUnloaded()
{
FreeAllHandles(Handle_OldResult);
FreeAllHandles(Handle_OldDb);
FreeAllHandles(Handle_Connection);
2006-04-23 01:10:06 +00:00
}
2006-04-24 15:14:34 +00:00
extern "C" void __cxa_pure_virtual(void)
{
}