aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <>2024-08-20 23:11:28 +0000
committerdrh <>2024-08-20 23:11:28 +0000
commit5648d717b15c1722ff19e7af1e55d68d1d172f1d (patch)
tree971f2c19f00ab2073124d4ecedaa7df3f0b42509 /src/printf.c
parent781163aa9dce91608ba33af479564f83dda1bd40 (diff)
parenta0651b370706e58f9014453c5f36124ca8a738c9 (diff)
downloadsqlite-5648d717b15c1722ff19e7af1e55d68d1d172f1d.tar.gz
sqlite-5648d717b15c1722ff19e7af1e55d68d1d172f1d.zip
Refactor the SrcItem object to move fields associated with subqueries out
into a separate object named Subquery. This reduces the size of the SrcItem object by about 1/3rd and provides improved performance. FossilOrigin-Name: 484bcd75bc95491d8540c791c1c4d40d996cb465839564662e14f98739699bf1
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/printf.c b/src/printf.c
index c0dcc5d0f..a14056514 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -848,16 +848,19 @@ void sqlite3_str_vappendf(
if( pItem->zAlias && !flag_altform2 ){
sqlite3_str_appendall(pAccum, pItem->zAlias);
}else if( pItem->zName ){
- if( pItem->zDatabase ){
- sqlite3_str_appendall(pAccum, pItem->zDatabase);
+ if( pItem->fg.fixedSchema==0
+ && pItem->fg.isSubquery==0
+ && pItem->u4.zDatabase!=0
+ ){
+ sqlite3_str_appendall(pAccum, pItem->u4.zDatabase);
sqlite3_str_append(pAccum, ".", 1);
}
sqlite3_str_appendall(pAccum, pItem->zName);
}else if( pItem->zAlias ){
sqlite3_str_appendall(pAccum, pItem->zAlias);
- }else{
- Select *pSel = pItem->pSelect;
- assert( pSel!=0 ); /* Because of tag-20240424-1 */
+ }else if( ALWAYS(pItem->fg.isSubquery) ){/* Because of tag-20240424-1 */
+ Select *pSel = pItem->u4.pSubq->pSelect;
+ assert( pSel!=0 );
if( pSel->selFlags & SF_NestedFrom ){
sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
}else if( pSel->selFlags & SF_MultiValue ){