diff -r -u -d orig/shell.c ./shell.c --- orig/shell.c 2017-07-21 09:46:53.488326209 +0900 +++ ./shell.c 2017-07-21 09:46:53.620324492 +0900 @@ -52,6 +52,12 @@ #endif #include #include +// Begin Android Add +#ifndef NO_ANDROID_FUNCS +#include "IcuUtils.h" +#include +#endif +// End Android Add #if !defined(_WIN32) && !defined(WIN32) # include @@ -3509,6 +3515,22 @@ sha3QueryFunc, 0, 0); sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0, sha3QueryFunc, 0, 0); + + // Begin Android Add + #ifndef NO_ANDROID_FUNCS + InitializeIcuOrDie(); + int err = register_localized_collators(p->db, "en_US", 0); + if (err != SQLITE_OK) { + fprintf(stderr, "register_localized_collators() failed\n"); + exit(1); + } + err = register_android_functions(p->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 2017-08-04 10:42:31.294648222 +0900 +++ ./sqlite3.c 2017-08-10 13:27:29.784569745 +0900 @@ -33618,7 +33618,7 @@ SimulateIOError( rc=1 ); if( rc!=0 ){ storeLastErrno((unixFile*)id, errno); - return SQLITE_IOERR_FSTAT; + return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath); } *pSize = buf.st_size; @@ -33654,7 +33654,7 @@ struct stat buf; /* Used to hold return values of fstat() */ if( osFstat(pFile->h, &buf) ){ - return SQLITE_IOERR_FSTAT; + return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath); } nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; @@ -34262,7 +34262,7 @@ ** with the same permissions. */ if( osFstat(pDbFd->h, &sStat) ){ - rc = SQLITE_IOERR_FSTAT; + rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath); goto shm_open_err; } @@ -116120,7 +116120,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; } @@ -149914,13 +149914,25 @@ ** module with sqlite. */ if( SQLITE_OK==rc +#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */ && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) +#endif && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) ){ +#ifdef SQLITE_ENABLE_FTS3_BACKWARDS + rc = sqlite3_create_module_v2( + db, "fts1", &fts3Module, (void *)pHash, 0 + ); + if(rc) return rc; + rc = sqlite3_create_module_v2( + db, "fts2", &fts3Module, (void *)pHash, 0 + ); + if(rc) return rc; +#endif rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy );