merge in mnc-release history after reset to mnc-dev
diff --git a/dist/Android.mk b/dist/Android.mk
index 7cf6e75..20b3a0a 100644
--- a/dist/Android.mk
+++ b/dist/Android.mk
@@ -95,8 +95,11 @@
 LOCAL_SHARED_LIBRARIES := libsqlite \
             libicuuc \
             libicui18n \
+            liblog \
             libutils
 
+LOCAL_STATIC_LIBRARIES := libicuandroid_utils
+
 LOCAL_CFLAGS += $(device_sqlite_flags)
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
diff --git a/dist/Android.patch b/dist/Android.patch
index 922a34b..4a39086 100644
--- a/dist/Android.patch
+++ b/dist/Android.patch
@@ -1,25 +1,27 @@
 diff -r -u -d orig/shell.c ./shell.c
---- orig/shell.c	2015-05-08 11:10:06.525393270 -0700
-+++ ./shell.c	2015-05-08 11:17:28.275228469 -0700
-@@ -52,6 +52,11 @@
+--- orig/shell.c	2015-06-12 15:32:23.260341869 -0700
++++ ./shell.c	2015-06-12 15:33:39.024707940 -0700
+@@ -52,6 +52,12 @@
  #endif
  #include <ctype.h>
  #include <stdarg.h>
 +// Begin Android Add
 +#ifndef NO_ANDROID_FUNCS
++#include "IcuUtils.h"
 +#include <sqlite3_android.h>
 +#endif
 +// End Android Add
  
  #if !defined(_WIN32) && !defined(WIN32)
  # include <signal.h>
-@@ -1938,6 +1943,21 @@
+@@ -1938,6 +1944,22 @@
                              readfileFunc, 0, 0);
      sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0,
                              writefileFunc, 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");
@@ -36,9 +38,9 @@
  }
  
 diff -r -u -d orig/sqlite3.c ./sqlite3.c
---- orig/sqlite3.c	2015-05-08 11:10:07.173395986 -0700
-+++ ./sqlite3.c	2015-05-08 11:11:18.625694907 -0700
-@@ -25289,6 +25289,13 @@
+--- orig/sqlite3.c	2015-06-12 15:32:23.828344614 -0700
++++ ./sqlite3.c	2015-06-12 15:33:39.048708056 -0700
+@@ -25292,6 +25292,13 @@
  */
  #if SQLITE_OS_UNIX              /* This file is used on unix only */
  
@@ -52,7 +54,7 @@
  /*
  ** There are various methods for file locking used for concurrency
  ** control:
-@@ -25843,7 +25850,12 @@
+@@ -25846,7 +25853,12 @@
  #else
    { "pread64",      (sqlite3_syscall_ptr)0,          0  },
  #endif
@@ -65,7 +67,7 @@
  
    { "write",        (sqlite3_syscall_ptr)write,      0  },
  #define osWrite     ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
-@@ -25861,8 +25873,14 @@
+@@ -25864,8 +25876,14 @@
  #else
    { "pwrite64",     (sqlite3_syscall_ptr)0,          0  },
  #endif
@@ -80,7 +82,7 @@
  
    { "fchmod",       (sqlite3_syscall_ptr)fchmod,     0  },
  #define osFchmod    ((int(*)(int,mode_t))aSyscall[14].pCurrent)
-@@ -29112,7 +29130,7 @@
+@@ -29115,7 +29133,7 @@
    SimulateIOError( rc=1 );
    if( rc!=0 ){
      storeLastErrno((unixFile*)id, errno);
@@ -89,7 +91,7 @@
    }
    *pSize = buf.st_size;
  
-@@ -29148,7 +29166,7 @@
+@@ -29151,7 +29169,7 @@
      struct stat buf;              /* Used to hold return values of fstat() */
     
      if( osFstat(pFile->h, &buf) ){
@@ -98,7 +100,7 @@
      }
  
      nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
-@@ -29733,7 +29751,7 @@
+@@ -29736,7 +29754,7 @@
      ** with the same permissions.
      */
      if( osFstat(pDbFd->h, &sStat) && pInode->bProcessLock==0 ){
@@ -107,7 +109,7 @@
        goto shm_open_err;
      }
  
-@@ -31079,7 +31097,7 @@
+@@ -31082,7 +31100,7 @@
        *pUid = sStat.st_uid;
        *pGid = sStat.st_gid;
      }else{
@@ -116,7 +118,7 @@
      }
    }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
      *pMode = 0600;
