Description

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_FULLMUTEX 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_NOMUTEX 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.

Additional flags may be added to future versions of SQLite.