mirror of
https://github.com/allankoechke/SQLiteCpp.git
synced 2026-12-02 17:11:59 +00:00
Support opening a database with a custom VFS.
This commit is contained in:
@@ -23,11 +23,11 @@ namespace SQLite
|
||||
|
||||
|
||||
// Open the provided database UTF-8 filename with SQLITE_OPEN_xxx provided flags.
|
||||
Database::Database(const char* apFilename, const int aFlags /*= SQLITE_OPEN_READONLY*/) : // throw(SQLite::Exception)
|
||||
Database::Database(const char* apFilename, const int aFlags /*= SQLITE_OPEN_READONLY*/, const char* apVfs /*= NULL*/) : // throw(SQLite::Exception)
|
||||
mpSQLite(NULL),
|
||||
mFilename(apFilename)
|
||||
{
|
||||
int ret = sqlite3_open_v2(apFilename, &mpSQLite, aFlags, NULL);
|
||||
int ret = sqlite3_open_v2(apFilename, &mpSQLite, aFlags, apVfs);
|
||||
if (SQLITE_OK != ret)
|
||||
{
|
||||
std::string strerr = sqlite3_errmsg(mpSQLite);
|
||||
@@ -37,11 +37,11 @@ Database::Database(const char* apFilename, const int aFlags /*= SQLITE_OPEN_READ
|
||||
}
|
||||
|
||||
// Open the provided database UTF-8 filename with SQLITE_OPEN_xxx provided flags.
|
||||
Database::Database(const std::string& aFilename, const int aFlags /*= SQLITE_OPEN_READONLY*/) : // throw(SQLite::Exception)
|
||||
Database::Database(const std::string& aFilename, const int aFlags /*= SQLITE_OPEN_READONLY*/, const std::string& aVfs /*= ""*/) : // throw(SQLite::Exception)
|
||||
mpSQLite(NULL),
|
||||
mFilename(aFilename)
|
||||
{
|
||||
int ret = sqlite3_open_v2(aFilename.c_str(), &mpSQLite, aFlags, NULL);
|
||||
int ret = sqlite3_open_v2(aFilename.c_str(), &mpSQLite, aFlags, aVfs.empty() ? NULL : aVfs.c_str());
|
||||
if (SQLITE_OK != ret)
|
||||
{
|
||||
std::string strerr = sqlite3_errmsg(mpSQLite);
|
||||
|
||||
Reference in New Issue
Block a user