From dcc8cf2e65d1aa555cce12431a16547e66b469ee Mon Sep 17 00:00:00 2001 From: Steve Block Date: Tue, 27 Apr 2010 16:31:00 +0100 Subject: Merge webkit.org at r58033 : Initial merge by git Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1 --- WebCore/platform/sql/SQLiteDatabase.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'WebCore/platform/sql/SQLiteDatabase.cpp') diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index faaf5de..58fdc7c 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -48,6 +48,7 @@ SQLiteDatabase::SQLiteDatabase() : m_db(0) , m_pageSize(-1) , m_transactionInProgress(false) + , m_sharable(false) , m_openingThread(0) { } @@ -57,11 +58,11 @@ SQLiteDatabase::~SQLiteDatabase() close(); } -bool SQLiteDatabase::open(const String& filename) +bool SQLiteDatabase::open(const String& filename, bool forWebSQLDatabase) { close(); - - m_lastError = SQLiteFileSystem::openDatabase(filename, &m_db); + + m_lastError = SQLiteFileSystem::openDatabase(filename, &m_db, forWebSQLDatabase); if (m_lastError != SQLITE_OK) { LOG_ERROR("SQLite database failed to load from %s\nCause - %s", filename.ascii().data(), sqlite3_errmsg(m_db)); @@ -72,7 +73,7 @@ bool SQLiteDatabase::open(const String& filename) if (isOpen()) m_openingThread = currentThread(); - + if (!SQLiteStatement(*this, "PRAGMA temp_store = MEMORY;").executeCommand()) LOG_ERROR("SQLite database could not set temp_store to memory"); @@ -252,6 +253,18 @@ const char* SQLiteDatabase::lastErrorMsg() return sqlite3_errmsg(m_db); } +#ifndef NDEBUG +void SQLiteDatabase::disableThreadingChecks() +{ + // This doesn't guarantee that SQList was compiled with -DTHREADSAFE, or that you haven't turned off the mutexes. +#if SQLITE_VERSION_NUMBER >= 3003001 + m_sharable = true; +#else + ASSERT(0); // Your SQLite doesn't support sharing handles across threads. +#endif +} +#endif + int SQLiteDatabase::authorizerFunction(void* userData, int actionCode, const char* parameter1, const char* parameter2, const char* /*databaseName*/, const char* /*trigger_or_view*/) { DatabaseAuthorizer* auth = static_cast(userData); -- cgit v1.1