1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-05-28 12:41:31 +03:00

On second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-time

option SQLITE_CONFIG_NO_ROWID_IN_VIEW.

FossilOrigin-Name: b8e045c9e1d098d116f8745704b10ed76569d4b063c0b81cce16bc136930755d
This commit is contained in:
drh 2024-03-19 13:55:10 +00:00
parent 4b42b5259f
commit 261c6dfe7b
6 changed files with 33 additions and 60 deletions

View File

@ -1,5 +1,5 @@
C When\scompiled\swith\sSQLITE_ALLOW_ROWID_IN_VIEW,\srowid-in-view\sis\son\sby\sdefault\nbut\scan\snow\sbe\sturned\soff\susing\sSQLITE_TESTCTRL_ROWID_IN_VIEW.\s\sWithout\sthe\ncompile-time\soption,\srowid-in-view\sis\salways\soff.
D 2024-03-19T13:31:54.376
C On\ssecond\sthought,\schange\sSQLITE_TESTCTRL_ROWID_IN_VIEW\sinto\sa\sstart-time\noption\sSQLITE_CONFIG_NO_ROWID_IN_VIEW.
D 2024-03-19T13:55:10.156
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -692,7 +692,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
F src/btree.c 285b493d843e7ba8ef78b6ae7d31238e904901dbc0c484f7904de4cf18fd8802
F src/btree.h 55066f513eb095db935169dab1dc2f7c7a747ef223c533f5d4ad4dfed346cbd0
F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6
F src/build.c 18b4caf7f4eabf4c46727f476b669505aa67cfd3c3587b0fb82f5b8b69acc0e0
F src/build.c 71445e2d1e2c78b120a20a46d80a29a9ea42370df430efda5bb6ef377e8016c8
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b
@ -713,7 +713,7 @@ F src/insert.c 06ce505713e86172612f9e01febefd2d3331d1f70461b4ada0eae5a76bb6349f
F src/json.c e2e40760d6689134c3e2ece38c6a496b34ff5e2661a8f238444a119af666fdce
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
F src/main.c e7e6e9356ba86713051199968e22ac2c64b1078f266518ca5791dab5fc1af237
F src/main.c 3db8bc4c8e0515b9e23bed3167de8b626a55e9eb1f65fe42b878d820cfa90628
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@ -751,8 +751,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c ef87e3bc7700bfe761a7bbee2ce6084f1766dc816dd82a3ae77c133eec898432
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 6d6301429c1de03d14ccdad371c36464747e4b0245e4a3a48c8e264ccc5f69df
F src/shell.c.in 21d998d82e169acd7905263674afdf4eff690125fcc8bf7766bcc9f463cd1b13
F src/sqlite.h.in 09d55c3707ee5e3e041301fc558de6fc124bd4af6135ea1288d9c30dc43a7fd9
F src/shell.c.in a2ccceb9a250613f8156b098736bd94424c422972a1c1ddda35604531ae1762e
F src/sqlite.h.in e9d785f9d17f2caa366641d6616748310c8092cc0746f064c8cf5bcc767bcab0
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
F src/sqliteInt.h b97455359ea9410d2568d54d752e8e67d1d47fc8968b3d0c8c34ef7cc70d88b7
@ -2180,8 +2180,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 7c46ff640247584f1ea260c062de29a0e49f649d1894a526574c1a479006a1fc
R e5e0882c9142c10ac12b6ecaf695934e
P 8a6196ab29052071be753c5c77ac945c2d62ecc8019c6160f954eafe34ab05a8
R d89345c69403f3ed5d805ef59957407f
U drh
Z 8e31fdf538ff0513b533fb4971fc8443
Z a176e962a21e6476d0fc3787bbf8685d
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
8a6196ab29052071be753c5c77ac945c2d62ecc8019c6160f954eafe34ab05a8
b8e045c9e1d098d116f8745704b10ed76569d4b063c0b81cce16bc136930755d

View File

@ -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

View File

@ -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

View File

@ -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 ){

View File

@ -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