Fix SQLite access after ASIO usage (#2217)

Using the boost ASIO libraries before calling SQLite open causes the
"file://" protocol to be rewritten with a prepended CWD.
This commit is contained in:
Teddy Reed 2016-07-05 12:56:38 -07:00 committed by GitHub
parent e6fbde820e
commit f740a1f020

View File

@ -101,11 +101,12 @@ QueryData genQuicklookCache(QueryContext& context) {
for (const auto& index : databases) { for (const auto& index : databases) {
sqlite3* db = nullptr; sqlite3* db = nullptr;
auto rc = sqlite3_open_v2( auto rc = sqlite3_open_v2(
("file://" + index).c_str(), &db, index.c_str(), &db,
(SQLITE_OPEN_READONLY | SQLITE_OPEN_PRIVATECACHE | SQLITE_OPEN_NOMUTEX), (SQLITE_OPEN_READONLY | SQLITE_OPEN_PRIVATECACHE | SQLITE_OPEN_NOMUTEX),
nullptr); nullptr);
if (rc != SQLITE_OK || db == nullptr) { if (rc != SQLITE_OK || db == nullptr) {
VLOG(1) << "Cannot open " << index << " read only"; VLOG(1) << "Cannot open " << index << " read only: "
<< rc << " " << getStringForSQLiteReturnCode(rc);
if (db != nullptr) { if (db != nullptr) {
free(db); free(db);
} }