mirror of
https://github.com/allankoechke/SQLiteCpp.git
synced 2026-12-01 01:07:39 +00:00
std::string API (implementing issue #13
This commit is contained in:
@@ -33,6 +33,20 @@ 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)
|
||||
mpSQLite(NULL),
|
||||
mFilename(aFilename)
|
||||
{
|
||||
int ret = sqlite3_open_v2(aFilename.c_str(), &mpSQLite, aFlags, NULL);
|
||||
if (SQLITE_OK != ret)
|
||||
{
|
||||
std::string strerr = sqlite3_errmsg(mpSQLite);
|
||||
sqlite3_close(mpSQLite); // close is required even in case of error on opening
|
||||
throw SQLite::Exception(strerr);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the SQLite database connection.
|
||||
Database::~Database(void) throw() // nothrow
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user