This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Android.patch
134 lines (125 loc) · 4.16 KB
/
Android.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
diff -r -u -d orig/shell.c ./shell.c
--- orig/shell.c 2012-04-19 19:18:38.000000000 -0700
+++ ./shell.c 2012-04-19 19:26:02.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>
@@ -1463,6 +1468,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 19:18:38.000000000 -0700
+++ ./sqlite3.c 2012-04-19 19:26:02.000000000 -0700
@@ -25387,7 +25387,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)
@@ -25405,8 +25410,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 },
@@ -93937,7 +93948,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;
}
@@ -112387,7 +112398,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" */
@@ -114717,9 +114728,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
@@ -120143,7 +120169,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;
@@ -120204,7 +120230,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(