/ Check-in [3b155855]
Login

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

Overview
Comment:Fix the threadtest3 test program so that it works with VFSes that omit the xCurrentTime() method and supply only xCurrentTimeInt64().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3b155855f3d5918f1df7dbd19783215b3da0ca3e
User & Date: drh 2015-11-30 19:15:25
Context
2015-11-30
20:36
The EOVERFLOW errors from fstat() is not possible unless SQLite has been compiled with SQLITE_DISABLE_LFS. check-in: 8cfb7a50 user: drh tags: trunk
19:15
Fix the threadtest3 test program so that it works with VFSes that omit the xCurrentTime() method and supply only xCurrentTimeInt64(). check-in: 3b155855 user: drh tags: trunk
12:01
Add the "colUsed" field to the sqlite3_index_info structure passed to virtual table xBestIndex methods. To indicate the subset of the virtual table columns that may be required by the current scan. check-in: 47f10b7e user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/threadtest3.c.

   864    864     }
   865    865   }
   866    866   
   867    867   /* 
   868    868   ** Used by setstoptime() and timetostop().
   869    869   */
   870    870   static double timelimit = 0.0;
   871         -static sqlite3_vfs *pTimelimitVfs = 0;
          871  +
          872  +static double currentTime(void){
          873  +  double t;
          874  +  static sqlite3_vfs *pTimelimitVfs = 0;
          875  +  if( pTimelimitVfs==0 ) pTimelimitVfs = sqlite3_vfs_find(0);
          876  +  if( pTimelimitVfs->iVersion>=1 && pTimelimitVfs->xCurrentTimeInt64!=0 ){
          877  +    sqlite3_int64 tm;
          878  +    pTimelimitVfs->xCurrentTimeInt64(pTimelimitVfs, &tm);
          879  +    t = tm/86400000.0;
          880  +  }else{
          881  +    pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
          882  +  }
          883  +  return t;
          884  +}
   872    885   
   873    886   static void setstoptime_x(
   874    887     Error *pErr,                    /* IN/OUT: Error code */
   875    888     int nMs                         /* Milliseconds until "stop time" */
   876    889   ){
   877    890     if( pErr->rc==SQLITE_OK ){
   878         -    double t;
   879         -    int rc;
   880         -    pTimelimitVfs = sqlite3_vfs_find(0);
   881         -    rc = pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
   882         -    if( rc!=SQLITE_OK ){
   883         -      pErr->rc = rc;
   884         -    }else{
   885         -      timelimit = t + ((double)nMs)/(1000.0*60.0*60.0*24.0);
   886         -    }
          891  +    double t = currentTime();
          892  +    timelimit = t + ((double)nMs)/(1000.0*60.0*60.0*24.0);
   887    893     }
   888    894   }
   889    895   
   890    896   static int timetostop_x(
   891    897     Error *pErr                     /* IN/OUT: Error code */
   892    898   ){
   893    899     int ret = 1;
   894    900     if( pErr->rc==SQLITE_OK ){
   895         -    double t;
   896         -    int rc;
   897         -    rc = pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
   898         -    if( rc!=SQLITE_OK ){
   899         -      pErr->rc = rc;
   900         -    }else{
   901         -      ret = (t >= timelimit);
   902         -    }
          901  +    double t = currentTime();
          902  +    ret = (t >= timelimit);
   903    903     }
   904    904     return ret;
   905    905   }
   906    906   
   907    907   
   908    908   /*************************************************************************
   909    909   **************************************************************************