Updated includes and spcomp to SourceMod 1.9
This commit is contained in:
Vendored
+51
-44
@@ -223,7 +223,7 @@ methodmap DBResultSet < Handle
|
||||
// @param field The field index (starting from 0).
|
||||
// @return True if data is NULL, false otherwise.
|
||||
// @error Invalid field index, or no current result set.
|
||||
public native bool IsFieldNull(Handle query, int field);
|
||||
public native bool IsFieldNull(int field);
|
||||
|
||||
// Returns the length of a field's data in the current row of a result
|
||||
// set. This only needs to be called for strings to determine how many
|
||||
@@ -236,14 +236,26 @@ methodmap DBResultSet < Handle
|
||||
public native int FetchSize(int field);
|
||||
};
|
||||
|
||||
// Callback for a successful transaction.
|
||||
//
|
||||
// @param db Database handle.
|
||||
// @param data Data value passed to SQL_ExecuteTransaction().
|
||||
// @param numQueries Number of queries executed in the transaction.
|
||||
// @param results An array of Query handle results, one for each of numQueries. They are closed automatically.
|
||||
// @param queryData An array of each data value passed to SQL_AddQuery().
|
||||
typedef SQLTxnSuccess = function void (Database db, any data, int numQueries, Handle[] results, any[] queryData);
|
||||
typeset SQLTxnSuccess
|
||||
{
|
||||
// Callback for a successful transaction.
|
||||
//
|
||||
// @param db Database handle.
|
||||
// @param data Data value passed to SQL_ExecuteTransaction().
|
||||
// @param numQueries Number of queries executed in the transaction.
|
||||
// @param results An array of Query handle results, one for each of numQueries. They are closed automatically.
|
||||
// @param queryData An array of each data value passed to SQL_AddQuery().
|
||||
function void (Database db, any data, int numQueries, Handle[] results, any[] queryData);
|
||||
|
||||
// Callback for a successful transaction.
|
||||
//
|
||||
// @param db Database handle.
|
||||
// @param data Data value passed to SQL_ExecuteTransaction().
|
||||
// @param numQueries Number of queries executed in the transaction.
|
||||
// @param results An array of DBResultSet results, one for each of numQueries. They are closed automatically.
|
||||
// @param queryData An array of each data value passed to SQL_AddQuery().
|
||||
function void (Database db, any data, int numQueries, DBResultSet[] results, any[] queryData);
|
||||
}
|
||||
|
||||
// Callback for a failed transaction.
|
||||
//
|
||||
@@ -376,7 +388,7 @@ methodmap Database < Handle
|
||||
//
|
||||
// The database handle returned through the callback is always a new Handle,
|
||||
// and if necessary, IsSameConnection() should be used to test against other
|
||||
// conenctions.
|
||||
// connections.
|
||||
//
|
||||
// The result handle returned through the callback is temporary and destroyed
|
||||
// at the end of the callback.
|
||||
@@ -399,8 +411,8 @@ methodmap Database < Handle
|
||||
// @param data An optional value to pass to callbacks.
|
||||
// @param prio Priority queue to use.
|
||||
public native void Execute(Transaction txn,
|
||||
SQLTxnSuccess:onSuccess = INVALID_FUNCTION,
|
||||
SQLTxnFailure:onError = INVALID_FUNCTION,
|
||||
SQLTxnSuccess onSuccess = INVALID_FUNCTION,
|
||||
SQLTxnFailure onError = INVALID_FUNCTION,
|
||||
any data = 0,
|
||||
DBPriority priority = DBPrio_Normal);
|
||||
};
|
||||
@@ -436,7 +448,7 @@ stock Database SQL_DefConnect(char[] error, int maxlength, bool persistent=true)
|
||||
* Connects to a database using key value pairs containing the database info.
|
||||
* The key/value pairs should match what would be in databases.cfg.
|
||||
*
|
||||
* I.e. "driver" should be "default" or a driver name (or ommitted for
|
||||
* I.e. "driver" should be "default" or a driver name (or omitted for
|
||||
* the default). For SQLite, only the "database" parameter is needed in addition.
|
||||
* For drivers which require external connections, more of the parameters may be
|
||||
* needed.
|
||||
@@ -455,7 +467,7 @@ stock Database SQL_DefConnect(char[] error, int maxlength, bool persistent=true)
|
||||
*/
|
||||
native Database SQL_ConnectCustom(Handle keyvalues,
|
||||
char[] error,
|
||||
maxlength,
|
||||
int maxlength,
|
||||
bool persistent);
|
||||
|
||||
/**
|
||||
@@ -475,17 +487,15 @@ native Database SQL_ConnectCustom(Handle keyvalues,
|
||||
*/
|
||||
stock Database SQLite_UseDatabase(const char[] database,
|
||||
char[] error,
|
||||
maxlength)
|
||||
int maxlength)
|
||||
{
|
||||
Handle kv, db;
|
||||
KeyValues kv = new KeyValues("");
|
||||
kv.SetString("driver", "sqlite");
|
||||
kv.SetString("database", database);
|
||||
|
||||
kv = CreateKeyValues("");
|
||||
KvSetString(kv, "driver", "sqlite");
|
||||
KvSetString(kv, "database", database);
|
||||
Database db = SQL_ConnectCustom(kv, error, maxlength, false);
|
||||
|
||||
db = SQL_ConnectCustom(kv, error, maxlength, false);
|
||||
|
||||
CloseHandle(kv);
|
||||
delete kv;
|
||||
|
||||
return db;
|
||||
}
|
||||
@@ -495,15 +505,15 @@ stock Database SQLite_UseDatabase(const char[] database,
|
||||
*/
|
||||
#pragma deprecated Use SQL_ConnectCustom instead.
|
||||
native Handle SQL_ConnectEx(Handle driver,
|
||||
const String:host[],
|
||||
const String:user[],
|
||||
const String:pass[],
|
||||
const String:database[],
|
||||
const char[] host,
|
||||
const char[] user,
|
||||
const char[] pass,
|
||||
const char[] database,
|
||||
char[] error,
|
||||
maxlength,
|
||||
int maxlength,
|
||||
bool persistent=true,
|
||||
port=0,
|
||||
maxTimeout=0);
|
||||
int port=0,
|
||||
int maxTimeout=0);
|
||||
|
||||
/**
|
||||
* Returns if a named configuration is present in databases.cfg.
|
||||
@@ -533,7 +543,7 @@ native Handle SQL_GetDriver(const char[] name="");
|
||||
* @param ident_length Maximum length of the buffer.
|
||||
* @return Driver Handle.
|
||||
*/
|
||||
native Handle SQL_ReadDriver(Handle database, char[] ident="", ident_length=0);
|
||||
native Handle SQL_ReadDriver(Handle database, char[] ident="", int ident_length=0);
|
||||
|
||||
/**
|
||||
* Retrieves a driver's identification string.
|
||||
@@ -543,7 +553,6 @@ native Handle SQL_ReadDriver(Handle database, char[] ident="", ident_length=0);
|
||||
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
||||
* @param ident Identification string buffer.
|
||||
* @param maxlength Maximum length of the buffer.
|
||||
* @noreturn
|
||||
* @error Invalid Handle other than INVALID_HANDLE.
|
||||
*/
|
||||
native void SQL_GetDriverIdent(Handle driver, char[] ident, int maxlength);
|
||||
@@ -556,7 +565,6 @@ native void SQL_GetDriverIdent(Handle driver, char[] ident, int maxlength);
|
||||
* @param driver Driver Handle, or INVALID_HANDLE for the default driver.
|
||||
* @param product Product string buffer.
|
||||
* @param maxlength Maximum length of the buffer.
|
||||
* @noreturn
|
||||
* @error Invalid Handle other than INVALID_HANDLE.
|
||||
*/
|
||||
native void SQL_GetDriverProduct(Handle driver, char[] product, int maxlength);
|
||||
@@ -638,8 +646,8 @@ native bool SQL_EscapeString(Handle database,
|
||||
stock bool SQL_QuoteString(Handle database,
|
||||
const char[] string,
|
||||
char[] buffer,
|
||||
maxlength,
|
||||
&written=0)
|
||||
int maxlength,
|
||||
int &written=0)
|
||||
{
|
||||
return SQL_EscapeString(database, string, buffer, maxlength, written);
|
||||
}
|
||||
@@ -744,7 +752,7 @@ native int SQL_GetFieldCount(Handle query);
|
||||
* @error Invalid query Handle, invalid field index, or
|
||||
* no current result set.
|
||||
*/
|
||||
native void SQL_FieldNumToName(Handle query, int field, String:name[], int maxlength);
|
||||
native void SQL_FieldNumToName(Handle query, int field, char[] name, int maxlength);
|
||||
|
||||
/**
|
||||
* Retrieves a field index by name.
|
||||
@@ -755,7 +763,7 @@ native void SQL_FieldNumToName(Handle query, int field, String:name[], int maxle
|
||||
* @return True if found, false if not found.
|
||||
* @error Invalid query Handle or no current result set.
|
||||
*/
|
||||
native bool SQL_FieldNameToNum(Handle query, const char[] name, &field);
|
||||
native bool SQL_FieldNameToNum(Handle query, const char[] name, int &field);
|
||||
|
||||
/**
|
||||
* Fetches a row from the current result set. This must be
|
||||
@@ -803,7 +811,7 @@ native bool SQL_Rewind(Handle query);
|
||||
* type conversion requested from the database,
|
||||
* or no current result set.
|
||||
*/
|
||||
native int SQL_FetchString(Handle query, int field, char[] buffer, int maxlength, DBResult &result=DBVal_Error);
|
||||
native int SQL_FetchString(Handle query, int field, char[] buffer, int maxlength, DBResult &result=DBVal_Error);
|
||||
|
||||
/**
|
||||
* Fetches a float from a field in the current row of a result set.
|
||||
@@ -979,7 +987,7 @@ native void SQL_TConnect(SQLTCallback callback, const char[] name="default", any
|
||||
*
|
||||
* The database Handle returned through the callback is always a new Handle,
|
||||
* and if necessary, SQL_IsSameConnection() should be used to test against
|
||||
* other conenctions.
|
||||
* other connections.
|
||||
*
|
||||
* The query Handle returned through the callback is temporary and destroyed
|
||||
* at the end of the callback. If you need to hold onto it, use CloneHandle().
|
||||
@@ -1024,13 +1032,12 @@ native int SQL_AddQuery(Transaction txn, const char[] query, any data=0);
|
||||
* @param onError An optional callback to receive an error message.
|
||||
* @param data An optional value to pass to callbacks.
|
||||
* @param prio Priority queue to use.
|
||||
* @noreturn
|
||||
* @error An invalid handle.
|
||||
*/
|
||||
native SQL_ExecuteTransaction(
|
||||
native void SQL_ExecuteTransaction(
|
||||
Handle db,
|
||||
Transaction:txn,
|
||||
SQLTxnSuccess:onSuccess = INVALID_FUNCTION,
|
||||
SQLTxnFailure:onError = INVALID_FUNCTION,
|
||||
Transaction txn,
|
||||
SQLTxnSuccess onSuccess = INVALID_FUNCTION,
|
||||
SQLTxnFailure onError = INVALID_FUNCTION,
|
||||
any data=0,
|
||||
DBPriority:priority=DBPrio_Normal);
|
||||
DBPriority priority=DBPrio_Normal);
|
||||
|
||||
Reference in New Issue
Block a user