Initial implementation.
This commit is contained in:
@@ -694,3 +694,69 @@ native SQL_TConnect(SQLTCallback:callback, const String:name[]="default", any:da
|
||||
* @error Invalid database Handle.
|
||||
*/
|
||||
native SQL_TQuery(Handle:database, SQLTCallback:callback, const String:query[], any:data=0, DBPriority:prio=DBPrio_Normal);
|
||||
|
||||
/**
|
||||
* Creates a new transaction object. A transaction object is a list of queries
|
||||
* that can be sent to the database thread and executed as a single transaction.
|
||||
*
|
||||
* @return A transaction handle.
|
||||
*/
|
||||
native Handle:SQL_CreateTransaction();
|
||||
|
||||
/**
|
||||
* Adds a query to a transaction object.
|
||||
*
|
||||
* @param txn A transaction handle.
|
||||
* @param query Query string.
|
||||
* @param data Extra data value to pass to the final callback.
|
||||
* @return The index of the query in the transaction's query list.
|
||||
* @error Invalid transaction handle.
|
||||
*/
|
||||
native Handle:SQL_AddQuery(Handle:txn, const String:query[], any:data=0);
|
||||
|
||||
/**
|
||||
* 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().
|
||||
* @noreturn
|
||||
*/
|
||||
functag public SQLTxnSuccess(Handle:db, any:data, numQueries, Handle:results[], any:queryData[]);
|
||||
|
||||
/**
|
||||
* Callback for a failed transaction.
|
||||
*
|
||||
* @param db Database handle.
|
||||
* @param data Data value passed to SQL_ExecuteTransaction().
|
||||
* @param numQueries Number of queries executed in the transaction.
|
||||
* @param error Error message.
|
||||
* @param failIndex Index of the query that failed, or -1 if something else.
|
||||
* @param queryData An array of each data value passed to SQL_AddQuery().
|
||||
* @noreturn
|
||||
*/
|
||||
functag public SQLTxnFailure(Handle:db, any:data, numQueries, const String:error[], failIndex, any:queryData[]);
|
||||
|
||||
/**
|
||||
* Sends a transaction to the database thread. The transaction handle is
|
||||
* automatically closed. When the transaction completes, the optional
|
||||
* callback is invoked.
|
||||
*
|
||||
* @param db A database handle.
|
||||
* @param txn A transaction handle.
|
||||
* @param onSuccess An optional callback to receive a successful transaction.
|
||||
* @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(
|
||||
Handle:db,
|
||||
Handle:txn,
|
||||
SQLTxnSuccess:onSuccess=SQLTxnSuccess:-1,
|
||||
SQLTxnFailure:onError=SQLTxnFailure:-1,
|
||||
any:data=0,
|
||||
DBPriority:priority=DBPrio_Normal);
|
||||
|
||||
Reference in New Issue
Block a user