open_v2


Description:

public static int open_v2 (string filename, out Database db, int flags = OPEN_READWRITE | OPEN_CREATE, string? zVfs = null)

Example: Open a database, read-only:

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

// Open/Create a database:
int ec = Sqlite.Database.open_v2 ("test.db", out db, Sqlite.OPEN_READONLY);
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-db-read-only.vala



2022 vala-language.org