return ret;\
}
+static bool g_sqlite3_initialized = false;
+
const int FaviconDatabase::SYNC_DELAY = 3;
FaviconDatabase *FaviconDatabase::Instance() {
if (d->sqlite) {
return true;
}
- int result = sqlite3_open(d->path.value().c_str(), &d->sqlite);
- if (result != SQLITE_OK) {
+ // Since m69, sqlite is compiled with SQLITE_OMIT_AUTOINIT option.
+ // So application must call sqlite3_initialize() directly.
+ int result_code;
+ if (!g_sqlite3_initialized) {
+ result_code = sqlite3_initialize();
+ if (result_code != SQLITE_OK) {
+ LOG(ERROR) << "[FaviconDatabase] :: Error initialize sqlite3 ("
+ << result_code << ")!";
+ return false;
+ }
+ g_sqlite3_initialized = true;
+ }
+ result_code = sqlite3_open(d->path.value().c_str(), &d->sqlite);
+ if (result_code != SQLITE_OK) {
LOG(ERROR) << "[FaviconDatabase] :: Error opening SQLite database ("
- << result << ")!";
+ << result_code << ")!";
return false;
}
if (!IsDatabaseInitialized() && !InitDatabase()) {