Example: Open/Create a database

public static int main (string[] args) {
Sqlite.Database db;

// Open/Create a database:
int ec = Sqlite.Database.open ("test.db", out db);
if (ec != Sqlite.OK) {
stderr.printf ("Can't open database: %d: %s\n", db.errcode (), db.errmsg ());
return -1;
}

return 0;
}

 valac --pkg sqlite3 open-create-db.vala

See:




2022 vala-language.org