-
-
Notifications
You must be signed in to change notification settings - Fork 5
Sqlite API
Nenkai edited this page Jul 14, 2024
·
3 revisions
Warning
GT6 and above.
var sqlite = pdistd::MSqlite();
sqlite.open(path);
// You can also use pdistd::MSqlite(path, buffer_size, flags, salsa_key); //
var res = SQLITE.execute0(sql); // No params
res = SQLITE.execute(sql, params); // With params - '?' characters are replaced with param names
if (res == SQLITE_OK)
{
// ...
}
// Example:
var rows = sqlite.executeQuery("SELECT * FROM COURSE ORDER BY ID");
foreach (var row in rows)
{
var [col1, col2, ...] = row;
}
// Query all values of 1 column
var column_values = sqlite.executeQuery1C(sql);
// Query one column of one row
var cell = sqlite.executeQuery1R1C(sql);
var row_count = sqlite.count(sql, params);
These return STRecord
var rows = sqlite.query(sql, params);
foreach (var row in res)
{
var col_value = row.col;
}
// List
var list = sqlite.queryList(sql, params);
// One row
var row = sqlite.query1(sql, params);
sqlite.begin();
// ...
sqlite.commit();
sqlite.executeTransaction(sql_query_array) // Array<String, Array<Object>>