Db free result
From SA-MP Wiki
(Difference between revisions)
| Revision as of 13:29, 15 February 2011 Lenny (Talk | contribs) (typeo) ← Previous diff |
Current revision ZeeX (Talk | contribs) |
||
| Line 7: | Line 7: | ||
| {{Param|DBResult:dbresult|The result to free}} | {{Param|DBResult:dbresult|The result to free}} | ||
| - | {{NoReturn}} | + | {{Return|Returns 0 if dbresult is null and 1 otherwise.}} |
| <pawn> | <pawn> | ||
Current revision
Free result memory from a db_query
(DBResult:dbresult)
| DBResult:dbresult | The result to free |
| Returns | Returns 0 if dbresult is null and 1 otherwise. |
public OnPlayerText(playerid, text[]) { new query[256]; format(query, sizeof(query), "INSERT INTO chat VALUES ('%d','%s')",playerid,text); db_free_result(db_query(CHATDB,query)); //Note this is a really bad idea to use this code, as it would be easy to inject SQL code into. return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- db_open: Open an SQLite database
- db_close: Close an SQLite database
- db_query: Query an SQLite database
- db_free_result: Free result memory from a query
- db_num_rows: Get number of rows in result
- db_next_row: Move to the next row
- db_num_fields: Get number of fields in result
- db_field_name: Returns the name of a particular field
- db_get_field: Get content of field with specified ID from current result row
- db_get_field_assoc: Get content of field with specified name from current result row
