1diff -r -u -d orig/shell.c ./shell.c 2--- orig/shell.c 2017-06-17 03:16:30.000000000 -0700 3+++ ./shell.c 2017-06-19 09:45:58.799840492 -0700 4@@ -52,6 +52,12 @@ 5 #endif 6 #include <ctype.h> 7 #include <stdarg.h> 8+// Begin Android Add 9+#ifndef NO_ANDROID_FUNCS 10+#include "IcuUtils.h" 11+#include <sqlite3_android.h> 12+#endif 13+// End Android Add 14 15 #if !defined(_WIN32) && !defined(WIN32) 16 # include <signal.h> 17@@ -3387,6 +3393,22 @@ 18 sha3QueryFunc, 0, 0); 19 sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0, 20 sha3QueryFunc, 0, 0); 21+ 22+ // Begin Android Add 23+ #ifndef NO_ANDROID_FUNCS 24+ InitializeIcuOrDie(); 25+ int err = register_localized_collators(p->db, "en_US", 0); 26+ if (err != SQLITE_OK) { 27+ fprintf(stderr, "register_localized_collators() failed\n"); 28+ exit(1); 29+ } 30+ err = register_android_functions(p->db, 0); 31+ 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 41--- orig/sqlite3.c 2017-06-17 03:16:30.000000000 -0700 42+++ ./sqlite3.c 2017-06-19 09:45:58.859839260 -0700 43@@ -33497,7 +33497,7 @@ 44 SimulateIOError( rc=1 ); 45 if( rc!=0 ){ 46 storeLastErrno((unixFile*)id, errno); 47- return SQLITE_IOERR_FSTAT; 48+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath); 49 } 50 *pSize = buf.st_size; 51 52@@ -33533,7 +33533,7 @@ 53 struct stat buf; /* Used to hold return values of fstat() */ 54 55 if( osFstat(pFile->h, &buf) ){ 56- return SQLITE_IOERR_FSTAT; 57+ return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath); 58 } 59 60 nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; 61@@ -34107,7 +34107,7 @@ 62 ** with the same permissions. 63 */ 64 if( osFstat(pDbFd->h, &sStat) ){ 65- rc = SQLITE_IOERR_FSTAT; 66+ rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath); 67 goto shm_open_err; 68 } 69 70@@ -115663,7 +115663,7 @@ 71 } 72 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ 73 sqlite3SetString(pzErrMsg, db, "unsupported file format"); 74- rc = SQLITE_ERROR; 75+ rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;"; 76 goto initone_error_out; 77 } 78 79@@ -149204,13 +149204,25 @@ 80 ** 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)) 90 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) 91 ){ 92+#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 102 rc = sqlite3_create_module_v2( 103 db, "fts3", &fts3Module, (void *)pHash, hashDestroy 104 ); 105