added amb739, SQL_ReadDriver()
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401300
This commit is contained in:
parent
0adbf810b8
commit
eedb308bab
@ -1236,6 +1236,24 @@ static cell_t SQL_IsSameConnection(IPluginContext *pContext, const cell_t *param
|
|||||||
return (db1 == db2) ? true : false;
|
return (db1 == db2) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t SQL_ReadDriver(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
IDatabase *db1=NULL;
|
||||||
|
HandleError err;
|
||||||
|
|
||||||
|
if ((err = g_DBMan.ReadHandle(params[1], DBHandle_Database, (void **)&db1))
|
||||||
|
!= HandleError_None)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid database Handle 1/%x (error: %d)", params[1], err);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDBDriver *driver = db1->GetDriver();
|
||||||
|
|
||||||
|
pContext->StringToLocalUTF8(params[2], params[3], driver->GetIdentifier(), NULL);
|
||||||
|
|
||||||
|
return driver->GetHandle();
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(dbNatives)
|
REGISTER_NATIVES(dbNatives)
|
||||||
{
|
{
|
||||||
{"SQL_BindParamInt", SQL_BindParamInt},
|
{"SQL_BindParamInt", SQL_BindParamInt},
|
||||||
@ -1269,6 +1287,7 @@ REGISTER_NATIVES(dbNatives)
|
|||||||
{"SQL_PrepareQuery", SQL_PrepareQuery},
|
{"SQL_PrepareQuery", SQL_PrepareQuery},
|
||||||
{"SQL_Query", SQL_Query},
|
{"SQL_Query", SQL_Query},
|
||||||
{"SQL_QuoteString", SQL_QuoteString},
|
{"SQL_QuoteString", SQL_QuoteString},
|
||||||
|
{"SQL_ReadDriver", SQL_ReadDriver},
|
||||||
{"SQL_Rewind", SQL_Rewind},
|
{"SQL_Rewind", SQL_Rewind},
|
||||||
{"SQL_TConnect", SQL_TConnect},
|
{"SQL_TConnect", SQL_TConnect},
|
||||||
{"SQL_TQuery", SQL_TQuery},
|
{"SQL_TQuery", SQL_TQuery},
|
||||||
|
@ -144,9 +144,21 @@ native Handle:SQL_ConnectEx(Handle:driver,
|
|||||||
*/
|
*/
|
||||||
native Handle:SQL_GetDriver(const String:name[]="");
|
native Handle:SQL_GetDriver(const String:name[]="");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the driver of an opened database.
|
||||||
|
*
|
||||||
|
* @param database Database Handle.
|
||||||
|
* @param ident Option buffer to store the identification string.
|
||||||
|
* @param ident_length Maximum length of the buffer.
|
||||||
|
* @return Driver Handle.
|
||||||
|
*/
|
||||||
|
native Handle:SQL_ReadDriver(Handle:database, String:ident[]="", ident_length=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a driver's identification string.
|
* Retrieves a driver's identification string.
|
||||||
*
|
*
|
||||||
|
* Example: "mysql", "sqlite"
|
||||||
|
*
|
||||||
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
||||||
* @param ident Identification string buffer.
|
* @param ident Identification string buffer.
|
||||||
* @param maxlength Maximum length of the buffer.
|
* @param maxlength Maximum length of the buffer.
|
||||||
@ -158,6 +170,8 @@ native SQL_GetDriverIdent(Handle:driver, String:ident[], maxlength);
|
|||||||
/**
|
/**
|
||||||
* Retrieves a driver's product string.
|
* Retrieves a driver's product string.
|
||||||
*
|
*
|
||||||
|
* Example: "MySQL", "SQLite"
|
||||||
|
*
|
||||||
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
||||||
* @param product Product string buffer.
|
* @param product Product string buffer.
|
||||||
* @param maxlength Maximum length of the buffer.
|
* @param maxlength Maximum length of the buffer.
|
||||||
|
Loading…
Reference in New Issue
Block a user