Fedora 31:
sudo dnf -y install sqlite-devel
Ubuntu 20.04:
sudo apt install -y libsqlite3-dev
Windows:
sqlite
subfolder inside v/thirdparty
fn connect(path string) ?DB
struct DB {
pub mut:
is_open bool
mut:
conn &C.sqlite3
}
fn (db DB) str() string
fn (mut db DB) close() ?bool
close Closes the DB. TODO: For all functions, determine whether the connection is closed first, and determine what to do if it is
fn (db DB) q_int(query string) int
Returns a single cell with value int.
fn (db DB) q_string(query string) string
Returns a single cell with value string.
fn (db DB) exec(query string) ([]Row, int)
Execute the query on db, return an array of all the results, alongside any result code. Result codes: https://www.sqlite.org/rescode.html
fn (db DB) exec_one(query string) ?Row
Execute a query, handle error code Return the first row from the resulting table
fn (db DB) exec_none(query string) int
In case you don't expect any result, but still want an error code e.g. INSERT INTO ... VALUES (...)
fn (db DB) insert<T>(x T)
struct Row {
pub mut:
vals []string
}