lib/sqlite/Database: wrapper for sqlite3*
This commit is contained in:
@@ -82,21 +82,12 @@ static const char sticker_sql_create[] =
|
||||
"";
|
||||
|
||||
StickerDatabase::StickerDatabase(Path path)
|
||||
:db(path.c_str())
|
||||
{
|
||||
assert(!path.IsNull());
|
||||
|
||||
int ret;
|
||||
|
||||
/* open/create the sqlite database */
|
||||
|
||||
ret = sqlite3_open(path.c_str(), &db);
|
||||
if (ret != SQLITE_OK) {
|
||||
const std::string utf8 = path.ToUTF8();
|
||||
throw SqliteError(db, ret,
|
||||
("Failed to open sqlite database '" +
|
||||
utf8 + "'").c_str());
|
||||
}
|
||||
|
||||
/* create the table and index */
|
||||
|
||||
ret = sqlite3_exec(db, sticker_sql_create,
|
||||
@@ -123,8 +114,6 @@ StickerDatabase::~StickerDatabase() noexcept
|
||||
|
||||
sqlite3_finalize(stmt[i]);
|
||||
}
|
||||
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
std::string
|
||||
|
Reference in New Issue
Block a user