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)
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");
if (aDatabaseFile)
(void)aDatabaseFile->GetNativeLeafName(leafName);
PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Opening connection to '%s' (%p)",
leafName.get(), this));
nsAutoCString leafName(":memory");
if (aDatabaseFile)
(void)aDatabaseFile->GetNativeLeafName(leafName);
PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Opening connection to '%s' (%p)",
leafName.get(), this));
}
#endif
int64_t pageSize = Service::getDefaultPageSize();