2014-08-04 10:29:31 +00:00
|
|
|
// 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
|
|
|
#ifndef _INCLUDE_AMXMODX_MYSQL2_HEADER_H
|
|
|
|
#define _INCLUDE_AMXMODX_MYSQL2_HEADER_H
|
|
|
|
|
|
|
|
#include "MysqlDriver.h"
|
|
|
|
#include "amxxmodule.h"
|
|
|
|
#include "ThreadSupport.h"
|
|
|
|
#include "ThreadWorker.h"
|
|
|
|
|
|
|
|
#define MYSQL2_THREADED
|
|
|
|
|
|
|
|
struct AmxQueryInfo
|
|
|
|
{
|
2006-10-01 19:46:56 +00:00
|
|
|
AmxQueryInfo() : opt_ptr(NULL) { };
|
2006-04-23 01:10:06 +00:00
|
|
|
IQuery *pQuery;
|
|
|
|
QueryInfo info;
|
|
|
|
char error[255];
|
2006-10-01 19:46:56 +00:00
|
|
|
char *opt_ptr;
|
2006-04-23 01:10:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum HandleType
|
|
|
|
{
|
|
|
|
Handle_Invalid = -1,
|
|
|
|
Handle_Connection = 0,
|
|
|
|
Handle_Database,
|
|
|
|
Handle_Query,
|
2006-04-24 10:27:25 +00:00
|
|
|
Handle_OldDb,
|
|
|
|
Handle_OldResult,
|
2006-04-23 01:10:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SQL_Connection
|
|
|
|
{
|
|
|
|
char *host;
|
|
|
|
char *user;
|
|
|
|
char *pass;
|
|
|
|
char *db;
|
|
|
|
int port;
|
2006-10-01 19:46:56 +00:00
|
|
|
unsigned int max_timeout;
|
2014-04-18 20:04:32 +00:00
|
|
|
char *charset;
|
2006-04-23 01:10:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*FREEHANDLE)(void *, unsigned int);
|
|
|
|
|
|
|
|
unsigned int MakeHandle(void *ptr, HandleType type, FREEHANDLE f);
|
|
|
|
void *GetHandle(unsigned int num, HandleType type);
|
|
|
|
bool FreeHandle(unsigned int num);
|
2006-04-24 10:27:25 +00:00
|
|
|
void FreeAllHandles(HandleType type);
|
|
|
|
void FreeHandleTable();
|
2006-05-07 21:40:12 +00:00
|
|
|
void ShutdownThreading();
|
2006-05-19 01:54:28 +00:00
|
|
|
int SetMysqlAffinity(AMX *amx);
|
2006-04-23 01:10:06 +00:00
|
|
|
|
|
|
|
extern AMX_NATIVE_INFO g_BaseSqlNatives[];
|
|
|
|
extern AMX_NATIVE_INFO g_ThreadSqlNatives[];
|
2006-04-24 10:27:25 +00:00
|
|
|
extern AMX_NATIVE_INFO g_OldCompatNatives[];
|
2006-04-23 01:10:06 +00:00
|
|
|
extern MainThreader g_Threader;
|
|
|
|
extern ThreadWorker *g_pWorker;
|
|
|
|
extern SourceMod::MysqlDriver g_Mysql;
|
|
|
|
|
|
|
|
#endif //_INCLUDE_AMXMODX_MYSQL2_HEADER_H
|