summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 14:40:00 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 14:40:00 +0000
commit2e1cee7610b03276ef8682e2f9ad0a6d73b399fd (patch)
tree0429bf6713e6eaff83e468ebb92802b410245f6a /sql
parentb0e08fa9f8dc80829050dd6cdfb59acd0f560958 (diff)
downloadchromium_src-2e1cee7610b03276ef8682e2f9ad0a6d73b399fd.zip
chromium_src-2e1cee7610b03276ef8682e2f9ad0a6d73b399fd.tar.gz
chromium_src-2e1cee7610b03276ef8682e2f9ad0a6d73b399fd.tar.bz2
Add REGEXP support to SQLite on iOS
Chrome for iOS uses system SQLite, which on iOS doesn't include the ICU extensions, which includes the now-required-by-Chrome REGEXP support. This compiles that extension as a static library, and dynamically registers it on each database opened. BUG=254636 Review URL: https://chromiumcodereview.appspot.com/18312005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql')
-rw-r--r--sql/connection.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/connection.cc b/sql/connection.cc
index a11bc72..2a971e5 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -18,6 +18,10 @@
#include "sql/statement.h"
#include "third_party/sqlite/sqlite3.h"
+#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
+#include "third_party/sqlite/src/ext/icu/sqliteicu.h"
+#endif
+
namespace {
// Spin for up to a second waiting for the lock to clear when setting
@@ -701,6 +705,13 @@ bool Connection::OpenInternal(const std::string& file_name) {
err = sqlite3_extended_result_codes(db_, 1);
DCHECK_EQ(err, SQLITE_OK) << "Could not enable extended result codes";
+#if defined(OS_IOS) && defined(USE_SYSTEM_SQLITE)
+ // The version of SQLite shipped with iOS doesn't enable ICU, which includes
+ // REGEXP support. Add it in dynamically.
+ err = sqlite3IcuInit(db_);
+ DCHECK_EQ(err, SQLITE_OK) << "Could not enable ICU support";
+#endif // OS_IOS && USE_SYSTEM_SQLITE
+
// If indicated, lock up the database before doing anything else, so
// that the following code doesn't have to deal with locking.
// TODO(shess): This code is brittle. Find the cases where code