1.1 --- a/plugins/include/dbi.inc Fri Mar 28 06:21:34 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,604 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
1.8 - * =============================================================================
1.9 - *
1.10 - * This file is part of the SourceMod/SourcePawn SDK.
1.11 - *
1.12 - * This program is free software; you can redistribute it and/or modify it under
1.13 - * the terms of the GNU General Public License, version 3.0, as published by the
1.14 - * Free Software Foundation.
1.15 - *
1.16 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.17 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 - * details.
1.20 - *
1.21 - * You should have received a copy of the GNU General Public License along with
1.22 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.23 - *
1.24 - * As a special exception, AlliedModders LLC gives you permission to link the
1.25 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.26 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.27 - * by the Valve Corporation. You must obey the GNU General Public License in
1.28 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.29 - * this exception to all derivative works. AlliedModders LLC defines further
1.30 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.31 - * or <http://www.sourcemod.net/license.php>.
1.32 - *
1.33 - * Version: $Id$
1.34 - */
1.35 -
1.36 -#if defined _dbi_included
1.37 - #endinput
1.38 -#endif
1.39 -#define _dbi_included
1.40 -
1.41 -/**
1.42 - * @handle Driver
1.43 - *
1.44 - * Contains information about an SQL driver.
1.45 - */
1.46 -
1.47 -/**
1.48 - * @handle Database
1.49 - *
1.50 - * Contains information about a database connection.
1.51 - */
1.52 -
1.53 -/**
1.54 - * @handle Query
1.55 - *
1.56 - * Contains information about an active query and its
1.57 - * result sets.
1.58 - */
1.59 -
1.60 -/**
1.61 - * @handle Statement : Query
1.62 - *
1.63 - * Extends a Query Handle and can be used as a Query Handle.
1.64 - * Statement Handles are for prepared queries and contain
1.65 - * their own function for binding parameters. Statement
1.66 - * Handles can be used instead of database Handles in a few
1.67 - * select functions.
1.68 - */
1.69 -
1.70 -/**
1.71 - * Describes a database field fetch status.
1.72 - */
1.73 -enum DBResult
1.74 -{
1.75 - DBVal_Error = 0, /**< Column number/field is invalid. */
1.76 - DBVal_TypeMismatch = 1, /**< You cannot retrieve this data with this type. */
1.77 - DBVal_Null = 2, /**< Field has no data (NULL) */
1.78 - DBVal_Data = 3, /**< Field has data */
1.79 -};
1.80 -
1.81 -/**
1.82 - * Describes binding types.
1.83 - */
1.84 -enum DBBindType
1.85 -{
1.86 - DBBind_Int = 0, /**< Bind an integer. */
1.87 - DBBind_Float = 1, /**< Bind a float. */
1.88 - DBBind_String = 2, /**< Bind a string. */
1.89 -};
1.90 -
1.91 -/**
1.92 - * Threading priority level.
1.93 - */
1.94 -enum DBPriority
1.95 -{
1.96 - DBPrio_High = 0, /**< High priority. */
1.97 - DBPrio_Normal = 1, /**< Normal priority. */
1.98 - DBPrio_Low = 2, /**< Low priority. */
1.99 -};
1.100 -
1.101 -/**
1.102 - * Creates an SQL connection from a named configuration.
1.103 - *
1.104 - * @param confname Named configuration.
1.105 - * @param persistent True to re-use a previous persistent connection if
1.106 - * possible, false otherwise.
1.107 - * @param error Error buffer.
1.108 - * @param maxlength Maximum length of the error buffer.
1.109 - * @return A database connection Handle, or INVALID_HANDLE on failure.
1.110 - */
1.111 -native Handle:SQL_Connect(const String:confname[], bool:persistent, String:error[], maxlength);
1.112 -
1.113 -/**
1.114 - * Creates a default SQL connection.
1.115 - *
1.116 - * @param error Error buffer.
1.117 - * @param maxlength Maximum length of the error buffer.
1.118 - * @param persistent True to re-use a previous persistent connection
1.119 - * if possible, false otherwise.
1.120 - * @return A database connection Handle, or INVALID_HANDLE on failure.
1.121 - */
1.122 -stock Handle:SQL_DefConnect(String:error[], maxlength, bool:persistent=true)
1.123 -{
1.124 - return SQL_Connect("default", persistent, error, maxlength);
1.125 -}
1.126 -
1.127 -/**
1.128 - * Creates an SQL connection from specific parameters.
1.129 - *
1.130 - * @param driver Driver Handle, or INVALID_HANDLE for default.
1.131 - * @param host Host name.
1.132 - * @param user User name.
1.133 - * @param pass User password.
1.134 - * @param database Database name.
1.135 - * @param error Error buffer.
1.136 - * @param maxlength Maximum length of the error buffer.
1.137 - * @param persistent True to re-use a previous persistent connection
1.138 - * if possible, false otherwise.
1.139 - * @param port Optional port to specify.
1.140 - * @param maxTimeout Maximum timeout in seconds if applicable.
1.141 - * @return A database connection Handle, or INVALID_HANDLE on failure.
1.142 - * @error Invalid driver Handle other than INVALID_HANDLE.
1.143 - */
1.144 -native Handle:SQL_ConnectEx(Handle:driver,
1.145 - const String:host[],
1.146 - const String:user[],
1.147 - const String:pass[],
1.148 - const String:database[],
1.149 - String:error[],
1.150 - maxlength,
1.151 - bool:persistent=true,
1.152 - port=0,
1.153 - maxTimeout=0);
1.154 -
1.155 -/**
1.156 - * Returns if a named configuration is present in databases.cfg.
1.157 - *
1.158 - * @param name Configuration name.
1.159 - * @return True if it exists, false otherwise.
1.160 - */
1.161 -native bool:SQL_CheckConfig(const String:name[]);
1.162 -
1.163 -/**
1.164 - * Returns a driver Handle from a name string.
1.165 - *
1.166 - * If the driver is not found, SourceMod will attempt
1.167 - * to load an extension named dbi.<name>.ext.[dll|so].
1.168 - *
1.169 - * @param name Driver identification string, or an empty
1.170 - * string to return the default driver.
1.171 - * @return Driver Handle, or INVALID_HANDLE on failure.
1.172 - */
1.173 -native Handle:SQL_GetDriver(const String:name[]="");
1.174 -
1.175 -/**
1.176 - * Reads the driver of an opened database.
1.177 - *
1.178 - * @param database Database Handle.
1.179 - * @param ident Option buffer to store the identification string.
1.180 - * @param ident_length Maximum length of the buffer.
1.181 - * @return Driver Handle.
1.182 - */
1.183 -native Handle:SQL_ReadDriver(Handle:database, String:ident[]="", ident_length=0);
1.184 -
1.185 -/**
1.186 - * Retrieves a driver's identification string.
1.187 - *
1.188 - * Example: "mysql", "sqlite"
1.189 - *
1.190 - * @param driver Driver Handle, or INVALID_HANDLE for the default driver.
1.191 - * @param ident Identification string buffer.
1.192 - * @param maxlength Maximum length of the buffer.
1.193 - * @noreturn
1.194 - * @error Invalid Handle other than INVALID_HANDLE.
1.195 - */
1.196 -native SQL_GetDriverIdent(Handle:driver, String:ident[], maxlength);
1.197 -
1.198 -/**
1.199 - * Retrieves a driver's product string.
1.200 - *
1.201 - * Example: "MySQL", "SQLite"
1.202 - *
1.203 - * @param driver Driver Handle, or INVALID_HANDLE for the default driver.
1.204 - * @param product Product string buffer.
1.205 - * @param maxlength Maximum length of the buffer.
1.206 - * @noreturn
1.207 - * @error Invalid Handle other than INVALID_HANDLE.
1.208 - */
1.209 -native SQL_GetDriverProduct(Handle:driver, String:product[], maxlength);
1.210 -
1.211 -/**
1.212 - * Returns the number of affected rows from the last query.
1.213 - *
1.214 - * @param hndl A database OR statement Handle.
1.215 - * @return Number of rows affected by the last query.
1.216 - * @error Invalid database or statement Handle.
1.217 - */
1.218 -native SQL_GetAffectedRows(Handle:hndl);
1.219 -
1.220 -/**
1.221 - * Returns the last query's insertion id.
1.222 - *
1.223 - * @param hndl A database OR statement Handle.
1.224 - * @return Last query's insertion id.
1.225 - * @error Invalid database or statement Handle.
1.226 - */
1.227 -native SQL_GetInsertId(Handle:hndl);
1.228 -
1.229 -/**
1.230 - * Returns the error reported by the last query.
1.231 - *
1.232 - * @param hndl A database OR statement Handle.
1.233 - * @param error Error buffer.
1.234 - * @param maxlength Maximum length of the buffer.
1.235 - * @return True if there was an error, false otherwise.
1.236 - * @error Invalid database or statement Handle.
1.237 - */
1.238 -native bool:SQL_GetError(Handle:hndl, String:error[], maxlength);
1.239 -
1.240 -/**
1.241 - * Quotes a database string for literal insertion. This is not needed
1.242 - * for binding strings in prepared statements.
1.243 - *
1.244 - * @param hndl A database Handle.
1.245 - * @param string String to quote.
1.246 - * @param buffer Buffer to store quoted string in.
1.247 - * @param maxlength Maximum length of the buffer.
1.248 - * @param written Optionally returns the number of bytes written.
1.249 - * @return True on success, false if buffer is not big enough.
1.250 - * The buffer must be at least 2*strlen(string)+1.
1.251 - * @error Invalid database or statement Handle.
1.252 - */
1.253 -native bool:SQL_QuoteString(Handle:database, const String:string[], String:buffer[], maxlength, &written=0);
1.254 -
1.255 -/**
1.256 - * Executes a query and ignores the result set.
1.257 - *
1.258 - * @param database A database Handle.
1.259 - * @param query Query string.
1.260 - * @return True if query succeeded, false otherwise. Use
1.261 - * SQL_GetError to find the last error.
1.262 - * @error Invalid database Handle.
1.263 - */
1.264 -native bool:SQL_FastQuery(Handle:database, const String:query[]);
1.265 -
1.266 -/**
1.267 - * Executes a simple query and returns a new query Handle for
1.268 - * receiving the results.
1.269 - *
1.270 - * @param database A database Handle.
1.271 - * @param query Query string.
1.272 - * @return A new Query Handle on success, INVALID_HANDLE
1.273 - * otherwise. The Handle must be freed with CloseHandle().
1.274 - * @error Invalid database Handle.
1.275 - */
1.276 -native Handle:SQL_Query(Handle:database, const String:query[]);
1.277 -
1.278 -/**
1.279 - * Creates a new prepared statement query. Prepared statements can
1.280 - * be executed any number of times. They can also have placeholder
1.281 - * parameters, similar to variables, which can be bound safely and
1.282 - * securely (for example, you do not need to quote bound strings).
1.283 - *
1.284 - * Statement handles will work in any function that accepts a Query handle.
1.285 - *
1.286 - * @param database A database Handle.
1.287 - * @param query Query string.
1.288 - * @param error Error buffer.
1.289 - * @param maxlength Maximum size of the error buffer.
1.290 - * @return A new statement Handle on success, INVALID_HANDLE
1.291 - * otherwise. The Handle must be freed with CloseHandle().
1.292 - * @error Invalid database Handle.
1.293 - */
1.294 -native Handle:SQL_PrepareQuery(Handle:database, const String:query[], String:error[], maxlength);
1.295 -
1.296 -/**
1.297 - * Advances to the next set of results.
1.298 - *
1.299 - * In some SQL implementations, multiple result sets can exist on one query.
1.300 - * This is possible in MySQL with simple queries when executing a CALL
1.301 - * query. If this is the case, all result sets must be processed before
1.302 - * another query is made.
1.303 - *
1.304 - * @param query A query Handle.
1.305 - * @return True if there was another result set, false otherwise.
1.306 - * @error Invalid query Handle.
1.307 - */
1.308 -native bool:SQL_FetchMoreResults(Handle:query);
1.309 -
1.310 -/**
1.311 - * Returns whether or not a result set exists. This will
1.312 - * return true even if 0 results were returned, but false
1.313 - * on queries like UPDATE, INSERT, or DELETE.
1.314 - *
1.315 - * @param query A query (or statement) Handle.
1.316 - * @return True if there is a result set, false otherwise.
1.317 - * @error Invalid query Handle.
1.318 - */
1.319 -native bool:SQL_HasResultSet(Handle:query);
1.320 -
1.321 -/**
1.322 - * Retrieves the number of rows in the last result set.
1.323 - *
1.324 - * @param query A query (or statement) Handle.
1.325 - * @return Number of rows in the current result set.
1.326 - * @error Invalid query Handle.
1.327 - */
1.328 -native SQL_GetRowCount(Handle:query);
1.329 -
1.330 -/**
1.331 - * Retrieves the number of fields in the last result set.
1.332 - *
1.333 - * @param query A query (or statement) Handle.
1.334 - * @return Number of fields in the current result set.
1.335 - * @error Invalid query Handle.
1.336 - */
1.337 -native SQL_GetFieldCount(Handle:query);
1.338 -
1.339 -/**
1.340 - * Retrieves the name of a field by index.
1.341 - *
1.342 - * @param query A query (or statement) Handle.
1.343 - * @param field Field number (starting from 0).
1.344 - * @param name Name buffer.
1.345 - * @param maxlength Maximum length of the name buffer.
1.346 - * @noreturn
1.347 - * @error Invalid query Handle, invalid field index, or
1.348 - * no current result set.
1.349 - */
1.350 -native SQL_FieldNumToName(Handle:query, field, String:name[], maxlength);
1.351 -
1.352 -/**
1.353 - * Retrieves a field index by name.
1.354 - *
1.355 - * @param query A query (or statement) Handle.
1.356 - * @param name Name of the field (case sensitive).
1.357 - * @param field Variable to store field index in.
1.358 - * @return True if found, false if not found.
1.359 - * @error Invalid query Handle or no current result set.
1.360 - */
1.361 -native bool:SQL_FieldNameToNum(Handle:query, const String:name[], &field);
1.362 -
1.363 -/**
1.364 - * Fetches a row from the current result set. This must be
1.365 - * successfully called before any results are fetched.
1.366 - *
1.367 - * If this function fails, SQL_MoreResults() can be used to
1.368 - * tell if there was an error or the result set is finished.
1.369 - *
1.370 - * @param query A query (or statement) Handle.
1.371 - * @return True if a row was fetched, false otherwise.
1.372 - * @error Invalid query Handle.
1.373 - */
1.374 -native bool:SQL_FetchRow(Handle:query);
1.375 -
1.376 -/**
1.377 - * Returns if there are more rows.
1.378 - *
1.379 - * @param query A query (or statement) Handle.
1.380 - * @return True if there are more rows, false otherwise.
1.381 - * @error Invalid query Handle.
1.382 - */
1.383 -native bool:SQL_MoreRows(Handle:query);
1.384 -
1.385 -/**
1.386 - * Rewinds a result set back to the first result.
1.387 - *
1.388 - * @param query A query (or statement) Handle.
1.389 - * @return True on success, false otherwise.
1.390 - * @error Invalid query Handle or no current result set.
1.391 - */
1.392 -native bool:SQL_Rewind(Handle:query);
1.393 -
1.394 -/**
1.395 - * Fetches a string from a field in the current row of a result set.
1.396 - * If the result is NULL, an empty string will be returned. A NULL
1.397 - * check can be done with the result parameter, or SQL_IsFieldNull().
1.398 - *
1.399 - * @param query A query (or statement) Handle.
1.400 - * @param field The field index (starting from 0).
1.401 - * @param buffer String buffer.
1.402 - * @param maxlength Maximum size of the string buffer.
1.403 - * @param result Optional variable to store the status of the return value.
1.404 - * @return Number of bytes written.
1.405 - * @error Invalid query Handle or field index, invalid
1.406 - * type conversion requested from the database,
1.407 - * or no current result set.
1.408 - */
1.409 -native SQL_FetchString(Handle:query, field, String:buffer[], maxlength, &DBResult:result=DBVal_Error);
1.410 -
1.411 -/**
1.412 - * Fetches a float from a field in the current row of a result set.
1.413 - * If the result is NULL, a value of 0.0 will be returned. A NULL
1.414 - * check can be done with the result parameter, or SQL_IsFieldNull().
1.415 - *
1.416 - * @param query A query (or statement) Handle.
1.417 - * @param field The field index (starting from 0).
1.418 - * @param result Optional variable to store the status of the return value.
1.419 - * @return A float value.
1.420 - * @error Invalid query Handle or field index, invalid
1.421 - * type conversion requested from the database,
1.422 - * or no current result set.
1.423 - */
1.424 -native Float:SQL_FetchFloat(Handle:query, field, &DBResult:result=DBVal_Error);
1.425 -
1.426 -/**
1.427 - * Fetches an integer from a field in the current row of a result set.
1.428 - * If the result is NULL, a value of 0 will be returned. A NULL
1.429 - * check can be done with the result parameter, or SQL_IsFieldNull().
1.430 - *
1.431 - * @param query A query (or statement) Handle.
1.432 - * @param field The field index (starting from 0).
1.433 - * @param result Optional variable to store the status of the return value.
1.434 - * @return An integer value.
1.435 - * @error Invalid query Handle or field index, invalid
1.436 - * type conversion requested from the database,
1.437 - * or no current result set.
1.438 - */
1.439 -native SQL_FetchInt(Handle:query, field, &DBResult:result=DBVal_Error);
1.440 -
1.441 -/**
1.442 - * Returns whether a field's data in the current row of a result set is
1.443 - * NULL or not. NULL is an SQL type which means "no data."
1.444 - *
1.445 - * @param query A query (or statement) Handle.
1.446 - * @param field The field index (starting from 0).
1.447 - * @return True if data is NULL, false otherwise.
1.448 - * @error Invalid query Handle or field index, or no
1.449 - * current result set.
1.450 - */
1.451 -native bool:SQL_IsFieldNull(Handle:query, field);
1.452 -
1.453 -/**
1.454 - * Returns the length of a field's data in the current row of a result
1.455 - * set. This only needs to be called for strings to determine how many
1.456 - * bytes to use. Note that the return value does not include the null
1.457 - * terminator.
1.458 - *
1.459 - * @param query A query (or statement) Handle.
1.460 - * @param field The field index (starting from 0).
1.461 - * @return Number of bytes for the field's data size.
1.462 - * @error Invalid query Handle or field index or no
1.463 - * current result set.
1.464 - */
1.465 -native SQL_FetchSize(Handle:query, field);
1.466 -
1.467 -/**
1.468 - * Binds a parameter in a prepared statement to a given integer value.
1.469 - *
1.470 - * @param statement A statement (prepared query) Handle.
1.471 - * @param param The parameter index (starting from 0).
1.472 - * @param number The number to bind.
1.473 - * @param signed True to bind the number as signed, false to
1.474 - * bind it as unsigned.
1.475 - * @noreturn
1.476 - * @error Invalid statement Handle or parameter index, or
1.477 - * SQL error.
1.478 - */
1.479 -native SQL_BindParamInt(Handle:statement, param, number, bool:signed=true);
1.480 -
1.481 -/**
1.482 - * Binds a parameter in a prepared statement to a given float value.
1.483 - *
1.484 - * @param statement A statement (prepared query) Handle.
1.485 - * @param param The parameter index (starting from 0).
1.486 - * @param float The float number to bind.
1.487 - * @noreturn
1.488 - * @error Invalid statement Handle or parameter index, or
1.489 - * SQL error.
1.490 - */
1.491 -native SQL_BindParamFloat(Handle:statement, param, Float:value);
1.492 -
1.493 -/**
1.494 - * Binds a parameter in a prepared statement to a given string value.
1.495 - *
1.496 - * @param statement A statement (prepared query) Handle.
1.497 - * @param param The parameter index (starting from 0).
1.498 - * @param value The string to bind.
1.499 - * @param copy Whether or not SourceMod should copy the value
1.500 - * locally if necessary. If the string contents
1.501 - * won't change before calling SQL_Execute(), this
1.502 - * can be set to false for optimization.
1.503 - * @noreturn
1.504 - * @error Invalid statement Handle or parameter index, or
1.505 - * SQL error.
1.506 - */
1.507 -native SQL_BindParamString(Handle:statement, param, const String:value[], bool:copy);
1.508 -
1.509 -/**
1.510 - * Executes a prepared statement. All parameters must be bound beforehand.
1.511 - *
1.512 - * @param statement A statement (prepared query) Handle.
1.513 - * @return True on success, false on failure.
1.514 - * @error Invalid statement Handle.
1.515 - */
1.516 -native bool:SQL_Execute(Handle:statement);
1.517 -
1.518 -/**
1.519 - * Locks a database so threading operations will not interrupt.
1.520 - *
1.521 - * If you are using a database Handle for both threading and non-threading,
1.522 - * this MUST be called before doing any set of non-threading DB operations.
1.523 - * Otherwise you risk corrupting the database driver's memory or network
1.524 - * connection.
1.525 - *
1.526 - * Leaving a lock on a database and then executing a threaded query results
1.527 - * in a dead lock! Make sure to call SQL_UnlockDatabase()!
1.528 - *
1.529 - * If the lock cannot be acquired, the main thread will pause until the
1.530 - * threaded operation has concluded.
1.531 - *
1.532 - * @param database A database Handle.
1.533 - * @noreturn
1.534 - * @error Invalid database Handle.
1.535 - */
1.536 -native SQL_LockDatabase(Handle:database);
1.537 -
1.538 -/**
1.539 - * Unlocks a database so threading operations may continue.
1.540 - *
1.541 - * @param database A database Handle.
1.542 - * @noreturn
1.543 - * @error Invalid database Handle.
1.544 - */
1.545 -native SQL_UnlockDatabase(Handle:database);
1.546 -
1.547 -/**
1.548 - * General callback for threaded SQL stuff.
1.549 - *
1.550 - * @param db Parent object of the Handle (or INVALID_HANDLE if none).
1.551 - * @param hndl Handle to the child object (or INVALID_HANDLE if none).
1.552 - * @param error Error string if there was an error. The error could be
1.553 - * empty even if an error condition exists, so it is important
1.554 - * to check the actual Handle value instead.
1.555 - * @param data Data passed in via the original threaded invocation.
1.556 - * @param
1.557 - */
1.558 -functag SQLTCallback public(Handle:owner, Handle:hndl, const String:error[], any:data);
1.559 -
1.560 -/**
1.561 - * Tells whether two database handles both point to the same database
1.562 - * connection.
1.563 - *
1.564 - * @param hndl1 First database Handle.
1.565 - * @param hndl2 Second database Handle.
1.566 - * @return True if the Handles point to the same
1.567 - * connection, false otherwise.
1.568 - * @error Invalid Handle.
1.569 - */
1.570 -native bool:SQL_IsSameConnection(Handle:hndl1, Handle:hndl2);
1.571 -
1.572 -/**
1.573 - * Connects to a database via a thread. This can be used instead of
1.574 - * SQL_Connect() if you wish for non-blocking functionality.
1.575 - *
1.576 - * It is not necessary to use this to use threaded queries. However, if you
1.577 - * don't (or you mix threaded/non-threaded queries), you should see
1.578 - * SQL_LockDatabase().
1.579 - *
1.580 - * @param callback Callback; new Handle will be in hndl, owner is the driver.
1.581 - * If no driver was found, the owner is INVALID_HANDLE.
1.582 - * @param name Database name.
1.583 - * @noreturn
1.584 - */
1.585 -native SQL_TConnect(SQLTCallback:callback, const String:name[]="default", any:data=0);
1.586 -
1.587 -/**
1.588 - * Executes a simple query via a thread. The query Handle is passed through
1.589 - * the callback.
1.590 - *
1.591 - * The database Handle returned through the callback is always a new Handle,
1.592 - * and if necessary, SQL_IsSameConnection() should be used to test against
1.593 - * other conenctions.
1.594 - *
1.595 - * The query Handle returned through the callback is temporary and destroyed
1.596 - * at the end of the callback. If you need to hold onto it, use CloneHandle().
1.597 - *
1.598 - * @param database A database Handle.
1.599 - * @param callback Callback; database is in "owner" and the query Handle
1.600 - * is passed in "hndl".
1.601 - * @param query Query string.
1.602 - * @param data Extra data value to pass to the callback.
1.603 - * @param prio Priority queue to use.
1.604 - * @noreturn
1.605 - * @error Invalid database Handle.
1.606 - */
1.607 -native SQL_TQuery(Handle:database, SQLTCallback:callback, const String:query[], any:data=0, DBPriority:prio=DBPrio_Normal);