sqlite_free
From Liberty Unleashed Wiki
Note: This function requires the external module lu_sqlite.
This function frees a previously used query struct. This function should always be used after the query result has been processed to avoid any memory leaks.
Syntax
bool sqlite_free( UserPointer result )
Arguments
- result - This is a pointer to a result struct retrieved from sqlite_query or sqlite_next_row
Example
This will free the carried out query from the memory when 'free' is type into the server console.
function onScriptLoad() { LoadModule( "lu_sqlite" ); pSQDatabase <- sqlite_open( "database.sqlite" ); return 1; } function onConsoleInput( szCommand, szText ) { if ( szCommand == "free" ) { local query = sqlite_query( pSQDatabase, "SELECT Foo FROM Bar WHERE FooBar='" + szText + "'" ); sqlite_free( query ); } return 1; }
Notes
The function LoadModule and sqlite_open and sqlite_query and event onScriptLoad and onConsoleInput were used in this example. More info about them in the corresponding pages.
For a larger example, check the SQLite database example from the wiki tutorials.
Related Functions
These functions are provided by the official module lu_sqlite.