]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the SQLITE_CONFIG_NO_ROWID_IN_VIEW configuration option to be
authordrh <>
Tue, 19 Mar 2024 23:01:56 +0000 (23:01 +0000)
committerdrh <>
Tue, 19 Mar 2024 23:01:56 +0000 (23:01 +0000)
just SQLITE_CONFIG_ROWID_IN_VIEW (without the "_NO_" in the middle) and give
it the ability to turn the option on and off.  Otherwise, it is difficult
to test.

FossilOrigin-Name: 5d412edc2e378999ad798d1d7d73c7f7a17ee4e3c751a0dd00b9d5ce32759550

manifest
manifest.uuid
src/main.c
src/select.c
src/shell.c.in
src/sqlite.h.in

index 3a9d2898658cd005c29a452df5b841be0ce8d464..a4d4966bbcb5e769d610db18f8e40f8b0e49c3ff 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Return\sthe\serror\s"ambiguous\scolumn\sname:\srowid",\sinstead\sof\s"no\ssuch\scolumn:\srowid",\swhen\sa\s"rowid"\sreference\sis\sambiguous.
-D 2024-03-19T19:56:39.777
+C Change\sthe\sSQLITE_CONFIG_NO_ROWID_IN_VIEW\sconfiguration\soption\sto\sbe\njust\sSQLITE_CONFIG_ROWID_IN_VIEW\s(without\sthe\s"_NO_"\sin\sthe\smiddle)\sand\sgive\nit\sthe\sability\sto\sturn\sthe\soption\son\sand\soff.\s\sOtherwise,\sit\sis\sdifficult\nto\stest.
+D 2024-03-19T23:01:56.437
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -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 3db8bc4c8e0515b9e23bed3167de8b626a55e9eb1f65fe42b878d820cfa90628
+F src/main.c 8a59d297ec77e6b78550433bfccb95a1b26f2fb69aaaf233206e21579a1cfcc1
 F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -750,9 +750,9 @@ F src/printf.c 87b67bba3662a0523f39ae6b084a3907109702f717c654d6cecb838af5cd57f1
 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c eb1860b134fb044fd819c4347105c148d5aac7c6498032be2829e5cc95619b28
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
-F src/select.c ac3689a3f54f81e8b710ce772c5c49c13a152e4ac484c2429ad5264243e7de66
-F src/shell.c.in 31c3845fae8382e5c9c46a8985b51a444387edf77404ac4db6716493efe2c72f
-F src/sqlite.h.in e9d785f9d17f2caa366641d6616748310c8092cc0746f064c8cf5bcc767bcab0
+F src/select.c a83532bae45185f271b59babf715a31a831ac17e2b4bc061f52ee53825c688f1
+F src/shell.c.in 0354ca51eee5fbf6af394a7ef9f5ef6823ef45b743db65431f6777e4d5be2199
+F src/sqlite.h.in f099b625b073ba250ff9f0feb4d7d0fb570ac1b9584584009ff4951f729e147c
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
 F src/sqliteInt.h f8928f0397d797046396dd9d360a6af8ce6dcb48bd72ea290165b07c8c518744
@@ -2180,9 +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 134da9c348a5e3b5cef97b79f37d48257afd4fa958a84f6930ac9874284a14cd 021f34fcfed41b607be8169bbda59aef93f130108d944f4741b46e8e345b2bbb
-R be08dcf8f811c87330d104f5ec4dbed8
-T +closed 021f34fcfed41b607be8169bbda59aef93f130108d944f4741b46e8e345b2bbb
+P 0615bdae2dfc70c7e0416a28e89ffde31fa44ed4b3dac46e5ef20eed0d89e58c
+R 0da4f5b6bfe3d8c8b355040cbb4a265d
 U drh
-Z e6cd68fc074ecbc59d0059bf2fbd13d3
+Z c8d34cb65d7a95190f13ea53bc6d7b05
 # Remove this line to create a well-formed Fossil manifest.
index 15c3871d50163cae3cec2eacf78910a9fe66184f..59f541b8183d5835a23a6873e9bc772d95245a0d 100644 (file)
@@ -1 +1 @@
-0615bdae2dfc70c7e0416a28e89ffde31fa44ed4b3dac46e5ef20eed0d89e58c
\ No newline at end of file
+5d412edc2e378999ad798d1d7d73c7f7a17ee4e3c751a0dd00b9d5ce32759550
\ No newline at end of file
index 6c8ae5b28123ad843771d6da8ed7590d4c63c38e..bff801a87df602d85ce671f5f78a8238ea875bf1 100644 (file)
@@ -765,9 +765,14 @@ int sqlite3_config(int op, ...){
     }
 #endif /* SQLITE_OMIT_DESERIALIZE */
 
-    case SQLITE_CONFIG_NO_ROWID_IN_VIEW: {
+    case SQLITE_CONFIG_ROWID_IN_VIEW: {
+      int *pVal = va_arg(ap,int*);
 #ifdef SQLITE_ALLOW_ROWID_IN_VIEW
-      sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid;
+      if( 0==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid;
+      if( 1==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = 0;
+      *pVal = (sqlite3GlobalConfig.mNoVisibleRowid==0);
+#else
+      *pVal = 0;
 #endif
       break;
     }
index f71b7155177023822d5acc077f0d69224b2e933f..8d3c69ebb97f7dbffd2f14c06fe53655dd22aeab 100644 (file)
@@ -6254,7 +6254,8 @@ static int selectExpander(Walker *pWalker, Select *p){
             pX = &pNew->a[pNew->nExpr-1];
             assert( pX->zEName==0 );
             if( (selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){
-              if( pNestedFrom && j<pNestedFrom->nExpr ){
+              if( pNestedFrom && (!ViewCanHaveRowid || j<pNestedFrom->nExpr) ){
+                assert( j<pNestedFrom->nExpr );
                 pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName);
                 testcase( pX->zEName==0 );
               }else{
index 9a86a06659893183cdc899456624e63484da73ca..2f91ac8ba1eac75ee7b0d554e2ba8b6ee2b55ac8 100644 (file)
@@ -12350,7 +12350,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
     }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);
+      int val = 0;
+      sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
+      assert( val==0 );
     }else if( cli_strcmp(z,"-heap")==0 ){
 #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
       const char *zSize;
index 9c9a78c453e0ccadcf3295bc26195e18bf54a482..811ea3c5ef6842e643446999db91cf111c57a9c6 100644 (file)
@@ -2144,15 +2144,20 @@ struct sqlite3_mem_methods {
 ** 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.
+** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
+** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
+** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables are disables the ability
+** for VIEWs to have a ROWID.  The capability can only be abled if SQLite is
+** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case it the capability
+** defaults to on.  This configuration option queries the current setting or
+** changes the setting to off or on.  The argument is a pointer to an integer.
+** If that integer initially holds a value of 1, then the ability for VIEWs to
+** have ROWIDs is activated.  If the integer initially holds zero, then the
+** ability is deactivated.  After any changes, the integer is written with
+** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off.  If SQLite
+** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
+** recommended case) then the integer is always filled with zero, regardless
+** if its initial value.
 ** </dl>
 */
 #define SQLITE_CONFIG_SINGLETHREAD         1  /* nil */
@@ -2184,7 +2189,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 */
+#define SQLITE_CONFIG_ROWID_IN_VIEW       30  /* int* */
 
 /*
 ** CAPI3REF: Database Connection Configuration Options