Bug 1126129 - Only enable SQLite tracing when the right environment variable is set, r=asuth.

This commit is contained in:
Ben Turner 2015-01-26 19:38:49 -08:00
Родитель 1ac680d086
Коммит afaefae6c7
1 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -647,13 +647,17 @@ Connection::initializeInternal(nsIFile* aDatabaseFile)
if (!gStorageLog) if (!gStorageLog)
gStorageLog = ::PR_NewLogModule("mozStorage"); gStorageLog = ::PR_NewLogModule("mozStorage");
::sqlite3_trace(mDBConn, tracefunc, this); // SQLite tracing can slow down queries (especially long queries)
// significantly. Don't trace unless the user is actively monitoring SQLite.
if (PR_LOG_TEST(gStorageLog, PR_LOG_DEBUG)) {
::sqlite3_trace(mDBConn, tracefunc, this);
nsAutoCString leafName(":memory"); nsAutoCString leafName(":memory");
if (aDatabaseFile) if (aDatabaseFile)
(void)aDatabaseFile->GetNativeLeafName(leafName); (void)aDatabaseFile->GetNativeLeafName(leafName);
PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Opening connection to '%s' (%p)", PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Opening connection to '%s' (%p)",
leafName.get(), this)); leafName.get(), this));
}
#endif #endif
int64_t pageSize = Service::getDefaultPageSize(); int64_t pageSize = Service::getDefaultPageSize();