aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <>2021-02-20 14:57:16 +0000
committerdrh <>2021-02-20 14:57:16 +0000
commitf824b41e6431aa645c29a65c23743e0978a9dd3d (patch)
treeb30d35bf5ffb983785a40340e35c8d9a38fea664 /src/sqliteInt.h
parent271d7c2677b4b5a72730d96508044c9d82b16d99 (diff)
downloadsqlite-f824b41e6431aa645c29a65c23743e0978a9dd3d.tar.gz
sqlite-f824b41e6431aa645c29a65c23743e0978a9dd3d.zip
Break out the Cte object from the With object. This will make it simpler
to add new kinds of Cte objects (ex: DML statements) and/or MATERIALIZED keywords in the future. It brings trunk into closer alignment with the experimental as-materialize branch. FossilOrigin-Name: f03efe905d7b40fb25f9f78b874bb56c6d6ccacb60f86b3b199d430d5eade8d2
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 961a6ed86..78bb048fa 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1136,6 +1136,7 @@ typedef struct AutoincInfo AutoincInfo;
typedef struct Bitvec Bitvec;
typedef struct CollSeq CollSeq;
typedef struct Column Column;
+typedef struct Cte Cte;
typedef struct Db Db;
typedef struct DbFixer DbFixer;
typedef struct Schema Schema;
@@ -3874,18 +3875,23 @@ void sqlite3SelectWalkAssert2(Walker*, Select*);
#define WRC_Abort 2 /* Abandon the tree walk */
/*
-** An instance of this structure represents a set of one or more CTEs
-** (common table expressions) created by a single WITH clause.
+** A single common table expression
+*/
+struct Cte {
+ char *zName; /* Name of this CTE */
+ ExprList *pCols; /* List of explicit column names, or NULL */
+ Select *pSelect; /* The definition of this CTE */
+ const char *zCteErr; /* Error message for circular references */
+};
+
+/*
+** An instance of the With object represents a WITH clause containing
+** one or more CTEs (common table expressions).
*/
struct With {
- int nCte; /* Number of CTEs in the WITH clause */
- With *pOuter; /* Containing WITH clause, or NULL */
- struct Cte { /* For each CTE in the WITH clause.... */
- char *zName; /* Name of this CTE */
- ExprList *pCols; /* List of explicit column names, or NULL */
- Select *pSelect; /* The definition of this CTE */
- const char *zCteErr; /* Error message for circular references */
- } a[1];
+ int nCte; /* Number of CTEs in the WITH clause */
+ With *pOuter; /* Containing WITH clause, or NULL */
+ Cte a[1]; /* For each CTE in the WITH clause.... */
};
#ifdef SQLITE_DEBUG
@@ -4891,12 +4897,17 @@ const char *sqlite3JournalModename(int);
int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
#endif
#ifndef SQLITE_OMIT_CTE
- With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*);
+ Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*);
+ void sqlite3CteDelete(sqlite3*,Cte*);
+ With *sqlite3WithAdd(Parse*,With*,Cte*);
void sqlite3WithDelete(sqlite3*,With*);
void sqlite3WithPush(Parse*, With*, u8);
#else
-#define sqlite3WithPush(x,y,z)
-#define sqlite3WithDelete(x,y)
+# define sqlite3CteNew(P,T,E,S) ((void*)0)
+# define sqlite3CteDelete(D,C)
+# define sqlite3CteWithAdd(P,W,C) ((void*)0)
+# define sqlite3WithDelete(x,y)
+# define sqlite3WithPush(x,y,z)
#endif
#ifndef SQLITE_OMIT_UPSERT
Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);