aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c9
-rw-r--r--src/select.c3
-rw-r--r--src/shell.c.in4
-rw-r--r--src/sqlite.h.in25
4 files changed, 27 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 6c8ae5b28..bff801a87 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}
diff --git a/src/select.c b/src/select.c
index f71b71551..8d3c69ebb 100644
--- a/src/select.c
+++ b/src/select.c
@@ -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{
diff --git a/src/shell.c.in b/src/shell.c.in
index 9a86a0665..2f91ac8ba 100644
--- a/src/shell.c.in
+++ b/src/shell.c.in
@@ -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;
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 9c9a78c45..811ea3c5e 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -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