int sqlite3_open_v2( const char* filename, sqlite3** db_ref, int flags, const char* vfs );
filename
The path and filename of the database file as a UTF-8 encoded string.
db_ref
A reference to a database connection. If the database is successfully opened, the database connection will be passed back.
flags
A series of flags that can be used to control how the database file is open.
vfs
The name of the VFS (Virtual File System) module to use. A NULL will result in the default module.
An SQLite result code.
This function is very similar to sqlite3_open()
, but provides better control
over how the database file is opened. The flags
parameter controls the
state of the opened file, while the vfs
parameter allows the application to specify
a VFS (virtual file system) driver.
The flag parameter consists of several bit-flags that can be or’ed together. The application must specify one of the following flag combinations:
SQLITE_OPEN_READONLY
Open the file read-only. The file must already exist.
SQLITE_OPEN_READWRITE
Attempt to open the file read/write. If this is not possible, open the file read-only. Opening the file read-only will not result in an error. The file must already exist.
SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE
Attempt to open the file read/write. If it
does not exist, create the file. If the file does
exist, but permissions do not allow read/write
access, open the file read-only. Opening the file
read-only will not result in an error. This is the
behavior of sqlite3_open()
.
Additionally, these optional flags may be added to one of the above flag sets:
SQLITE_OPEN_NOMUTEX
If the SQLite library was compiled with
threading support, open the database connection
in “multithread”
mode. This flag cannot be used in conjunction with
the SQLITE_
OPEN_
FULL
MUTEX
flag.
SQLITE_OPEN_FULLMUTEX
If the SQLite library was compiled with
threading support, open the database connection
in “serialized” mode.
This flag cannot be used in conjunction with the
SQLITE_OPEN_NO
MUTEX
flag.
SQLITE_OPEN_SHAREDCACHE
Enables shared cache mode for this database
connection. This flag cannot be used in
conjunction with the SQLITE_OPEN_PRIVATECACHE
flag.
SQLITE_OPEN_PRIVATECACHE
Disables shared cache mode for this database
connection. This flag cannot be used in
conjunction with the SQLITE_OPEN_SHAREDCACHE
flag.
sqlite3_open() [Ap G], sqlite3_close() [Ap G], sqlite3_enable_shared_cache() [Ap G], sqlite3_config() [Ap G], sqlite3_vfs_find() [Ap G]