sqlite: Upgrade to SQLite 3.18.0

Downloaded from https://sqlite.org/2017/sqlite-amalgamation-3180000.zip

    $ sha256sum sqlite-amalgamation-3180000.zip
    1cfb91106650a12840e107db29f2ec4afe3d7f9dc5936770ef53bc3eb6387b6e  sqlite-amalgamation-3180000.zip

dist/orig contains the stock sqlite3 code, as packaged in the ZIP file above.

dist contains a copy of dist/orig, but with the Android.patch file applied.
Please see Android.patch for a list of differences between stock and
Android.

The Android specific patch had a conflict in shell.c.
The conflict was resolved without issues.

This major release contains the protection feature
"LIMIT_VDBE_OP", performance improvements,
bug fixes and various other enhancements.

More details about the release are available here: https://sqlite.org/releaselog/3_18_0.html

Change-Id: If9c32f48f2769b389892ab0256614d8b5eb87324
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
diff --git a/dist/Android.patch b/dist/Android.patch
index bc6e900..00546fe 100644
--- a/dist/Android.patch
+++ b/dist/Android.patch
@@ -1,6 +1,6 @@
 diff -r -u -d orig/shell.c ./shell.c
---- orig/shell.c	2017-02-13 17:25:42.000000000 +0100
-+++ ./shell.c	2017-02-13 18:20:38.582995110 +0100
+--- orig/shell.c	2017-03-30 16:26:46.000000000 +0200
++++ ./shell.c	2017-03-31 14:07:49.938488981 +0200
 @@ -52,6 +52,12 @@
  #endif
  #include <ctype.h>
@@ -14,10 +14,10 @@
  
  #if !defined(_WIN32) && !defined(WIN32)
  # include <signal.h>
-@@ -2442,6 +2448,22 @@
-                             readfileFunc, 0, 0);
-     sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0,
-                             writefileFunc, 0, 0);
+@@ -3387,6 +3393,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
@@ -38,9 +38,9 @@
  }
  
 diff -r -u -d orig/sqlite3.c ./sqlite3.c
---- orig/sqlite3.c	2017-02-13 17:25:42.000000000 +0100
-+++ ./sqlite3.c	2017-02-13 18:20:38.613994512 +0100
-@@ -33438,7 +33438,7 @@
+--- orig/sqlite3.c	2017-03-30 16:26:46.000000000 +0200
++++ ./sqlite3.c	2017-03-31 14:05:07.474694595 +0200
+@@ -33497,7 +33497,7 @@
    SimulateIOError( rc=1 );
    if( rc!=0 ){
      storeLastErrno((unixFile*)id, errno);
@@ -49,7 +49,7 @@
    }
    *pSize = buf.st_size;
  
-@@ -33474,7 +33474,7 @@
+@@ -33533,7 +33533,7 @@
      struct stat buf;              /* Used to hold return values of fstat() */
     
      if( osFstat(pFile->h, &buf) ){
@@ -58,7 +58,7 @@
      }
  
      nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
-@@ -34048,7 +34048,7 @@
+@@ -34107,7 +34107,7 @@
      ** with the same permissions.
      */
      if( osFstat(pDbFd->h, &sStat) ){
@@ -67,7 +67,7 @@
        goto shm_open_err;
      }
  
-@@ -115193,7 +115193,7 @@
+@@ -115660,7 +115660,7 @@
    }
    if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
      sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -76,7 +76,7 @@
      goto initone_error_out;
    }
  
-@@ -148659,13 +148659,25 @@
+@@ -149201,13 +149201,25 @@
    ** module with sqlite.
    */
    if( SQLITE_OK==rc