Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 1 | diff -r -u -d orig/shell.c ./shell.c |
Chad Brubaker | 4436df8 | 2017-06-21 12:24:10 -0700 | [diff] [blame^] | 2 | --- orig/shell.c 2017-05-24 17:13:50.000000000 +0200 |
| 3 | +++ ./shell.c 2017-05-24 19:24:05.290434785 +0200 |
Nick Kralevich | 0c1333f | 2015-06-12 14:00:54 -0700 | [diff] [blame] | 4 | @@ -52,6 +52,12 @@ |
Nick Kralevich | 3fcd43a | 2015-04-08 13:13:26 -0700 | [diff] [blame] | 5 | #endif |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 6 | #include <ctype.h> |
| 7 | #include <stdarg.h> |
| 8 | +// Begin Android Add |
| 9 | +#ifndef NO_ANDROID_FUNCS |
Nick Kralevich | 0c1333f | 2015-06-12 14:00:54 -0700 | [diff] [blame] | 10 | +#include "IcuUtils.h" |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 11 | +#include <sqlite3_android.h> |
| 12 | +#endif |
| 13 | +// End Android Add |
| 14 | |
Nick Kralevich | 8fecf56 | 2014-05-29 16:56:33 -0700 | [diff] [blame] | 15 | #if !defined(_WIN32) && !defined(WIN32) |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 16 | # include <signal.h> |
Alex Naidis | b94ea7b | 2017-05-24 19:25:14 +0200 | [diff] [blame] | 17 | @@ -3509,6 +3515,22 @@ |
Alex Naidis | b86c0cf | 2017-03-31 14:12:35 +0200 | [diff] [blame] | 18 | sha3QueryFunc, 0, 0); |
| 19 | sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0, |
| 20 | sha3QueryFunc, 0, 0); |
Jeff Brown | 9bee60b | 2014-08-20 16:41:25 -0700 | [diff] [blame] | 21 | + |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 22 | + // Begin Android Add |
| 23 | + #ifndef NO_ANDROID_FUNCS |
Nick Kralevich | 0c1333f | 2015-06-12 14:00:54 -0700 | [diff] [blame] | 24 | + InitializeIcuOrDie(); |
Nick Kralevich | 3a6c79f | 2015-05-08 11:25:07 -0700 | [diff] [blame] | 25 | + int err = register_localized_collators(p->db, "en_US", 0); |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 26 | + if (err != SQLITE_OK) { |
| 27 | + fprintf(stderr, "register_localized_collators() failed\n"); |
| 28 | + exit(1); |
| 29 | + } |
Nick Kralevich | 3a6c79f | 2015-05-08 11:25:07 -0700 | [diff] [blame] | 30 | + err = register_android_functions(p->db, 0); |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 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 | |
| 40 | diff -r -u -d orig/sqlite3.c ./sqlite3.c |
Chad Brubaker | 4436df8 | 2017-06-21 12:24:10 -0700 | [diff] [blame^] | 41 | --- orig/sqlite3.c 2017-05-24 17:13:50.000000000 +0200 |
| 42 | +++ ./sqlite3.c 2017-05-24 19:24:05.339433935 +0200 |
Alex Naidis | b94ea7b | 2017-05-24 19:25:14 +0200 | [diff] [blame] | 43 | @@ -33542,7 +33542,7 @@ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 44 | SimulateIOError( rc=1 ); |
| 45 | if( rc!=0 ){ |
Nick Kralevich | 3fcd43a | 2015-04-08 13:13:26 -0700 | [diff] [blame] | 46 | storeLastErrno((unixFile*)id, errno); |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 47 | - return SQLITE_IOERR_FSTAT; |
| 48 | + return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath); |
| 49 | } |
| 50 | *pSize = buf.st_size; |
| 51 | |
Alex Naidis | b94ea7b | 2017-05-24 19:25:14 +0200 | [diff] [blame] | 52 | @@ -33578,7 +33578,7 @@ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 53 | struct stat buf; /* Used to hold return values of fstat() */ |
| 54 | |
Nick Kralevich | 3fcd43a | 2015-04-08 13:13:26 -0700 | [diff] [blame] | 55 | if( osFstat(pFile->h, &buf) ){ |
| 56 | - return SQLITE_IOERR_FSTAT; |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 57 | + return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath); |
Nick Kralevich | 3fcd43a | 2015-04-08 13:13:26 -0700 | [diff] [blame] | 58 | } |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 59 | |
| 60 | nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; |
Alex Naidis | b94ea7b | 2017-05-24 19:25:14 +0200 | [diff] [blame] | 61 | @@ -34152,7 +34152,7 @@ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 62 | ** with the same permissions. |
| 63 | */ |
Alex Naidis | 60fa6fd | 2016-07-10 14:13:38 +0200 | [diff] [blame] | 64 | if( osFstat(pDbFd->h, &sStat) ){ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 65 | - rc = SQLITE_IOERR_FSTAT; |
| 66 | + rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath); |
| 67 | goto shm_open_err; |
| 68 | } |
| 69 | |
Chad Brubaker | 4436df8 | 2017-06-21 12:24:10 -0700 | [diff] [blame^] | 70 | @@ -115926,7 +115926,7 @@ |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 71 | } |
| 72 | if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ |
| 73 | sqlite3SetString(pzErrMsg, db, "unsupported file format"); |
| 74 | - rc = SQLITE_ERROR; |
Alex Naidis | 60fa6fd | 2016-07-10 14:13:38 +0200 | [diff] [blame] | 75 | + rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;"; |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 76 | goto initone_error_out; |
| 77 | } |
| 78 | |
Chad Brubaker | 4436df8 | 2017-06-21 12:24:10 -0700 | [diff] [blame^] | 79 | @@ -149753,13 +149753,25 @@ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 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)) |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 90 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) |
| 91 | ){ |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 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 |
Jeff Brown | 0bc4836 | 2012-04-19 19:17:00 -0700 | [diff] [blame] | 102 | rc = sqlite3_create_module_v2( |
Nick Kralevich | 34084e2 | 2014-02-28 10:29:21 -0800 | [diff] [blame] | 103 | db, "fts3", &fts3Module, (void *)pHash, hashDestroy |
Nick Kralevich | 59026eb | 2016-04-16 22:12:55 -0700 | [diff] [blame] | 104 | ); |