Change the SQLITE_CONFIG_NO_ROWID_IN_VIEW configuration option to be

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
This commit is contained in:
drh
2024-03-19 23:01:56 +00:00
parent 36f01f2ee3
commit 254729edb7
6 changed files with 37 additions and 25 deletions
+7 -2
View 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;
}
+2 -1
View 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{
+3 -1
View 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;
+15 -10
View 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