-initial import of database natives + config

-initial import of completed database layer
-CreateIdentity now requires a non-optional second pointer.  This breaks backwards compatibility for CreateIdentity(), however, this is not a function extension authors are supposed to be calling

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40874
This commit is contained in:
David Anderson
2007-06-01 02:30:29 +00:00
parent d461239e74
commit e334e5f7e7
14 changed files with 1684 additions and 25 deletions
+23 -4
View File
@@ -24,7 +24,7 @@
#include <string.h>
#define SMINTERFACE_DBI_NAME "IDBI"
#define SMINTERFACE_DBI_VERSION 1
#define SMINTERFACE_DBI_VERSION 2
namespace SourceMod
{
@@ -561,7 +561,8 @@ namespace SourceMod
virtual Handle_t GetHandle() =0;
/**
* @brief Returns the driver's controlling identity.
* @brief Returns the driver's controlling identity (must be the same
* as from IExtension::GetIdentity).
*
* @return An IdentityToken_t identity.
*/
@@ -601,7 +602,8 @@ namespace SourceMod
virtual void RemoveDriver(IDBDriver *pDriver) =0;
/**
* @brief Searches for database info by name.
* @brief Searches for database info by name. Both the return pointer
* and all pointers contained therein should be considered volatile.
*
* @param name Named database info.
* @return DatabaseInfo pointer.
@@ -648,7 +650,8 @@ namespace SourceMod
* @brief Creates a Handle_t of the IDBDriver type.
*
* @param type A DBHandleType value.
* @param ptr A pointer corrresponding to a DBHandleType object.
* @param ptr A pointer corrresponding to a DBHandleType
* object.
* @param token Identity pointer of the owning identity.
* @return A new Handle_t handle, or 0 on failure.
*/
@@ -673,6 +676,22 @@ namespace SourceMod
* @return HandleError value.
*/
virtual HandleError ReleaseHandle(Handle_t hndl, DBHandleType type, IdentityToken_t *token) =0;
/**
* @brief Given a driver name, attempts to find it. If it is not found, SourceMod
* will attempt to load it.
*
* @param name Driver identifier name.
* @return IDBDriver pointer on success, NULL otherwise.
*/
virtual IDBDriver *FindOrLoadDriver(const char *driver) =0;
/**
* @brief Returns the default driver, or NULL if none is set.
*
* @return IDBDriver pointer on success, NULL otherwise.
*/
virtual IDBDriver *GetDefaultDriver() =0;
};
}
+5 -5
View File
@@ -137,13 +137,14 @@ namespace SourceMod
virtual IdentityType_t FindIdentType(const char *name) =0;
/**
* @brief Creates a new identity token. This token is guaranteed to be unique
* amongst all other open identities.
* @brief Creates a new identity token. This token is guaranteed to be
* unique amongst all other open identities.
*
* @param type Identity type.
* @return A new IdentityToken_t identifier.
* @param ptr Private data pointer (cannot be NULL).
* @return A new IdentityToken_t pointer, or NULL on failure.
*/
virtual IdentityToken_t *CreateIdentity(IdentityType_t type) =0;
virtual IdentityToken_t *CreateIdentity(IdentityType_t type, void *ptr) =0;
/**
* @brief Destroys an identity type. Note that this will delete any identities
@@ -161,7 +162,6 @@ namespace SourceMod
*/
virtual void DestroyIdentity(IdentityToken_t *identity) =0;
/**
* @brief Requires an extension. This tells SourceMod that without this extension,
* your extension should not be loaded. The name should not include the ".dll" or