59 |
* The query must always be freed. |
* The query must always be freed. |
60 |
* This does not actually do the query! |
* This does not actually do the query! |
61 |
*/ |
*/ |
62 |
native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...); |
native Handle:SQL_PrepareQuery(Handle:db, const fmt[], any:...); |
63 |
|
|
64 |
|
|
65 |
|
/** |
66 |
|
* Back-quotes characters in a string for database querying. |
67 |
|
* Note: The buffer's maximum size should be 2*strlen(string) to catch |
68 |
|
* all scenarios. |
69 |
|
* |
70 |
|
* @param db Database handle, for localization. |
71 |
|
* @param buffer Buffer to copy to. |
72 |
|
* @param buflen Maximum size of the buffer. |
73 |
|
* @param string String to backquote (should not overlap buffer). |
74 |
|
* @return Length of new string, or -1 on failure. |
75 |
|
*/ |
76 |
|
native SQL_QuoteString(Handle:db, buffer[], buflen, const string[]); |
77 |
|
|
78 |
|
/** |
79 |
|
* Back-quotes characters in a string for database querying. |
80 |
|
* Note: The buffer's maximum size should be 2*strlen(string) to catch |
81 |
|
* all scenarios. |
82 |
|
* |
83 |
|
* @param db Database handle, for localization. |
84 |
|
* @param buffer Buffer to copy to. |
85 |
|
* @param buflen Maximum size of the buffer. |
86 |
|
* @param fmt Format of string to backquote (should not overlap buffer). |
87 |
|
* @param ... Format arguments. |
88 |
|
* @return Length of new string, or -1 on failure. |
89 |
|
*/ |
90 |
|
native SQL_QuoteStringFmt(Handle:db, buffer[], buflen, const fmt[], any:...); |
91 |
|
|
92 |
|
|
93 |
#define TQUERY_CONNECT_FAILED -2 |
#define TQUERY_CONNECT_FAILED -2 |
94 |
#define TQUERY_QUERY_FAILED -1 |
#define TQUERY_QUERY_FAILED -1 |
206 |
|
|
207 |
|
|
208 |
/** |
/** |
209 |
|
* Rewinds a result set to the first row. |
210 |
|
*/ |
211 |
|
native SQL_Rewind(Handle:query); |
212 |
|
|
213 |
|
|
214 |
|
/** |
215 |
* Returns the insert id of the last INSERT query. |
* Returns the insert id of the last INSERT query. |
216 |
* Returns 0 otherwise. |
* Returns 0 otherwise. |
217 |
*/ |
*/ |
248 |
native SQL_GetQueryString(Handle:query, buffer[], maxlength); |
native SQL_GetQueryString(Handle:query, buffer[], maxlength); |
249 |
|
|
250 |
/** |
/** |
251 |
|
* For queries which return multiple result sets, this advances to the next |
252 |
|
* result set if one is available. Otherwise, the current result set is |
253 |
|
* destroyed and will no longer be accessible. |
254 |
|
* |
255 |
|
* This function will always return false on SQLite, and when using threaded |
256 |
|
* queries in MySQL. Nonetheless, it has the same effect of removing the last |
257 |
|
* result set. |
258 |
|
* |
259 |
|
* @param query Query Handle. |
260 |
|
* @return True on success, false on failure. |
261 |
|
*/ |
262 |
|
native bool:SQL_NextResultSet(Handle:query); |
263 |
|
|
264 |
|
/** |
265 |
* This function can be used to find out if a table in a Sqlite database exists. |
* This function can be used to find out if a table in a Sqlite database exists. |
266 |
* (updated for newer API) |
* (updated for newer API) |
267 |
*/ |
*/ |
309 |
* Use this for executing a query where you don't care about the result. |
* Use this for executing a query where you don't care about the result. |
310 |
* Returns 0 on failure, 1 on success |
* Returns 0 on failure, 1 on success |
311 |
*/ |
*/ |
312 |
stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], ...) |
stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], any:...) |
313 |
{ |
{ |
314 |
static query_buf[2048]; |
static query_buf[2048]; |
315 |
vformat(query_buf, 2047, fmt, 6); |
vformat(query_buf, 2047, fmt, 6); |
334 |
* Use this for executing a query and not caring about the error. |
* Use this for executing a query and not caring about the error. |
335 |
* Returns -1 on error, >=0 on success (with number of affected rows) |
* Returns -1 on error, >=0 on success (with number of affected rows) |
336 |
*/ |
*/ |
337 |
stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], {Float,_}:...) |
stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], any:...) |
338 |
{ |
{ |
339 |
static query[4096]; |
static query[4096]; |
340 |
new Handle:hQuery; |
new Handle:hQuery; |
356 |
return ret; |
return ret; |
357 |
} |
} |
358 |
|
|
359 |
stock Handle:SQL_MakeStdTuple() |
stock Handle:SQL_MakeStdTuple(timeout = 0) |
360 |
{ |
{ |
361 |
static host[64], user[32], pass[32], db[128]; |
static host[64], user[32], pass[32], db[128]; |
362 |
static get_type[12], set_type[12]; |
static get_type[12], set_type[12]; |
377 |
} |
} |
378 |
} |
} |
379 |
|
|
380 |
return SQL_MakeDbTuple(host, user, pass, db); |
return SQL_MakeDbTuple(host, user, pass, db, timeout); |
381 |
} |
} |