diff options
Diffstat (limited to 'WebCore/platform/sql')
-rw-r--r-- | WebCore/platform/sql/SQLValue.h | 2 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteAuthorizer.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteAuthorizer.h | 88 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteDatabase.cpp | 6 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteDatabase.h | 8 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteStatement.h | 4 | ||||
-rw-r--r-- | WebCore/platform/sql/SQLiteTransaction.cpp | 1 |
7 files changed, 13 insertions, 98 deletions
diff --git a/WebCore/platform/sql/SQLValue.h b/WebCore/platform/sql/SQLValue.h index ae2432d..7d85051 100644 --- a/WebCore/platform/sql/SQLValue.h +++ b/WebCore/platform/sql/SQLValue.h @@ -30,7 +30,7 @@ #define SQLValue_h #include "PlatformString.h" -#include "Threading.h" +#include <wtf/Threading.h> namespace WebCore { diff --git a/WebCore/platform/sql/SQLiteAuthorizer.cpp b/WebCore/platform/sql/SQLiteAuthorizer.cpp index e1014ec..f9da260 100644 --- a/WebCore/platform/sql/SQLiteAuthorizer.cpp +++ b/WebCore/platform/sql/SQLiteAuthorizer.cpp @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "SQLiteAuthorizer.h" +#include "DatabaseAuthorizer.h" #include <sqlite3.h> diff --git a/WebCore/platform/sql/SQLiteAuthorizer.h b/WebCore/platform/sql/SQLiteAuthorizer.h deleted file mode 100644 index 4c0e8ee..0000000 --- a/WebCore/platform/sql/SQLiteAuthorizer.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following condition - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef SQLiteAuthorizer_h -#define SQLiteAuthorizer_h - -#include "Threading.h" - -namespace WebCore { - -class String; - -extern const int SQLAuthAllow; -extern const int SQLAuthIgnore; -extern const int SQLAuthDeny; - -class SQLiteAuthorizer : public ThreadSafeShared<SQLiteAuthorizer> { -public: - virtual ~SQLiteAuthorizer() { } - - virtual int createTable(const String& tableName) { return SQLAuthAllow; } - virtual int createTempTable(const String& tableName) { return SQLAuthAllow; } - virtual int dropTable(const String& tableName) { return SQLAuthAllow; } - virtual int dropTempTable(const String& tableName) { return SQLAuthAllow; } - virtual int allowAlterTable(const String& databaseName, const String& tableName) { return SQLAuthAllow; } - - virtual int createIndex(const String& indexName, const String& tableName) { return SQLAuthAllow; } - virtual int createTempIndex(const String& indexName, const String& tableName) { return SQLAuthAllow; } - virtual int dropIndex(const String& indexName, const String& tableName) { return SQLAuthAllow; } - virtual int dropTempIndex(const String& indexName, const String& tableName) { return SQLAuthAllow; } - - virtual int createTrigger(const String& triggerName, const String& tableName) { return SQLAuthAllow; } - virtual int createTempTrigger(const String& triggerName, const String& tableName) { return SQLAuthAllow; } - virtual int dropTrigger(const String& triggerName, const String& tableName) { return SQLAuthAllow; } - virtual int dropTempTrigger(const String& triggerName, const String& tableName) { return SQLAuthAllow; } - - virtual int createView(const String& viewName) { return SQLAuthAllow; } - virtual int createTempView(const String& viewName) { return SQLAuthAllow; } - virtual int dropView(const String& viewName) { return SQLAuthAllow; } - virtual int dropTempView(const String& viewName) { return SQLAuthAllow; } - - virtual int createVTable(const String& tableName, const String& moduleName) { return SQLAuthAllow; } - virtual int dropVTable(const String& tableName, const String& moduleName) { return SQLAuthAllow; } - - virtual int allowDelete(const String& tableName) { return SQLAuthAllow; } - virtual int allowInsert(const String& tableName) { return SQLAuthAllow; } - virtual int allowUpdate(const String& tableName, const String& columnName) { return SQLAuthAllow; } - virtual int allowTransaction() { return SQLAuthAllow; } - - virtual int allowSelect() { return SQLAuthAllow; } - virtual int allowRead(const String& tableName, const String& columnName) { return SQLAuthAllow; } - - virtual int allowAttach(const String& filename) { return SQLAuthAllow; } - virtual int allowDetach(const String& databaseName) { return SQLAuthAllow; } - - virtual int allowReindex(const String& indexName) { return SQLAuthAllow; } - virtual int allowAnalyze(const String& tableName) { return SQLAuthAllow; } - virtual int allowFunction(const String& functionName) { return SQLAuthAllow; } - virtual int allowPragma(const String& pragmaName, const String& firstArgument) { return SQLAuthAllow; } -}; - -} // namespace WebCore - -#endif // SQLiteAuthorizer_h diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index 7768f66..702cf02 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "SQLiteDatabase.h" +#include "DatabaseAuthorizer.h" #include "Logging.h" -#include "SQLiteAuthorizer.h" #include "SQLiteStatement.h" #include <sqlite3.h> @@ -243,7 +243,7 @@ const char* SQLiteDatabase::lastErrorMsg() int SQLiteDatabase::authorizerFunction(void* userData, int actionCode, const char* parameter1, const char* parameter2, const char* /*databaseName*/, const char* /*trigger_or_view*/) { - SQLiteAuthorizer* auth = static_cast<SQLiteAuthorizer*>(userData); + DatabaseAuthorizer* auth = static_cast<DatabaseAuthorizer*>(userData); ASSERT(auth); switch (actionCode) { @@ -317,7 +317,7 @@ int SQLiteDatabase::authorizerFunction(void* userData, int actionCode, const cha } } -void SQLiteDatabase::setAuthorizer(PassRefPtr<SQLiteAuthorizer> auth) +void SQLiteDatabase::setAuthorizer(PassRefPtr<DatabaseAuthorizer> auth) { if (!m_db) { LOG_ERROR("Attempt to set an authorizer on a non-open SQL database"); diff --git a/WebCore/platform/sql/SQLiteDatabase.h b/WebCore/platform/sql/SQLiteDatabase.h index 5e6ab46..76700dc 100644 --- a/WebCore/platform/sql/SQLiteDatabase.h +++ b/WebCore/platform/sql/SQLiteDatabase.h @@ -28,7 +28,7 @@ #define SQLDatabase_h #include "PlatformString.h" -#include "Threading.h" +#include <wtf/Threading.h> #if COMPILER(MSVC) #pragma warning(disable: 4800) @@ -38,7 +38,7 @@ struct sqlite3; namespace WebCore { -class SQLiteAuthorizer; +class DatabaseAuthorizer; class SQLiteStatement; class SQLiteTransaction; @@ -98,7 +98,7 @@ public: return m_db; } - void setAuthorizer(PassRefPtr<SQLiteAuthorizer>); + void setAuthorizer(PassRefPtr<DatabaseAuthorizer>); // (un)locks the database like a mutex void lock(); @@ -118,7 +118,7 @@ private: bool m_transactionInProgress; Mutex m_authorizerLock; - RefPtr<SQLiteAuthorizer> m_authorizer; + RefPtr<DatabaseAuthorizer> m_authorizer; Mutex m_lockingMutex; ThreadIdentifier m_openingThread; diff --git a/WebCore/platform/sql/SQLiteStatement.h b/WebCore/platform/sql/SQLiteStatement.h index 5df4731..e62b4f0 100644 --- a/WebCore/platform/sql/SQLiteStatement.h +++ b/WebCore/platform/sql/SQLiteStatement.h @@ -85,7 +85,9 @@ public: bool returnDoubleResults(int col, Vector<double>&); SQLiteDatabase* database() { return &m_database; } - + + const String& query() const { return m_query; } + private: SQLiteDatabase& m_database; String m_query; diff --git a/WebCore/platform/sql/SQLiteTransaction.cpp b/WebCore/platform/sql/SQLiteTransaction.cpp index 3fb54f1..5018f5a 100644 --- a/WebCore/platform/sql/SQLiteTransaction.cpp +++ b/WebCore/platform/sql/SQLiteTransaction.cpp @@ -74,6 +74,7 @@ void SQLiteTransaction::rollback() void SQLiteTransaction::stop() { m_inProgress = false; + m_db.m_transactionInProgress = false; } } // namespace WebCore |