aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-03-19 13:55:10 +0000
committerdrh <>2024-03-19 13:55:10 +0000
commit261c6dfe7b32b8a66b91026ac134afb91aada452 (patch)
tree19e28dd4ed0c013984bf98d3493560a081720c62 /src
parent4b42b5259f151aad0ece49b7132a6bc2e40b262f (diff)
downloadsqlite-261c6dfe7b32b8a66b91026ac134afb91aada452.tar.gz
sqlite-261c6dfe7b32b8a66b91026ac134afb91aada452.zip
On second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-time
option SQLITE_CONFIG_NO_ROWID_IN_VIEW. FossilOrigin-Name: b8e045c9e1d098d116f8745704b10ed76569d4b063c0b81cce16bc136930755d
Diffstat (limited to 'src')
-rw-r--r--src/build.c2
-rw-r--r--src/main.c40
-rw-r--r--src/shell.c.in19
-rw-r--r--src/sqlite.h.in12
4 files changed, 23 insertions, 50 deletions
diff --git a/src/build.c b/src/build.c
index 1bc6008ec..e7c23c173 100644
--- a/src/build.c
+++ b/src/build.c
@@ -3007,7 +3007,7 @@ void sqlite3CreateView(
** setting fixes this problem. But the fix can be disabled by compiling
** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that
** depend upon the old buggy behavior. The ability can also be toggled
- ** using SQLITE_TESTCTRL_ROWID_IN_VIEW */
+ ** using SQLITE_CONFIG_NO_ROWID_IN_VIEW */
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
p->tabFlags |= sqlite3Config.mNoVisibleRowid; /* Optional. Allow by default */
#else
diff --git a/src/main.c b/src/main.c
index 67191fb0f..6c8ae5b28 100644
--- a/src/main.c
+++ b/src/main.c
@@ -765,6 +765,13 @@ int sqlite3_config(int op, ...){
}
#endif /* SQLITE_OMIT_DESERIALIZE */
+ case SQLITE_CONFIG_NO_ROWID_IN_VIEW: {
+#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
+ sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid;
+#endif
+ break;
+ }
+
default: {
rc = SQLITE_ERROR;
break;
@@ -4405,39 +4412,6 @@ int sqlite3_test_control(int op, ...){
break;
}
- /* sqlite3_test_control(SQLITE_TESTCTRL_ROWID_IN_VIEW, int *pVal);
- **
- ** Query or set the sqlite3Config.mNoVisibleRowid flag. Cases:
- **
- ** *pVal==1 Allow ROWID in VIEWs
- ** *pVal==0 Disallow ROWID in VIEWs
- ** *pVal<0 No change
- **
- ** In every case *pVal is written with 1 if ROWID is allowd in VIEWs and
- ** 0 if not. Changes to the setting only occur if SQLite is compiled
- ** with -DSQLITE_ALLOW_ROWID_IN_VIEW (hereafter: "SARIV"). With the
- ** "SARIV" compile-time option the default value for this setting is 1.
- ** Otherwise this setting defaults to 0. This setting may only be changed
- ** if SQLite is compiled with "SARIV". Hence, in the normal case when
- ** SQLite is compiled without "SARIV", this test-control is a no-op
- ** that always leaves *pVal set to 0.
- **
- ** IMPORTANT: If you change this setting while a database connection
- ** is option, it is very important to run "PRAGMA writable_schema=RESET"
- ** afterwards in order to reparse all VIEW definitions in the schema.
- */
- case SQLITE_TESTCTRL_ROWID_IN_VIEW: {
- int *pVal = va_arg(ap, int*);
-#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
- if( *pVal==0 ) sqlite3Config.mNoVisibleRowid = TF_NoVisibleRowid;
- if( *pVal==1 ) sqlite3Config.mNoVisibleRowid = 0;
- *pVal = (sqlite3Config.mNoVisibleRowid==0);
-#else
- *pVal = 0;
-#endif
- break;
- }
-
/* sqlite3_test_control(SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, sqlite3*);
**
** Toggle the ability to use internal functions on or off for
diff --git a/src/shell.c.in b/src/shell.c.in
index fbec5a8c9..51769a67d 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -10893,7 +10893,6 @@ static int do_meta_command(char *zLine, ShellState *p){
{"prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE,0, "" },
{"prng_save", SQLITE_TESTCTRL_PRNG_SAVE, 0, "" },
{"prng_seed", SQLITE_TESTCTRL_PRNG_SEED, 0, "SEED ?db?" },
- {"rowid_in_view", SQLITE_TESTCTRL_ROWID_IN_VIEW,0,"?BOOLEAN?" },
{"seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" },
{"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" },
{"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" },
@@ -11068,20 +11067,6 @@ static int do_meta_command(char *zLine, ShellState *p){
break;
}
#endif
- case SQLITE_TESTCTRL_ROWID_IN_VIEW: {
- rc2 = -1;
- if( nArg>=3 ){
- if( !ShellHasFlag(p,SHFLG_TestingMode) ){
- eputz("The --unsafe-testing option is required to change "
- "this setting\n");
- }else{
- rc2 = booleanValue(azArg[2]);
- }
- }
- sqlite3_test_control(testctrl, &rc2);
- isOk = 1;
- break;
- }
#ifdef SQLITE_DEBUG
case SQLITE_TESTCTRL_TUNE: {
if( nArg==4 ){
@@ -12363,6 +12348,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
stdin_is_interactive = 0;
}else if( cli_strcmp(z,"-utf8")==0 ){
}else if( cli_strcmp(z,"-no-utf8")==0 ){
+ }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
+ sqlite3_config(SQLITE_CONFIG_NO_ROWID_IN_VIEW);
}else if( cli_strcmp(z,"-heap")==0 ){
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
const char *zSize;
@@ -12638,6 +12625,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
/* already handled */
}else if( cli_strcmp(z,"-no-utf8")==0 ){
/* already handled */
+ }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
+ /* already handled */
}else if( cli_strcmp(z,"-heap")==0 ){
i++;
}else if( cli_strcmp(z,"-pagecache")==0 ){
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 17a231860..9c9a78c45 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -2143,6 +2143,16 @@ struct sqlite3_mem_methods {
** configuration setting is never used, then the default maximum is determined
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
** compile-time option is not set, then the default maximum is 1073741824.
+**
+** [[SQLITE_CONFIG_NO_ROWID_IN_VIEW]]
+** <dt>SQLITE_CONFIG_NO_ROWID_IN_VIEW
+** <dd>The SQLITE_CONFIG_NO_ROWID_IN_VIEW option prohibits VIEWs from having
+** a ROWID. This is the default behavior and so test sqlite_config() option
+** is normally a no-op. However, if SQLite is compiled with the
+** -DSQLITE_ALLOW_ROWID_IN_VIEW option (not recommended!) then this configuration
+** option will disable that capability and make SQLite operate as it normally
+** would given default the default compile-time options. Once ROWIDs in VIEWs
+** have been disabled using this option, they cannot be reenabled.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2174,6 +2184,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
+#define SQLITE_CONFIG_NO_ROWID_IN_VIEW 30 /* nil */
/*
** CAPI3REF: Database Connection Configuration Options
@@ -8307,7 +8318,6 @@ int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
-#define SQLITE_TESTCTRL_ROWID_IN_VIEW 16
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18