|
@@ -1,7 +1,10 @@
|
|
#include "database.h"
|
|
#include "database.h"
|
|
#include "binarydata.h"
|
|
#include "binarydata.h"
|
|
#include "subfiledata.h"
|
|
#include "subfiledata.h"
|
|
-#include "EasyLogging++/easylogging++.h"
|
|
|
|
|
|
+
|
|
|
|
+#include <EasyLogging++/easylogging++.h>
|
|
|
|
+#include <SQLite/sqlite3.h>
|
|
|
|
+#include <yaml-cpp/yaml.h>
|
|
|
|
|
|
|
|
|
|
namespace LOTRO_DAT {
|
|
namespace LOTRO_DAT {
|
|
@@ -11,17 +14,19 @@ Database::Database() {
|
|
}
|
|
}
|
|
|
|
|
|
bool Database::CloseDatabase() {
|
|
bool Database::CloseDatabase() {
|
|
|
|
+ if (db_ == nullptr) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
LOG(DEBUG) << "Closing database.";
|
|
LOG(DEBUG) << "Closing database.";
|
|
|
|
|
|
- if (db_ != nullptr) {
|
|
|
|
- ExecSql("COMMIT TRANSACTION");
|
|
|
|
- sqlite3_finalize(insert_request_);
|
|
|
|
- sqlite3_finalize(fetch_one_request_);
|
|
|
|
- sqlite3_finalize(get_rows_number_request_);
|
|
|
|
- if (sqlite3_close_v2(db_) != SQLITE_OK)
|
|
|
|
- LOG(ERROR) << "Database error when closing: " << sqlite3_errmsg(db_);
|
|
|
|
- db_ = nullptr;
|
|
|
|
- }
|
|
|
|
|
|
+ ExecSql("COMMIT TRANSACTION");
|
|
|
|
+ sqlite3_finalize(insert_request_);
|
|
|
|
+ sqlite3_finalize(fetch_one_request_);
|
|
|
|
+ sqlite3_finalize(get_rows_number_request_);
|
|
|
|
+ if (sqlite3_close_v2(db_) != SQLITE_OK)
|
|
|
|
+ LOG(ERROR) << "Database error when closing: " << sqlite3_errmsg(db_);
|
|
|
|
+ db_ = nullptr;
|
|
|
|
|
|
LOG(DEBUG) << "Database successfully closed.";
|
|
LOG(DEBUG) << "Database successfully closed.";
|
|
return true;
|
|
return true;
|