Scripting/Squirrel/Functions/SQLite/ConnectSQL
From VC-MP Wiki
This function connects to a local SQLite database or creates a new database.
Syntax
sqliteDB ConnectSQL( string filename )
Arguments
- filename - This is the filename of the previously saved database or filename for the new database
Example
For usage example, check the general SQLite database example from the wiki tutorials.
Example 2.
This example shows how to connect to a database with a single command. The command loads a previously saved database from 'database.db', or if the file doesn't exist, creates a new database.
function onConsoleInput( cmd, text ) { if ( cmd == "connectsql" ) { local db = ConnectSQL( "database.db" ); print( "Connecting to database..." ); } }
Notes
The call onConsoleInput was used in in this example. More info about it in corresponding page.
