1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Allow "main" to be used to refer to the main database even after SQLITE_DBCONFIG_MAINDBNAME has been used to assign another alias.

FossilOrigin-Name: 75c85ca32f9ae4a28fd8f8ff2f7639599413d22af706e9799a0e76cc560d14eb
This commit is contained in:
dan
2020-03-20 20:54:28 +00:00
parent ec8e689a20
commit 00bd55e1ae
15 changed files with 159 additions and 95 deletions

View File

@@ -227,6 +227,9 @@ static int lookupName(
assert( zCol ); /* The Z in X.Y.Z cannot be NULL */
assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
static int nCall = 0;
nCall++;
/* Initialize the node to no-match */
pExpr->iTable = -1;
ExprSetVVAProperty(pExpr, EP_NoReduce);
@@ -252,6 +255,12 @@ static int lookupName(
break;
}
}
if( i==db->nDb && sqlite3StrICmp("main", zDb)==0 ){
/* This branch is taken when the main database has been renamed
** using SQLITE_DBCONFIG_MAINDBNAME. */
pSchema = db->aDb[0].pSchema;
zDb = db->aDb[0].zDbSName;
}
}
}