Scripting/Squirrel/Functions/QuerySQL
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
This function will send a query to the database.
Syntax
QuerySQL(database, queryString);
Arguments
- SQLiteDB database - The database to query
- string queryString - The SQL query to send
Example
function onScriptLoad() {
db <- ConnectSQL("scripts/keybinds.db");
if (!db) {
print("ERROR: SQLite database file could not be opened");
}
QuerySQL(db, "CREATE TABLE IF NOT EXISTS players(name TEXT, password TEXT, " +
"level INTEGER, PRIMARY KEY(name,password));");
}
Notes
Calls onScriptLoad, ConnectSQL and print were used in this example. More info about them in the corresponding pages.