blob: 98b9f1f28254ca0e316b6515b509aff56a8124b0 [file] [log] [blame]
Jeff Brown0bc48362012-04-19 19:17:00 -07001diff -r -u -d orig/shell.c ./shell.c
Chad Brubaker4436df82017-06-21 12:24:10 -07002--- orig/shell.c 2017-05-24 17:13:50.000000000 +0200
3+++ ./shell.c 2017-05-24 19:24:05.290434785 +0200
Nick Kralevich0c1333f2015-06-12 14:00:54 -07004@@ -52,6 +52,12 @@
Nick Kralevich3fcd43a2015-04-08 13:13:26 -07005 #endif
Jeff Brown0bc48362012-04-19 19:17:00 -07006 #include <ctype.h>
7 #include <stdarg.h>
8+// Begin Android Add
9+#ifndef NO_ANDROID_FUNCS
Nick Kralevich0c1333f2015-06-12 14:00:54 -070010+#include "IcuUtils.h"
Jeff Brown0bc48362012-04-19 19:17:00 -070011+#include <sqlite3_android.h>
12+#endif
13+// End Android Add
14
Nick Kralevich8fecf562014-05-29 16:56:33 -070015 #if !defined(_WIN32) && !defined(WIN32)
Jeff Brown0bc48362012-04-19 19:17:00 -070016 # include <signal.h>
Alex Naidisb94ea7b2017-05-24 19:25:14 +020017@@ -3509,6 +3515,22 @@
Alex Naidisb86c0cf2017-03-31 14:12:35 +020018 sha3QueryFunc, 0, 0);
19 sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0,
20 sha3QueryFunc, 0, 0);
Jeff Brown9bee60b2014-08-20 16:41:25 -070021+
Jeff Brown0bc48362012-04-19 19:17:00 -070022+ // Begin Android Add
23+ #ifndef NO_ANDROID_FUNCS
Nick Kralevich0c1333f2015-06-12 14:00:54 -070024+ InitializeIcuOrDie();
Nick Kralevich3a6c79f2015-05-08 11:25:07 -070025+ int err = register_localized_collators(p->db, "en_US", 0);
Jeff Brown0bc48362012-04-19 19:17:00 -070026+ if (err != SQLITE_OK) {
27+ fprintf(stderr, "register_localized_collators() failed\n");
28+ exit(1);
29+ }
Nick Kralevich3a6c79f2015-05-08 11:25:07 -070030+ err = register_android_functions(p->db, 0);
Jeff Brown0bc48362012-04-19 19:17:00 -070031+ if (err != SQLITE_OK) {
32+ fprintf(stderr, "register_android_functions() failed\n");
33+ exit(1);
34+ }
35+ #endif
36+ // End Android Add
37 }
38 }
39
40diff -r -u -d orig/sqlite3.c ./sqlite3.c
Chad Brubaker4436df82017-06-21 12:24:10 -070041--- orig/sqlite3.c 2017-05-24 17:13:50.000000000 +0200
42+++ ./sqlite3.c 2017-05-24 19:24:05.339433935 +0200
Alex Naidisb94ea7b2017-05-24 19:25:14 +020043@@ -33542,7 +33542,7 @@
Nick Kralevich34084e22014-02-28 10:29:21 -080044 SimulateIOError( rc=1 );
45 if( rc!=0 ){
Nick Kralevich3fcd43a2015-04-08 13:13:26 -070046 storeLastErrno((unixFile*)id, errno);
Nick Kralevich34084e22014-02-28 10:29:21 -080047- return SQLITE_IOERR_FSTAT;
48+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
49 }
50 *pSize = buf.st_size;
51
Alex Naidisb94ea7b2017-05-24 19:25:14 +020052@@ -33578,7 +33578,7 @@
Nick Kralevich34084e22014-02-28 10:29:21 -080053 struct stat buf; /* Used to hold return values of fstat() */
54
Nick Kralevich3fcd43a2015-04-08 13:13:26 -070055 if( osFstat(pFile->h, &buf) ){
56- return SQLITE_IOERR_FSTAT;
Nick Kralevich34084e22014-02-28 10:29:21 -080057+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
Nick Kralevich3fcd43a2015-04-08 13:13:26 -070058 }
Nick Kralevich34084e22014-02-28 10:29:21 -080059
60 nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
Alex Naidisb94ea7b2017-05-24 19:25:14 +020061@@ -34152,7 +34152,7 @@
Nick Kralevich34084e22014-02-28 10:29:21 -080062 ** with the same permissions.
63 */
Alex Naidis60fa6fd2016-07-10 14:13:38 +020064 if( osFstat(pDbFd->h, &sStat) ){
Nick Kralevich34084e22014-02-28 10:29:21 -080065- rc = SQLITE_IOERR_FSTAT;
66+ rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
67 goto shm_open_err;
68 }
69
Chad Brubaker4436df82017-06-21 12:24:10 -070070@@ -115926,7 +115926,7 @@
Jeff Brown0bc48362012-04-19 19:17:00 -070071 }
72 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
73 sqlite3SetString(pzErrMsg, db, "unsupported file format");
74- rc = SQLITE_ERROR;
Alex Naidis60fa6fd2016-07-10 14:13:38 +020075+ rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
Jeff Brown0bc48362012-04-19 19:17:00 -070076 goto initone_error_out;
77 }
78
Chad Brubaker4436df82017-06-21 12:24:10 -070079@@ -149753,13 +149753,25 @@
Nick Kralevich34084e22014-02-28 10:29:21 -080080 ** module with sqlite.
81 */
82 if( SQLITE_OK==rc
83+#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
84 && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
85+#endif
86 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
87 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
88 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
89 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
Jeff Brown0bc48362012-04-19 19:17:00 -070090 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
91 ){
Nick Kralevich34084e22014-02-28 10:29:21 -080092+#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
93+ rc = sqlite3_create_module_v2(
94+ db, "fts1", &fts3Module, (void *)pHash, 0
95+ );
96+ if(rc) return rc;
97+ rc = sqlite3_create_module_v2(
98+ db, "fts2", &fts3Module, (void *)pHash, 0
99+ );
100+ if(rc) return rc;
101+#endif
Jeff Brown0bc48362012-04-19 19:17:00 -0700102 rc = sqlite3_create_module_v2(
Nick Kralevich34084e22014-02-28 10:29:21 -0800103 db, "fts3", &fts3Module, (void *)pHash, hashDestroy
Nick Kralevich59026eb2016-04-16 22:12:55 -0700104 );