aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-12-04 01:17:57 +0000
committerdrh <drh@noemail.net>2020-12-04 01:17:57 +0000
commitc0622a4d0307a30a9eb2aa650722aef1340f04cb (patch)
tree2f0e25db7bc94623e0a25d9ddefc9b7db893597d /src/main.c
parent384f5c26f48b92e8bfcb168381d4a8caf3ea59e7 (diff)
downloadsqlite-c0622a4d0307a30a9eb2aa650722aef1340f04cb.tar.gz
sqlite-c0622a4d0307a30a9eb2aa650722aef1340f04cb.zip
Alternative implementation of ".selecttrace" and ".wheretrace" that uses
a test-control rather than global variables. FossilOrigin-Name: d36d6f2923a2393c751c0ac7634433453be20df7567fd914e57cbb1ae15f68b2
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index cc1464f13..815583acb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4255,7 +4255,28 @@ int sqlite3_test_control(int op, ...){
break;
}
-
+ /* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
+ **
+ ** "ptr" is a pointer to a u32.
+ **
+ ** op==0 Store the current sqlite3SelectTrace in *ptr
+ ** op==1 Set sqlite3SelectTrace to the value *ptr
+ ** op==3 Store the current sqlite3WhereTrace in *ptr
+ ** op==3 Set sqlite3WhereTrace to the value *ptr
+ */
+ case SQLITE_TESTCTRL_TRACEFLAGS: {
+#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
+ int op = va_arg(ap, int);
+ u32 *ptr = va_arg(ap, u32*);
+ switch( op ){
+ case 0: *ptr = sqlite3SelectTrace; break;
+ case 1: sqlite3SelectTrace = *ptr; break;
+ case 2: *ptr = sqlite3WhereTrace; break;
+ case 3: sqlite3WhereTrace = *ptr; break;
+ }
+ break;
+#endif
+ }
}
va_end(ap);
#endif /* SQLITE_UNTESTABLE */