[core] Replace sqlite3.h dependency in offline database
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include <mbgl/util/logging.hpp>
|
||||
|
||||
#include "sqlite3.hpp"
|
||||
#include <sqlite3.h>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -57,13 +56,13 @@ void OfflineDatabase::ensureSchema() {
|
||||
removeExisting();
|
||||
connect(mapbox::sqlite::ReadWrite | mapbox::sqlite::Create);
|
||||
} catch (mapbox::sqlite::Exception& ex) {
|
||||
if (ex.code != SQLITE_CANTOPEN && ex.code != SQLITE_NOTADB) {
|
||||
if (ex.code != mapbox::sqlite::Exception::Code::CANTOPEN && ex.code != mapbox::sqlite::Exception::Code::NOTADB) {
|
||||
Log::Error(Event::Database, "Unexpected error connecting to database: %s", ex.what());
|
||||
throw;
|
||||
}
|
||||
|
||||
try {
|
||||
if (ex.code == SQLITE_NOTADB) {
|
||||
if (ex.code == mapbox::sqlite::Exception::Code::NOTADB) {
|
||||
removeExisting();
|
||||
}
|
||||
connect(mapbox::sqlite::ReadWrite | mapbox::sqlite::Create);
|
||||
|
||||
@@ -20,9 +20,15 @@ enum OpenFlag : int {
|
||||
};
|
||||
|
||||
struct Exception : std::runtime_error {
|
||||
enum Code : int {
|
||||
OK = 0,
|
||||
CANTOPEN = 14,
|
||||
NOTADB = 26
|
||||
};
|
||||
|
||||
Exception(int err, const char *msg) : std::runtime_error(msg), code(err) {}
|
||||
Exception(int err, const std::string& msg) : std::runtime_error(msg), code(err) {}
|
||||
const int code = 0;
|
||||
const int code = OK;
|
||||
};
|
||||
|
||||
class DatabaseImpl;
|
||||
|
||||
Reference in New Issue
Block a user