SourceMod SDK  1.7
SourceMod::IDBManager Class Referenceabstract

Describes the DBI manager. More...

#include <public/IDBDriver.h>

Inheritance diagram for SourceMod::IDBManager:
SourceMod::SMInterface

Public Member Functions

virtual const char * GetInterfaceName ()=0
 Must return a string defining the interface's unique name.
 
virtual unsigned int GetInterfaceVersion ()=0
 Must return an integer defining the interface's version.
 
virtual void AddDriver (IDBDriver *pDriver)=0
 Adds a driver to the DBI system. Not thread safe. More...
 
virtual void RemoveDriver (IDBDriver *pDriver)=0
 Removes a driver from the DBI system. Not thread safe. More...
 
virtual const DatabaseInfoFindDatabaseConf (const char *name)=0
 Searches for database info by name. Both the return pointer and all pointers contained therein should be considered volatile. More...
 
virtual bool Connect (const char *name, IDBDriver **pdr, IDatabase **pdb, bool persistent, char *error, size_t maxlength)=0
 Tries to connect to a named database. Not thread safe. More...
 
virtual unsigned int GetDriverCount ()=0
 Returns the number of drivers loaded. Not thread safe. More...
 
virtual IDBDriverGetDriver (unsigned int index)=0
 Returns a driver by index. Not thread safe. More...
 
virtual Handle_t CreateHandle (DBHandleType type, void *ptr, IdentityToken_t *pToken)=0
 Creates a Handle_t of the IDBDriver type. Not thread safe. More...
 
virtual HandleError ReadHandle (Handle_t hndl, DBHandleType type, void **ptr)=0
 Reads an IDBDriver pointer from an IDBDriver handle. Not thread safe. More...
 
virtual HandleError ReleaseHandle (Handle_t hndl, DBHandleType type, IdentityToken_t *token)=0
 Releases an IDBDriver handle. More...
 
virtual IDBDriverFindOrLoadDriver (const char *driver)=0
 Given a driver name, attempts to find it. If it is not found, SourceMod will attempt to load it. This function is not thread safe. More...
 
virtual IDBDriverGetDefaultDriver ()=0
 Returns the default driver, or NULL if none is set. This function is not thread safe. More...
 
virtual bool AddToThreadQueue (IDBThreadOperation *op, PrioQueueLevel prio)=0
 Adds a threaded database operation to the priority queue. This function is not thread safe. More...
 
virtual void AddDependency (IExtension *myself, IDBDriver *driver)=0
 Adds a dependency from one extension to the owner of a driver. More...
 
- Public Member Functions inherited from SourceMod::SMInterface
virtual bool IsVersionCompatible (unsigned int version)
 Must return whether the requested version number is backwards compatible. Note: This can be overridden for breaking changes or custom versioning. More...
 

Detailed Description

Describes the DBI manager.

Member Function Documentation

virtual void SourceMod::IDBManager::AddDependency ( IExtension myself,
IDBDriver driver 
)
pure virtual

Adds a dependency from one extension to the owner of a driver.

Parameters
myselfExtension that is using the IDBDriver.
driverDriver that is being used.
virtual void SourceMod::IDBManager::AddDriver ( IDBDriver pDriver)
pure virtual

Adds a driver to the DBI system. Not thread safe.

Parameters
pDriverDatabase driver.
virtual bool SourceMod::IDBManager::AddToThreadQueue ( IDBThreadOperation op,
PrioQueueLevel  prio 
)
pure virtual

Adds a threaded database operation to the priority queue. This function is not thread safe.

Parameters
opInstance of an IDBThreadOperation.
prioPriority level to run at.
Returns
True on success, false on failure.
virtual bool SourceMod::IDBManager::Connect ( const char *  name,
IDBDriver **  pdr,
IDatabase **  pdb,
bool  persistent,
char *  error,
size_t  maxlength 
)
pure virtual

Tries to connect to a named database. Not thread safe.

Parameters
nameNamed database info.
pdrPointer to store the IDBDriver pointer in. If driver is not found, NULL will be stored.
pdbPointer to store the IDatabase pointer in. If connection fails, NULL will be stored.
persistentIf true, the dbmanager will attempt to PConnect instead of connect.
errorError buffer to store a driver's error message.
maxlengthMaximum length of the error buffer.
Returns
True on success, false otherwise.
virtual Handle_t SourceMod::IDBManager::CreateHandle ( DBHandleType  type,
void *  ptr,
IdentityToken_t *  pToken 
)
pure virtual

Creates a Handle_t of the IDBDriver type. Not thread safe.

Parameters
typeA DBHandleType value.
ptrA pointer corrresponding to a DBHandleType object.
pTokenIdentity pointer of the owning identity.
Returns
A new Handle_t handle, or 0 on failure.
virtual const DatabaseInfo* SourceMod::IDBManager::FindDatabaseConf ( const char *  name)
pure virtual

Searches for database info by name. Both the return pointer and all pointers contained therein should be considered volatile.

Parameters
nameNamed database info.
Returns
DatabaseInfo pointer.
virtual IDBDriver* SourceMod::IDBManager::FindOrLoadDriver ( const char *  driver)
pure virtual

Given a driver name, attempts to find it. If it is not found, SourceMod will attempt to load it. This function is not thread safe.

Parameters
driverDriver identifier name.
Returns
IDBDriver pointer on success, NULL otherwise.
virtual IDBDriver* SourceMod::IDBManager::GetDefaultDriver ( )
pure virtual

Returns the default driver, or NULL if none is set. This function is not thread safe.

Returns
IDBDriver pointer on success, NULL otherwise.
virtual IDBDriver* SourceMod::IDBManager::GetDriver ( unsigned int  index)
pure virtual

Returns a driver by index. Not thread safe.

Parameters
indexDriver index, starting from 0.
Returns
IDBDriver pointer for the given index.
virtual unsigned int SourceMod::IDBManager::GetDriverCount ( )
pure virtual

Returns the number of drivers loaded. Not thread safe.

Returns
Number of drivers loaded.
virtual HandleError SourceMod::IDBManager::ReadHandle ( Handle_t  hndl,
DBHandleType  type,
void **  ptr 
)
pure virtual

Reads an IDBDriver pointer from an IDBDriver handle. Not thread safe.

Parameters
hndlHandle_t handle to read.
typeA DBHandleType value.
ptrPointer to store the object pointer.
Returns
HandleError value.
virtual HandleError SourceMod::IDBManager::ReleaseHandle ( Handle_t  hndl,
DBHandleType  type,
IdentityToken_t *  token 
)
pure virtual

Releases an IDBDriver handle.

Parameters
hndlHandle_t handle to release.
typeA DBHandleType value.
tokenIdentity pointer of the owning identity.
Returns
HandleError value.
virtual void SourceMod::IDBManager::RemoveDriver ( IDBDriver pDriver)
pure virtual

Removes a driver from the DBI system. Not thread safe.

Parameters
pDriverDatabase driver.

The documentation for this class was generated from the following file: