3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_DATABASE_MANAGER_H_
16 #define _INCLUDE_DATABASE_MANAGER_H_
18 #include <IDBDriver.h>
19 #include <IHandleSys.h>
20 #include "sm_globals.h"
21 #include <sh_vector.h>
23 using namespace SourceHook;
28 IdentityToken_t *ident;
29 HandleType_t htDatabase;
37 public IHandleTypeDispatch
39 const char *GetInterfaceName();
40 unsigned int GetInterfaceVersion();
41 public: //SMGlobalClass
42 void OnSourceModAllInitialized();
43 public: //IHandleTypeDispatch
44 void OnHandleDestroy(HandleType_t type, void *object);
46 void AddDriver(IDBDriver *pDriver, IdentityToken_t *ident);
47 void RemoveDriver(IDBDriver *pDriver);
48 const DatabaseInfo *FindDatabaseConf(const char *name);
49 bool Connect(const char *name, IDBDriver **pdr, IDatabase **pdb, bool persistent);
50 unsigned int GetDriverCount();
51 IDBDriver *GetDriver(unsigned int index, IdentityToken_t **pToken=NULL);
53 db_driver *GetDriverInfo(unsigned int index);
55 CVector<db_driver *> m_drivers;
56 HandleType_t m_DriverType;
57 HandleType_t m_DatabaseType;
58 HandleType_t m_QueryType;
61 extern DBManager g_DBMan;
63 #endif //_INCLUDE_DATABASE_MANAGER_H_