SQLite

Check-in [dc8118cd89]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When the multiplexor FileSize procedure fails to open the file, assume that the file is zero bytes in size.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | nx-devkit
Files: files | file ages | folders
SHA1: dc8118cd89da71f2035c6ee07c0edb772bba2186
User & Date: drh 2011-12-13 02:41:13.433
Context
2011-12-13
04:08
When an sqlite3_auto_extension() function fails, report back its actual error code, not the generic SQLITE_ERROR. (check-in: ce55f250f5 user: drh tags: nx-devkit)
02:41
When the multiplexor FileSize procedure fails to open the file, assume that the file is zero bytes in size. (check-in: dc8118cd89 user: drh tags: nx-devkit)
01:34
Add a compile-time shutdown procedure to be called by sqlite3_shutdown() to undo the effects of the compile-time initialization procedure. (check-in: c2ed86f594 user: drh tags: nx-devkit)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_multiplex.c.
794
795
796
797
798
799
800

801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
*/
static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){
  multiplexConn *p = (multiplexConn*)pConn;
  multiplexGroup *pGroup = p->pGroup;
  int rc = SQLITE_OK;
  int rc2;
  int i;

  multiplexEnter();
  if( !pGroup->bEnabled ){
    sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL);
    if( pSubOpen==0 ){
      rc = SQLITE_IOERR_FSTAT;
    }else{
      rc = pSubOpen->pMethods->xFileSize(pSubOpen, pSize);
    }
  }else{
    sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;
    *pSize = 0;
    for(i=0; 1; i++){
      sqlite3_file *pSubOpen = 0;
      int exists = 0;
      rc = multiplexSubFilename(pGroup, i);
      if( rc ) break;
      if( pGroup->flags & SQLITE_OPEN_DELETEONCLOSE ){
        exists = pGroup->nReal>=i && pGroup->aReal[i].p!=0;
        rc2 = SQLITE_OK;
      }else{
        rc2 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[i].z,
            SQLITE_ACCESS_EXISTS, &exists);
      }







>




|










|







794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
*/
static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){
  multiplexConn *p = (multiplexConn*)pConn;
  multiplexGroup *pGroup = p->pGroup;
  int rc = SQLITE_OK;
  int rc2;
  int i;
  *pSize = 0;
  multiplexEnter();
  if( !pGroup->bEnabled ){
    sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL);
    if( pSubOpen==0 ){
      rc = SQLITE_OK;  /* If SubOpen failed, assume a size of zero */
    }else{
      rc = pSubOpen->pMethods->xFileSize(pSubOpen, pSize);
    }
  }else{
    sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs;
    *pSize = 0;
    for(i=0; 1; i++){
      sqlite3_file *pSubOpen = 0;
      int exists = 0;
      rc = multiplexSubFilename(pGroup, i);
      if( rc ){ rc = SQLITE_OK; /* Assume size of zero */ break; }
      if( pGroup->flags & SQLITE_OPEN_DELETEONCLOSE ){
        exists = pGroup->nReal>=i && pGroup->aReal[i].p!=0;
        rc2 = SQLITE_OK;
      }else{
        rc2 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[i].z,
            SQLITE_ACCESS_EXISTS, &exists);
      }