SQLite

Check-in [3b155855f3]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3b155855f3d5918f1df7dbd19783215b3da0ca3e
User & Date: drh 2015-11-30 19:15:25.436
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: 8cfb7a50bb 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: 3b155855f3 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: 47f10b7e5d user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/threadtest3.c.
864
865
866
867
868
869
870



871










872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
  }
}

/* 
** Used by setstoptime() and timetostop().
*/
static double timelimit = 0.0;



static sqlite3_vfs *pTimelimitVfs = 0;











static void setstoptime_x(
  Error *pErr,                    /* IN/OUT: Error code */
  int nMs                         /* Milliseconds until "stop time" */
){
  if( pErr->rc==SQLITE_OK ){
    double t;
    int rc;
    pTimelimitVfs = sqlite3_vfs_find(0);
    rc = pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
    if( rc!=SQLITE_OK ){
      pErr->rc = rc;
    }else{
      timelimit = t + ((double)nMs)/(1000.0*60.0*60.0*24.0);
    }
  }
}

static int timetostop_x(
  Error *pErr                     /* IN/OUT: Error code */
){
  int ret = 1;
  if( pErr->rc==SQLITE_OK ){
    double t;
    int rc;
    rc = pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
    if( rc!=SQLITE_OK ){
      pErr->rc = rc;
    }else{
      ret = (t >= timelimit);
    }
  }
  return ret;
}


/*************************************************************************
**************************************************************************







>
>
>
|
>
>
>
>
>
>
>
>
>
>






|
<
<
<
<
<
<
|
<








|
<
<
<
<
<
|
<







864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891






892

893
894
895
896
897
898
899
900
901





902

903
904
905
906
907
908
909
  }
}

/* 
** Used by setstoptime() and timetostop().
*/
static double timelimit = 0.0;

static double currentTime(void){
  double t;
  static sqlite3_vfs *pTimelimitVfs = 0;
  if( pTimelimitVfs==0 ) pTimelimitVfs = sqlite3_vfs_find(0);
  if( pTimelimitVfs->iVersion>=1 && pTimelimitVfs->xCurrentTimeInt64!=0 ){
    sqlite3_int64 tm;
    pTimelimitVfs->xCurrentTimeInt64(pTimelimitVfs, &tm);
    t = tm/86400000.0;
  }else{
    pTimelimitVfs->xCurrentTime(pTimelimitVfs, &t);
  }
  return t;
}

static void setstoptime_x(
  Error *pErr,                    /* IN/OUT: Error code */
  int nMs                         /* Milliseconds until "stop time" */
){
  if( pErr->rc==SQLITE_OK ){
    double t = currentTime();






    timelimit = t + ((double)nMs)/(1000.0*60.0*60.0*24.0);

  }
}

static int timetostop_x(
  Error *pErr                     /* IN/OUT: Error code */
){
  int ret = 1;
  if( pErr->rc==SQLITE_OK ){
    double t = currentTime();





    ret = (t >= timelimit);

  }
  return ret;
}


/*************************************************************************
**************************************************************************