summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/sql/SQLiteStatement.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebCore/platform/sql/SQLiteStatement.cpp
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebCore/platform/sql/SQLiteStatement.cpp')
-rw-r--r--WebCore/platform/sql/SQLiteStatement.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp
index 8963adb..cd2a467 100644
--- a/WebCore/platform/sql/SQLiteStatement.cpp
+++ b/WebCore/platform/sql/SQLiteStatement.cpp
@@ -65,6 +65,15 @@ int SQLiteStatement::prepare()
LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data());
String strippedQuery = m_query.stripWhiteSpace();
int error = sqlite3_prepare16_v2(m_database.sqlite3Handle(), strippedQuery.charactersWithNullTermination(), -1, &m_statement, &tail);
+
+ // Starting with version 3.6.16, sqlite has a patch (http://www.sqlite.org/src/ci/256ec3c6af)
+ // that should make sure sqlite3_prepare16_v2 doesn't return a SQLITE_SCHEMA error.
+ // If we're using an older sqlite version, try to emulate the patch.
+ if (error == SQLITE_SCHEMA) {
+ sqlite3_finalize(m_statement);
+ error = sqlite3_prepare16_v2(m_database.sqlite3Handle(), m_query.charactersWithNullTermination(), -1, &m_statement, &tail);
+ }
+
if (error != SQLITE_OK)
LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle()));
const UChar* ch = static_cast<const UChar*>(tail);
@@ -87,6 +96,7 @@ int SQLiteStatement::step()
LOG(SQLDatabase, "sqlite3_step failed (%i)\nQuery - %s\nError - %s",
error, m_query.ascii().data(), sqlite3_errmsg(m_database.sqlite3Handle()));
}
+
return error;
}