summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp')
-rw-r--r--Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp40
1 files changed, 15 insertions, 25 deletions
diff --git a/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp b/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp
index 6a397a671..82e780265 100644
--- a/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp
+++ b/Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp
@@ -10,7 +10,7 @@
* 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
+ * 3. Neither the name of Apple 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.
*
@@ -28,11 +28,9 @@
#include "config.h"
#include "ChangeVersionWrapper.h"
-#if ENABLE(SQL_DATABASE)
-
#include "Database.h"
#include "SQLError.h"
-#include <wtf/PassRefPtr.h>
+#include "SQLTransactionBackend.h"
#include <wtf/RefPtr.h>
namespace WebCore {
@@ -43,17 +41,14 @@ ChangeVersionWrapper::ChangeVersionWrapper(const String& oldVersion, const Strin
{
}
-bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction)
+bool ChangeVersionWrapper::performPreflight(SQLTransaction& transaction)
{
- ASSERT(transaction && transaction->database());
-
- DatabaseBackend* database = transaction->database();
+ Database& database = transaction.database();
String actualVersion;
- if (!database->getVersionFromDatabase(actualVersion)) {
- int sqliteError = database->sqliteDatabase().lastError();
- m_sqlError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to read the current version",
- sqliteError, database->sqliteDatabase().lastErrorMsg());
+ if (!database.getVersionFromDatabase(actualVersion)) {
+ int sqliteError = database.sqliteDatabase().lastError();
+ m_sqlError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to read the current version", sqliteError, database.sqliteDatabase().lastErrorMsg());
return false;
}
@@ -65,28 +60,23 @@ bool ChangeVersionWrapper::performPreflight(SQLTransactionBackend* transaction)
return true;
}
-bool ChangeVersionWrapper::performPostflight(SQLTransactionBackend* transaction)
+bool ChangeVersionWrapper::performPostflight(SQLTransaction& transaction)
{
- ASSERT(transaction && transaction->database());
+ Database& database = transaction.database();
- DatabaseBackend* database = transaction->database();
-
- if (!database->setVersionInDatabase(m_newVersion)) {
- int sqliteError = database->sqliteDatabase().lastError();
- m_sqlError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to set new version in database",
- sqliteError, database->sqliteDatabase().lastErrorMsg());
+ if (!database.setVersionInDatabase(m_newVersion)) {
+ int sqliteError = database.sqliteDatabase().lastError();
+ m_sqlError = SQLError::create(SQLError::UNKNOWN_ERR, "unable to set new version in database", sqliteError, database.sqliteDatabase().lastErrorMsg());
return false;
}
- database->setExpectedVersion(m_newVersion);
+ database.setExpectedVersion(m_newVersion);
return true;
}
-void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransactionBackend* transaction)
+void ChangeVersionWrapper::handleCommitFailedAfterPostflight(SQLTransaction& transaction)
{
- transaction->database()->setCachedVersion(m_oldVersion);
+ transaction.database().setCachedVersion(m_oldVersion);
}
} // namespace WebCore
-
-#endif // ENABLE(SQL_DATABASE)