fix for 45337 and some other little things

This commit is contained in:
David Anderson
2006-10-01 19:46:56 +00:00
parent f3057efd7d
commit fe1ebfe7bb
16 changed files with 141 additions and 47 deletions

View File

@@ -30,8 +30,12 @@ enum Handle
* !!NOTE!! I have seen most people think that this connects to the DB.
* Nowhere does it say this, and in fact it does not. It only caches
* the connection information, the host/user/pass/etc.
*
* The optional timeout parameter specifies how long connections should wait before
* giving up. If 0, the default (which is undefined) is used.
*
*/
native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[]);
native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[], timeout=0);
/**
@@ -74,8 +78,9 @@ native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...);
* @param errnum - An error code, if any.
* @param data - Data array you passed in.
* @param size - Size of the data array you passed in.
* @param queuetime - Amount of gametime that passed while the query was resolving.
*
* public QueryHandler(failstate, Handle:query, error[], errnum, data[], size)
* public QueryHandler(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
*
* Note! The handle you pass in is a DB Tuple, NOT an active connection!
* Note! The handle does not need to be freed.

View File

@@ -106,22 +106,22 @@ PrintQueryData(Handle:query)
/**
* Handler for when a threaded query is resolved.
*/
public GetMyStuff(failstate, Handle:query, error[], errnum, data[], size)
public GetMyStuff(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
{
server_print("Resolved query %d at: %f", data[0], get_gametime())
server_print(" --> Resolved query %d, took %f seconds", data[0], queuetime)
if (failstate)
{
if (failstate == TQUERY_CONNECT_FAILED)
{
server_print("Connection failed!")
server_print(" --> Connection failed!")
} else if (failstate == TQUERY_QUERY_FAILED) {
server_print("Query failed!")
server_print(" --> Query failed!")
}
server_print("Error code: %d (Message: ^"%s^")", errnum, error)
server_print(" --> Error code: %d (Message: ^"%s^")", errnum, error)
new querystring[1024]
SQL_GetQueryString(query, querystring, 1023)
server_print("Original query: %s", querystring)
server_print(" --> Original query: %s", querystring)
} else {
PrintQueryData(query)
}