aboutsummaryrefslogtreecommitdiff
path: root/src/treeview.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2017-11-14 23:48:23 +0000
committerdrh <drh@noemail.net>2017-11-14 23:48:23 +0000
commit8c0833fb218ef0b3fb89bef2b9600834e74cf8b7 (patch)
tree119a11cfc91a95d6fc4f4da4cceccb7f908089ef /src/treeview.c
parent65efeaca833662bdeb40240f24f99d5a8e287af2 (diff)
downloadsqlite-8c0833fb218ef0b3fb89bef2b9600834e74cf8b7.tar.gz
sqlite-8c0833fb218ef0b3fb89bef2b9600834e74cf8b7.zip
In the parse tree, combine LIMIT and OFFSET into a single expression rooted
on a TK_LIMIT node, for a small code size reduction and performance increase, and a reduction in code complexity. FossilOrigin-Name: 3925facd942c9df663f9b29b1e6f94f6be14af8c2b99eb691bfc836b4c220826
Diffstat (limited to 'src/treeview.c')
-rw-r--r--src/treeview.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/treeview.c b/src/treeview.c
index ba9fa7b2f..8d171a473 100644
--- a/src/treeview.c
+++ b/src/treeview.c
@@ -153,7 +153,6 @@ void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
if( p->pHaving ) n++;
if( p->pOrderBy ) n++;
if( p->pLimit ) n++;
- if( p->pOffset ) n++;
}
sqlite3TreeViewExprList(pView, p->pEList, (n--)>0, "result-set");
if( p->pSrc && p->pSrc->nSrc ){
@@ -210,12 +209,12 @@ void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
}
if( p->pLimit ){
sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
- sqlite3TreeViewExpr(pView, p->pLimit, 0);
- sqlite3TreeViewPop(pView);
- }
- if( p->pOffset ){
- sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
- sqlite3TreeViewExpr(pView, p->pOffset, 0);
+ sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
+ if( p->pLimit->pRight ){
+ sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
+ sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
+ sqlite3TreeViewPop(pView);
+ }
sqlite3TreeViewPop(pView);
}
if( p->pPrior ){