aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-12 22:11:33 +0000
committerdrh <drh@noemail.net>2019-12-12 22:11:33 +0000
commitcbb9da337e7f8dc4e6bea59399a0394ec390f1f2 (patch)
tree9e2fc1883495a5eeb3e2ad2e5167486fd567afed /src/sqliteInt.h
parentc947d6a4dcdfe6f0185a22464cf97153cabb8052 (diff)
downloadsqlite-cbb9da337e7f8dc4e6bea59399a0394ec390f1f2.tar.gz
sqlite-cbb9da337e7f8dc4e6bea59399a0394ec390f1f2.zip
Work toward reducing the incremental size of an ExprList object to 24-byte
per entry, from 32-bytes (on a 64-bit machine). This helps the new mini-lookaside allocator to run better by avoiding excessive reallocs. The current change mostly works, but still has a few loose ends to tie up. This check-in is merely a snapshot to save my work. FossilOrigin-Name: fdda76cfb01bf2b19522ac4558b443634d28a69b0828677c42682b645eae1f3b
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 3de659f79..7425b2988 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2650,23 +2650,28 @@ struct Expr {
** also be used as the argument to a function, in which case the a.zName
** field is not used.
**
-** By default the Expr.zSpan field holds a human-readable description of
-** the expression that is used in the generation of error messages and
-** column labels. In this case, Expr.zSpan is typically the text of a
-** column expression as it exists in a SELECT statement. However, if
-** the bSpanIsTab flag is set, then zSpan is overloaded to mean the name
-** of the result column in the form: DATABASE.TABLE.COLUMN. This later
-** form is used for name resolution with nested FROM clauses.
+** In order to try to keep memory usage down, the Expr.a.zEName field
+** is used for multiple purposes:
+**
+** bNameIsTab bNameIsSpan Usage
+** ---------- ----------- -------------------------
+** false false (1) the AS of result set column
+** (2) COLUMN= of an UPDATE
+**
+** true false DB.TABLE.NAME used to resolve names
+** of subqueries
+**
+** false true Text of the original result set
+** expression.
*/
struct ExprList {
int nExpr; /* Number of expressions on the list */
struct ExprList_item { /* For each expression in the list */
Expr *pExpr; /* The parse tree for this expression */
char *zEName; /* Token associated with this expression */
- char *zSpan; /* Original text of the expression */
u8 sortFlags; /* Mask of KEYINFO_ORDER_* flags */
+ unsigned eEName :2; /* Meaning of zEName */
unsigned done :1; /* A flag to indicate when processing is finished */
- unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */
unsigned reusable :1; /* Constant expression is reusable */
unsigned bSorterRef :1; /* Defer evaluation until after sorting */
unsigned bNulls: 1; /* True if explicit "NULLS FIRST/LAST" */
@@ -2681,6 +2686,13 @@ struct ExprList {
};
/*
+** Allowed values for Expr.a.eEName
+*/
+#define ENAME_NAME 0 /* The AS clause of a result set */
+#define ENAME_SPAN 1 /* Complete text of the result set expression */
+#define ENAME_TAB 2 /* "DB.TABLE.NAME" for the result set */
+
+/*
** An instance of this structure can hold a simple list of identifiers,
** such as the list "a,b,c" in the following statements:
**