aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-10-21 12:54:37 +0000
committerdrh <>2023-10-21 12:54:37 +0000
commit51b358e5e54b9a64d2ee9ecb2f035780e74ddb8c (patch)
tree300bbf7336b1d8cfbbfba230e17d4cad1be3fc9d /src
parenta35a54b82431e7a919af8d80bfda86cab37963c1 (diff)
downloadsqlite-51b358e5e54b9a64d2ee9ecb2f035780e74ddb8c.tar.gz
sqlite-51b358e5e54b9a64d2ee9ecb2f035780e74ddb8c.zip
Add SQLITE_TESTCTRL_FK_NO_ACTION.
FossilOrigin-Name: 563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9
Diffstat (limited to 'src')
-rw-r--r--src/main.c18
-rw-r--r--src/shell.c.in2
-rw-r--r--src/sqlite.h.in1
3 files changed, 21 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 893326c2b..334a3c826 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4170,6 +4170,24 @@ int sqlite3_test_control(int op, ...){
}
#endif
+ /* sqlite3_test_control(SQLITE_TESTCTRL_FK_NO_ACTION, sqlite3 *db, int b);
+ **
+ ** If b is true, then activate the SQLITE_FkNoAction setting. If b is
+ ** false then clearn that setting. If the SQLITE_FkNoAction setting is
+ ** abled, all foreign key ON DELETE and ON UPDATE actions behave as if
+ ** they were NO ACTION, regardless of how they are defined.
+ */
+ case SQLITE_TESTCTRL_FK_NO_ACTION: {
+ sqlite3 *db = va_arg(ap, sqlite3*);
+ int b = va_arg(ap, int);
+ if( b ){
+ db->flags |= SQLITE_FkNoAction;
+ }else{
+ db->flags &= ~SQLITE_FkNoAction;
+ }
+ break;
+ }
+
/*
** sqlite3_test_control(BITVEC_TEST, size, program)
**
diff --git a/src/shell.c.in b/src/shell.c.in
index beea0f9b0..6cd6a18ab 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -10911,6 +10911,7 @@ static int do_meta_command(char *zLine, ShellState *p){
{"byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" },
{"extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" },
/*{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/
+ {"fk_no_action", SQLITE_TESTCTRL_FK_NO_ACTION, 0, "BOOLEAN" },
{"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"},
{"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" },
{"localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" },
@@ -10981,6 +10982,7 @@ static int do_meta_command(char *zLine, ShellState *p){
/* sqlite3_test_control(int, db, int) */
case SQLITE_TESTCTRL_OPTIMIZATIONS:
+ case SQLITE_TESTCTRL_FK_NO_ACTION:
if( nArg==3 ){
unsigned int opt = (unsigned int)strtol(azArg[2], 0, 0);
rc2 = sqlite3_test_control(testctrl, p->db, opt);
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index af648829d..b915ef4fb 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -8245,6 +8245,7 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SAVE 5
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
+#define SQLITE_TESTCTRL_FK_NO_ACTION 7
#define SQLITE_TESTCTRL_BITVEC_TEST 8
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10