-@@ -105873,7 +105891,7 @@
+@@ -105877,7 +105895,7 @@
    }
    if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
      sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -125,7 +127,7 @@
      goto initone_error_out;
    }
  
-@@ -130846,9 +130864,9 @@
+@@ -130850,9 +130868,9 @@
  #endif
  
  #ifdef SQLITE_ENABLE_FTS3
@@ -138,7 +140,7 @@
  #endif
  
  #ifdef SQLITE_ENABLE_ICU
-@@ -136906,16 +136924,28 @@
+@@ -136910,16 +136928,28 @@
    ** module with sqlite.
    */
    if( SQLITE_OK==rc 
diff --git a/dist/orig/shell.c b/dist/orig/shell.c
index 542381a..7db8dbd 100644
--- a/dist/orig/shell.c
+++ b/dist/orig/shell.c
@@ -3258,7 +3258,8 @@
         goto meta_command_exit;
       }
       if( nArg==3 ){
-        sqlite3_limit(p->db, aLimit[iLimit].limitCode, integerValue(azArg[2]));
+        sqlite3_limit(p->db, aLimit[iLimit].limitCode,
+                      (int)integerValue(azArg[2]));
       }
       printf("%20s %d\n", aLimit[iLimit].zLimitName,
              sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
diff --git a/dist/orig/sqlite3.c b/dist/orig/sqlite3.c
index a09cf71..0403df5 100644
--- a/dist/orig/sqlite3.c
+++ b/dist/orig/sqlite3.c
@@ -1,6 +1,6 @@
 /******************************************************************************
 ** This file is an amalgamation of many separate C source files from SQLite
-** version 3.8.10.  By combining all the individual C code files into this 
+** version 3.8.10.2.  By combining all the individual C code files into this 
 ** single large file, the entire code can be compiled as a single translation
 ** unit.  This allows many compilers to do optimizations that would not be
 ** possible if the files were compiled separately.  Performance improvements
@@ -318,9 +318,9 @@
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.8.10"
+#define SQLITE_VERSION        "3.8.10.2"
 #define SQLITE_VERSION_NUMBER 3008010
-#define SQLITE_SOURCE_ID      "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
+#define SQLITE_SOURCE_ID      "2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -14126,6 +14126,9 @@
 #if SQLITE_ENABLE_COLUMN_METADATA
   "ENABLE_COLUMN_METADATA",
 #endif
+#if SQLITE_ENABLE_DBSTAT_VTAB
+  "ENABLE_DBSTAT_VTAB",
+#endif
 #if SQLITE_ENABLE_EXPENSIVE_ASSERT
   "ENABLE_EXPENSIVE_ASSERT",
 #endif
@@ -71036,6 +71039,7 @@
     if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
       sqlite3VdbeMemStringify(pRec, enc, 1);
     }
+    pRec->flags &= ~(MEM_Real|MEM_Int);
   }
 }
 
@@ -155333,6 +155337,7 @@
 struct StatTable {
   sqlite3_vtab base;
   sqlite3 *db;
+  int iDb;                        /* Index of database to analyze */
 };
 
 #ifndef get2byte
