diff options
author | drh <> | 2021-06-04 13:40:26 +0000 |
---|---|---|
committer | drh <> | 2021-06-04 13:40:26 +0000 |
commit | 2d26cfcc4adda9d60ccc07488d1c59f1d04e77e7 (patch) | |
tree | 77c80dc9c4c4aedef11206e1ecb098480489b2eb /src/main.c | |
parent | f3c1256a4d339c6c53f0442aa8306e2b3e72aefb (diff) | |
download | sqlite-2d26cfcc4adda9d60ccc07488d1c59f1d04e77e7.tar.gz sqlite-2d26cfcc4adda9d60ccc07488d1c59f1d04e77e7.zip |
Revamp SQLITE_TESTCTRL_TUNE to provide visibility of current turning
parameter values.
FossilOrigin-Name: 677e645e69e1f06487c26da6671fc03f0fb89a0f8e0d35712e6bdcf7279bdfc4
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index 5d50a1681..732c085a9 100644 --- a/src/main.c +++ b/src/main.c @@ -4285,11 +4285,12 @@ int sqlite3_test_control(int op, ...){ } #ifdef SQLITE_DEBUG - /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, val) + /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue) ** - ** "id" must be an integer between 0 and SQLITE_NTUNE-1. "val" - ** is a 64-bit signed integer. This test-control sets tuning parameter - ** id to the value val. + ** If "id" is an integer between 1 and SQLITE_NTUNE then set the value + ** of the id-th tuning parameter to *piValue. If "id" is between -1 + ** and -SQLITE_NTUNE, then write the current value of the (-id)-th + ** tuning parameter into *piValue. ** ** Tuning parameters are for use during transient development builds, ** to help find the best values for constants in the query planner. @@ -4301,8 +4302,14 @@ int sqlite3_test_control(int op, ...){ */ case SQLITE_TESTCTRL_TUNE: { int id = va_arg(ap, int); - int val = va_arg(ap, sqlite3_int64); - if( id>=0 && id<SQLITE_NTUNE ) Tuning(id) = val; + int *piValue = va_arg(ap, int*); + if( id>0 && id<=SQLITE_NTUNE ){ + Tuning(id) = *piValue; + }else if( id<0 && id>=-SQLITE_NTUNE ){ + *piValue = Tuning(-id); + }else{ + rc = SQLITE_NOTFOUND; + } break; } #endif |