Public Member Functions

SourceMod::IDBManager Class Reference

Describes the DBI manager. More...

#include <public/IDBDriver.h>

Inherits SourceMod::SMInterface.

Collaboration diagram for SourceMod::IDBManager:
Collaboration graph
[legend]

List of all members.

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.
virtual void RemoveDriver (IDBDriver *pDriver)=0
 Removes a driver from the DBI system. Not thread safe.
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.
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.
virtual unsigned int GetDriverCount ()=0
 Returns the number of drivers loaded. Not thread safe.
virtual IDBDriverGetDriver (unsigned int index)=0
 Returns a driver by index. Not thread safe.
virtual Handle_t CreateHandle (DBHandleType type, void *ptr, IdentityToken_t *pToken)=0
 Creates a Handle_t of the IDBDriver type. Not thread safe.
virtual HandleError ReadHandle (Handle_t hndl, DBHandleType type, void **ptr)=0
 Reads an IDBDriver pointer from an IDBDriver handle. Not thread safe.
virtual HandleError ReleaseHandle (Handle_t hndl, DBHandleType type, IdentityToken_t *token)=0
 Releases an IDBDriver handle.
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.
virtual IDBDriverGetDefaultDriver ()=0
 Returns the default driver, or NULL if none is set. This function is not thread safe.
virtual bool AddToThreadQueue (IDBThreadOperation *op, PrioQueueLevel prio)=0
 Adds a threaded database operation to the priority queue. This function is not thread safe.
virtual void AddDependency (IExtension *myself, IDBDriver *driver)=0
 Adds a dependency from one extension to the owner of a driver.

Detailed Description

Describes the DBI manager.

Definition at line 774 of file IDBDriver.h.


Member Function Documentation

virtual void SourceMod::IDBManager::AddDriver ( IDBDriver pDriver  )  [pure virtual]

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

Parameters:
pDriver Database driver.
virtual void SourceMod::IDBManager::RemoveDriver ( IDBDriver pDriver  )  [pure virtual]

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

Parameters:
pDriver Database driver.
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:
name Named database info.
Returns:
DatabaseInfo pointer.
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:
name Named database info.
pdr Pointer to store the IDBDriver pointer in. If driver is not found, NULL will be stored.
pdb Pointer to store the IDatabase pointer in. If connection fails, NULL will be stored.
persistent If true, the dbmanager will attempt to PConnect instead of connect.
error Error buffer to store a driver's error message.
maxlength Maximum length of the error buffer.
Returns:
True on success, false otherwise.
virtual unsigned int SourceMod::IDBManager::GetDriverCount (  )  [pure virtual]

Returns the number of drivers loaded. Not thread safe.

Returns:
Number of drivers loaded.
virtual IDBDriver* SourceMod::IDBManager::GetDriver ( unsigned int  index  )  [pure virtual]

Returns a driver by index. Not thread safe.

Parameters:
index Driver index, starting from 0.
Returns:
IDBDriver pointer for the given index.
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:
type A DBHandleType value.
ptr A pointer corrresponding to a DBHandleType object.
pToken Identity pointer of the owning identity.
Returns:
A new Handle_t handle, or 0 on failure.
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:
hndl Handle_t handle to read.
type A DBHandleType value.
ptr Pointer 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:
hndl Handle_t handle to release.
type A DBHandleType value.
token Identity pointer of the owning identity.
Returns:
HandleError value.
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:
driver Driver 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 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:
op Instance of an IDBThreadOperation.
prio Priority level to run at.
Returns:
True on success, false on failure.
virtual void SourceMod::IDBManager::AddDependency ( IExtension myself,
IDBDriver driver 
) [pure virtual]

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

Parameters:
myself Extension that is using the IDBDriver.
driver Driver that is being used.

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