@@ -155351,7 +155356,17 @@
 ){
   StatTable *pTab = 0;
   int rc = SQLITE_OK;
+  int iDb;
 
+  if( argc>=4 ){
+    iDb = sqlite3FindDbName(db, argv[3]);
+    if( iDb<0 ){
+      *pzErr = sqlite3_mprintf("no such database: %s", argv[3]);
+      return SQLITE_ERROR;
+    }
+  }else{
+    iDb = 0;
+  }
   rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
   if( rc==SQLITE_OK ){
     pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
@@ -155362,6 +155377,7 @@
   if( rc==SQLITE_OK ){
     memset(pTab, 0, sizeof(StatTable));
     pTab->db = db;
+    pTab->iDb = iDb;
   }
 
   *ppVtab = (sqlite3_vtab*)pTab;
@@ -155416,16 +155432,22 @@
   if( pCsr==0 ){
     rc = SQLITE_NOMEM;
   }else{
+    char *zSql;
     memset(pCsr, 0, sizeof(StatCursor));
     pCsr->base.pVtab = pVTab;
 
-    rc = sqlite3_prepare_v2(pTab->db, 
+    zSql = sqlite3_mprintf(
         "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
         "  UNION ALL  "
-        "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
-        "  ORDER BY name", -1,
-        &pCsr->pStmt, 0
-        );
+        "SELECT name, rootpage, type"
+        "  FROM \"%w\".sqlite_master WHERE rootpage!=0"
+        "  ORDER BY name", pTab->db->aDb[pTab->iDb].zName);
+    if( zSql==0 ){
+      rc = SQLITE_NOMEM;
+    }else{
+      rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
+      sqlite3_free(zSql);
+    }
     if( rc!=SQLITE_OK ){
       sqlite3_free(pCsr);
       pCsr = 0;
@@ -155591,7 +155613,7 @@
 */
 static void statSizeAndOffset(StatCursor *pCsr){
   StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
-  Btree *pBt = pTab->db->aDb[0].pBt;
+  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   Pager *pPager = sqlite3BtreePager(pBt);
   sqlite3_file *fd;
   sqlite3_int64 x[2];
@@ -155605,7 +155627,7 @@
   */
   fd = sqlite3PagerFile(pPager);
   x[0] = pCsr->iPageno;
-  if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
+  if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
     pCsr->iOffset = x[0];
     pCsr->szPage = (int)x[1];
   }
@@ -155617,9 +155639,10 @@
 static int statNext(sqlite3_vtab_cursor *pCursor){
   int rc;
   int nPayload;
+  char *z;
   StatCursor *pCsr = (StatCursor *)pCursor;
   StatTable *pTab = (StatTable *)pCursor->pVtab;
-  Btree *pBt = pTab->db->aDb[0].pBt;
+  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   Pager *pPager = sqlite3BtreePager(pBt);
 
   sqlite3_free(pCsr->zPath);
@@ -155639,8 +155662,9 @@
       rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
       pCsr->aPage[0].iPgno = iRoot;
       pCsr->aPage[0].iCell = 0;
-      pCsr->aPage[0].zPath = sqlite3_mprintf("/");
+      pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
       pCsr->iPage = 0;
+      if( z==0 ) rc = SQLITE_NOMEM;
     }else{
       pCsr->isEof = 1;
       return sqlite3_reset(pCsr->pStmt);
@@ -155663,7 +155687,7 @@
         pCsr->zPagetype = "overflow";
         pCsr->nCell = 0;
         pCsr->nMxPayload = 0;
-        pCsr->zPath = sqlite3_mprintf(
+        pCsr->zPath = z = sqlite3_mprintf(
             "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
         );
         if( pCell->iOvfl<pCell->nOvfl-1 ){
@@ -155675,7 +155699,7 @@
         }
         pCell->iOvfl++;
         statSizeAndOffset(pCsr);
-        return SQLITE_OK;
+        return z==0 ? SQLITE_NOMEM : SQLITE_OK;
       }
       if( p->iRightChildPg ) break;
       p->iCell++;
@@ -155697,8 +155721,9 @@
     }
     rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
     p[1].iCell = 0;
-    p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
+    p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
     p->iCell++;
+    if( z==0 ) rc = SQLITE_NOMEM;
   }
 
 
@@ -155731,7 +155756,8 @@
       pCsr->nCell = p->nCell;
       pCsr->nUnused = p->nUnused;
       pCsr->nMxPayload = p->nMxPayload;
-      pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
+      pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
+      if( z==0 ) rc = SQLITE_NOMEM;
       nPayload = 0;
       for(i=0; i<p->nCell; i++){
         nPayload += p->aCell[i].nLocal;
@@ -155767,7 +155793,7 @@
   StatCursor *pCsr = (StatCursor *)pCursor;
   switch( i ){
     case 0:            /* name */
-      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
+      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);
       break;
     case 1:            /* path */
       sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
@@ -155793,7 +155819,8 @@
     case 8:            /* pgoffset */
       sqlite3_result_int64(ctx, pCsr->iOffset);
       break;
-    case 9:            /* pgsize */
+    default:           /* pgsize */
+      assert( i==9 );
       sqlite3_result_int(ctx, pCsr->szPage);
       break;
   }
diff --git a/dist/orig/sqlite3.h b/dist/orig/sqlite3.h
index edb9e9c..d43b63c 100644
--- a/dist/orig/sqlite3.h
+++ b/dist/orig/sqlite3.h
@@ -111,9 +111,9 @@
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.8.10"
+#define SQLITE_VERSION        "3.8.10.2"
 #define SQLITE_VERSION_NUMBER 3008010
-#define SQLITE_SOURCE_ID      "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
+#define SQLITE_SOURCE_ID      "2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
diff --git a/dist/shell.c b/dist/shell.c
index 42f03fa..93938ac 100644
--- a/dist/shell.c
+++ b/dist/shell.c
@@ -54,6 +54,7 @@
 #include <stdarg.h>
 // Begin Android Add
 #ifndef NO_ANDROID_FUNCS
+#include "IcuUtils.h"
 #include <sqlite3_android.h>
 #endif
 // End Android Add
@@ -1946,6 +1947,7 @@
 
     // 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");
@@ -3278,7 +3280,8 @@
         goto meta_command_exit;
       }
       if( nArg==3 ){
-        sqlite3_limit(p->db, aLimit[iLimit].limitCode, integerValue(azArg[2]));
+        sqlite3_limit(p->db, aLimit[iLimit].limitCode,
+                      (int)integerValue(azArg[2]));
       }
       printf("%20s %d\n", aLimit[iLimit].zLimitName,
              sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index 4504ce3..008512c 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -1,6 +1,6 @@
 /******************************************************************************
 ** This file is an amalgamation of many separate C source files from SQLite
-** version 3.8.10.  By combining all the individual C code files into this 
+** version 3.8.10.2.  By combining all the individual C code files into this 
 ** single large file, the entire code can be compiled as a single translation
 ** unit.  This allows many compilers to do optimizations that would not be
 ** possible if the files were compiled separately.  Performance improvements
@@ -318,9 +318,9 @@
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.8.10"
+#define SQLITE_VERSION        "3.8.10.2"
 #define SQLITE_VERSION_NUMBER 3008010
-#define SQLITE_SOURCE_ID      "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
+#define SQLITE_SOURCE_ID      "2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -14126,6 +14126,9 @@
 #if SQLITE_ENABLE_COLUMN_METADATA
   "ENABLE_COLUMN_METADATA",
 #endif
+#if SQLITE_ENABLE_DBSTAT_VTAB
+  "ENABLE_DBSTAT_VTAB",
+#endif
 #if SQLITE_ENABLE_EXPENSIVE_ASSERT
   "ENABLE_EXPENSIVE_ASSERT",
 #endif
@@ -71054,6 +71057,7 @@
     if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
       sqlite3VdbeMemStringify(pRec, enc, 1);
     }
+    pRec->flags &= ~(MEM_Real|MEM_Int);
   }
 }
 
@@ -155363,6 +155367,7 @@
 struct StatTable {
   sqlite3_vtab base;
   sqlite3 *db;
+  int iDb;                        /* Index of database to analyze */
 };
 
 #ifndef get2byte
@@ -155381,7 +155386,17 @@
 ){
   StatTable *pTab = 0;
   int rc = SQLITE_OK;
+  int iDb;
 
+  if( argc>=4 ){
+    iDb = sqlite3FindDbName(db, argv[3]);
+    if( iDb<0 ){
+      *pzErr = sqlite3_mprintf("no such database: %s", argv[3]);
+      return SQLITE_ERROR;
+    }
+  }else{
+    iDb = 0;
+  }
   rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
   if( rc==SQLITE_OK ){
     pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
@@ -155392,6 +155407,7 @@
   if( rc==SQLITE_OK ){
     memset(pTab, 0, sizeof(StatTable));
     pTab->db = db;
+    pTab->iDb = iDb;
   }
 
   *ppVtab = (sqlite3_vtab*)pTab;
@@ -155446,16 +155462,22 @@
   if( pCsr==0 ){
     rc = SQLITE_NOMEM;
   }else{
+    char *zSql;
     memset(pCsr, 0, sizeof(StatCursor));
     pCsr->base.pVtab = pVTab;
 
-    rc = sqlite3_prepare_v2(pTab->db, 
+    zSql = sqlite3_mprintf(
         "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
         "  UNION ALL  "
-        "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
-        "  ORDER BY name", -1,
-        &pCsr->pStmt, 0
-        );
+        "SELECT name, rootpage, type"
+        "  FROM \"%w\".sqlite_master WHERE rootpage!=0"
+        "  ORDER BY name", pTab->db->aDb[pTab->iDb].zName);
+    if( zSql==0 ){
+      rc = SQLITE_NOMEM;
+    }else{
+      rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
+      sqlite3_free(zSql);
+    }
     if( rc!=SQLITE_OK ){
       sqlite3_free(pCsr);
       pCsr = 0;
@@ -155621,7 +155643,7 @@
 */
 static void statSizeAndOffset(StatCursor *pCsr){
   StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
-  Btree *pBt = pTab->db->aDb[0].pBt;
+  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   Pager *pPager = sqlite3BtreePager(pBt);
   sqlite3_file *fd;
   sqlite3_int64 x[2];
@@ -155635,7 +155657,7 @@
   */
   fd = sqlite3PagerFile(pPager);
   x[0] = pCsr->iPageno;
-  if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
+  if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
     pCsr->iOffset = x[0];
     pCsr->szPage = (int)x[1];
   }
@@ -155647,9 +155669,10 @@
 static int statNext(sqlite3_vtab_cursor *pCursor){
   int rc;
   int nPayload;
+  char *z;
   StatCursor *pCsr = (StatCursor *)pCursor;
   StatTable *pTab = (StatTable *)pCursor->pVtab;
-  Btree *pBt = pTab->db->aDb[0].pBt;
+  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   Pager *pPager = sqlite3BtreePager(pBt);
 
   sqlite3_free(pCsr->zPath);
@@ -155669,8 +155692,9 @@
       rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
       pCsr->aPage[0].iPgno = iRoot;
       pCsr->aPage[0].iCell = 0;
-      pCsr->aPage[0].zPath = sqlite3_mprintf("/");
+      pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
       pCsr->iPage = 0;
+      if( z==0 ) rc = SQLITE_NOMEM;
     }else{
       pCsr->isEof = 1;
       return sqlite3_reset(pCsr->pStmt);
@@ -155693,7 +155717,7 @@
         pCsr->zPagetype = "overflow";
         pCsr->nCell = 0;
         pCsr->nMxPayload = 0;
-        pCsr->zPath = sqlite3_mprintf(
+        pCsr->zPath = z = sqlite3_mprintf(
             "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
         );
         if( pCell->iOvfl<pCell->nOvfl-1 ){
@@ -155705,7 +155729,7 @@
         }
         pCell->iOvfl++;
         statSizeAndOffset(pCsr);
-        return SQLITE_OK;
+        return z==0 ? SQLITE_NOMEM : SQLITE_OK;
       }
       if( p->iRightChildPg ) break;
       p->iCell++;
@@ -155727,8 +155751,9 @@
     }
     rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
     p[1].iCell = 0;
-    p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
+    p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
     p->iCell++;
+    if( z==0 ) rc = SQLITE_NOMEM;
   }
 
 
@@ -155761,7 +155786,8 @@
       pCsr->nCell = p->nCell;
       pCsr->nUnused = p->nUnused;
       pCsr->nMxPayload = p->nMxPayload;
-      pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
+      pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
+      if( z==0 ) rc = SQLITE_NOMEM;
       nPayload = 0;
       for(i=0; i<p->nCell; i++){
         nPayload += p->aCell[i].nLocal;
@@ -155797,7 +155823,7 @@
   StatCursor *pCsr = (StatCursor *)pCursor;
   switch( i ){
     case 0:            /* name */
-      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
+      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);
       break;
     case 1:            /* path */
       sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
@@ -155823,7 +155849,8 @@
     case 8:            /* pgoffset */
       sqlite3_result_int64(ctx, pCsr->iOffset);
       break;
-    case 9:            /* pgsize */
+    default:           /* pgsize */
+      assert( i==9 );
       sqlite3_result_int(ctx, pCsr->szPage);
       break;
   }
diff --git a/dist/sqlite3.h b/dist/sqlite3.h
index edb9e9c..d43b63c 100644
--- a/dist/sqlite3.h
+++ b/dist/sqlite3.h
@@ -111,9 +111,9 @@
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.8.10"
+#define SQLITE_VERSION        "3.8.10.2"
 #define SQLITE_VERSION_NUMBER 3008010
-#define SQLITE_SOURCE_ID      "2015-05-07 11:53:08 cf975957b9ae671f34bb65f049acf351e650d437"
+#define SQLITE_SOURCE_ID      "2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers