summaryrefslogtreecommitdiff
path: root/dist/Android.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dist/Android.patch')
-rw-r--r--dist/Android.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/dist/Android.patch b/dist/Android.patch
new file mode 100644
index 0000000..efc1af1
--- /dev/null
+++ b/dist/Android.patch
@@ -0,0 +1,134 @@
+diff -r -u -d orig/shell.c ./shell.c
+--- orig/shell.c 2012-04-19 16:44:48.000000000 -0700
++++ ./shell.c 2012-03-13 16:34:30.000000000 -0700
+@@ -35,6 +35,11 @@
+ #include "sqlite3.h"
+ #include <ctype.h>
+ #include <stdarg.h>
++// Begin Android Add
++#ifndef NO_ANDROID_FUNCS
++#include <sqlite3_android.h>
++#endif
++// End Android Add
+
+ #if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
+ # include <signal.h>
+@@ -1436,6 +1441,20 @@
+ #ifndef SQLITE_OMIT_LOAD_EXTENSION
+ sqlite3_enable_load_extension(p->db, 1);
+ #endif
++ // Begin Android Add
++ #ifndef NO_ANDROID_FUNCS
++ int err = register_localized_collators(db, "en_US", 0);
++ if (err != SQLITE_OK) {
++ fprintf(stderr, "register_localized_collators() failed\n");
++ exit(1);
++ }
++ err = register_android_functions(db, 0);
++ if (err != SQLITE_OK) {
++ fprintf(stderr, "register_android_functions() failed\n");
++ exit(1);
++ }
++ #endif
++ // End Android Add
+ }
+ }
+
+diff -r -u -d orig/sqlite3.c ./sqlite3.c
+--- orig/sqlite3.c 2012-04-19 16:44:48.000000000 -0700
++++ ./sqlite3.c 2012-03-13 16:34:30.000000000 -0700
+@@ -25313,7 +25313,12 @@
+ #else
+ { "pread64", (sqlite3_syscall_ptr)0, 0 },
+ #endif
++#ifdef ANDROID
++// Bionic defines pread64 using off64_t rather than off_t.
++#define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
++#else
+ #define osPread64 ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent)
++#endif
+
+ { "write", (sqlite3_syscall_ptr)write, 0 },
+ #define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
+@@ -25331,8 +25336,14 @@
+ #else
+ { "pwrite64", (sqlite3_syscall_ptr)0, 0 },
+ #endif
++#ifdef ANDROID
++// Bionic defines pwrite64 using off64_t rather than off_t.
++#define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\
++ aSyscall[13].pCurrent)
++#else
+ #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off_t))\
+ aSyscall[13].pCurrent)
++#endif
+
+ #if SQLITE_ENABLE_LOCKING_STYLE
+ { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 },
+@@ -93769,7 +93780,7 @@
+ }
+ if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
+ sqlite3SetString(pzErrMsg, db, "unsupported file format");
+- rc = SQLITE_ERROR;
++ rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;"
+ goto initone_error_out;
+ }
+
+@@ -112144,7 +112155,7 @@
+ extern "C" {
+ #endif /* __cplusplus */
+
+-SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db);
++SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db, const char* registerAs); // Android Change
+
+ #if 0
+ } /* extern "C" */
+@@ -114462,9 +114473,24 @@
+ #endif
+
+ #ifdef SQLITE_ENABLE_FTS3
+- if( !db->mallocFailed && rc==SQLITE_OK ){
+- rc = sqlite3Fts3Init(db);
+- }
++ // Begin Android change
++ #ifdef SQLITE_ENABLE_FTS3_BACKWARDS
++ /* Also register as fts1 and fts2, for backwards compatability on
++ ** systems known to have never seen a pre-fts3 database.
++ */
++ if( !db->mallocFailed && rc==SQLITE_OK ){
++ rc = sqlite3Fts3Init(db, "fts1");
++ }
++
++ if( !db->mallocFailed && rc==SQLITE_OK ){
++ rc = sqlite3Fts3Init(db, "fts2");
++ }
++ #endif
++
++ if( !db->mallocFailed && rc==SQLITE_OK ){
++ rc = sqlite3Fts3Init(db, "fts3");
++ }
++ // End Android change
+ #endif
+
+ #ifdef SQLITE_ENABLE_ICU
+@@ -119780,7 +119806,7 @@
+ ** SQLite. If fts3 is built as a dynamically loadable extension, this
+ ** function is called by the sqlite3_extension_init() entry point.
+ */
+-SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
++SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db, const char* registerAs){ // Android Change
+ int rc = SQLITE_OK;
+ Fts3Hash *pHash = 0;
+ const sqlite3_tokenizer_module *pSimple = 0;
+@@ -119841,7 +119867,10 @@
+ && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
+ ){
+ rc = sqlite3_create_module_v2(
+- db, "fts3", &fts3Module, (void *)pHash, hashDestroy
++ // Begin Android change
++ // Also register as fts1 and fts2
++ db, registerAs, &fts3Module, (void *)pHash, hashDestroy
++ // End Android change
+ );
+ if( rc==SQLITE_OK ){
+ rc = sqlite3_create_module_v2(