mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-10-30 07:05:46 +03:00 
			
		
		
		
	FossilOrigin-Name: b1b50f315873a8614920d1e3af4a07fb29a7ff6a
This commit is contained in:
		| @@ -11,7 +11,7 @@ | ||||
| ************************************************************************* | ||||
| ** Internal interface definitions for SQLite. | ||||
| ** | ||||
| ** @(#) $Id: sqliteInt.h,v 1.363 2005/01/22 03:03:55 drh Exp $ | ||||
| ** @(#) $Id: sqliteInt.h,v 1.364 2005/01/29 08:32:45 danielk1977 Exp $ | ||||
| */ | ||||
| #ifndef _SQLITEINT_H_ | ||||
| #define _SQLITEINT_H_ | ||||
| @@ -838,6 +838,7 @@ struct Expr { | ||||
| #define EP_Resolved     0x0004  /* IDs have been resolved to COLUMNs */ | ||||
| #define EP_Error        0x0008  /* Expression contains one or more errors */ | ||||
| #define EP_Not          0x0010  /* Operator preceeded by NOT */ | ||||
| #define EP_VarSelect    0x0020  /* pSelect is correlated, not constant */ | ||||
|  | ||||
| /* | ||||
| ** These macros can be used to test, set, or clear bits in the  | ||||
| @@ -983,6 +984,39 @@ struct Fetch { | ||||
|   int doRewind;        /* True to rewind cursor before starting */ | ||||
| }; | ||||
|  | ||||
| /* | ||||
| ** A NameContext defines a context in which to resolve table and column | ||||
| ** names.  The context consists of a list of tables (the pSrcList) field and | ||||
| ** a list of named expression (pEList).  The named expression list may | ||||
| ** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or | ||||
| ** to the table being operated on by INSERT, UPDATE, or DELETE.  The | ||||
| ** pEList corresponds to the result set of a SELECT and is NULL for | ||||
| ** other statements. | ||||
| ** | ||||
| ** NameContexts can be nested.  When resolving names, the inner-most  | ||||
| ** context is searched first.  If no match is found, the next outer | ||||
| ** context is checked.  If there is still no match, the next context | ||||
| ** is checked.  This process continues until either a match is found | ||||
| ** or all contexts are check.  When a match is found, the nRef member of | ||||
| ** the context containing the match is incremented.  | ||||
| ** | ||||
| ** Each subquery gets a new NameContext.  The pNext field points to the | ||||
| ** NameContext in the parent query.  Thus the process of scanning the | ||||
| ** NameContext list corresponds to searching through successively outer | ||||
| ** subqueries looking for a match. | ||||
| */ | ||||
| struct NameContext { | ||||
|   Parse *pParse;       /* The parser */ | ||||
|   SrcList *pSrcList;   /* One or more tables used to resolve names */ | ||||
|   ExprList *pEList;    /* Optional list of named expressions */ | ||||
|   int nRef;            /* Number of names resolved by this context */ | ||||
|   int nErr;            /* Number of errors encountered while resolving names */ | ||||
|   u8 allowAgg;         /* Aggregate functions allowed here */ | ||||
|   u8 hasAgg; | ||||
|   int nDepth;          /* Depth of subquery recursion. 1 for no recursion */ | ||||
|   NameContext *pNext;  /* Next outer name context.  NULL for outermost */ | ||||
| }; | ||||
|  | ||||
| /* | ||||
| ** An instance of the following structure contains all information | ||||
| ** needed to generate code for a single SELECT statement. | ||||
| @@ -1007,6 +1041,8 @@ struct Select { | ||||
|   int iLimit, iOffset;   /* Memory registers holding LIMIT & OFFSET counters */ | ||||
|   IdList **ppOpenTemp;   /* OP_OpenTemp addresses used by multi-selects */ | ||||
|   Fetch *pFetch;         /* If this stmt is part of a FETCH command */ | ||||
|   u8 isResolved;         /* True once sqlite3SelectResolve() has run. */ | ||||
|   u8 isAgg;              /* True if this is an aggregate query */ | ||||
| }; | ||||
|  | ||||
| /* | ||||
| @@ -1076,6 +1112,8 @@ struct Parse { | ||||
|   int cookieValue[MAX_ATTACHED+2];  /* Values of cookies to verify */ | ||||
|   int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */ | ||||
|   u32 writeMask;       /* Start a write transaction on these databases */ | ||||
|   u8 useAgg;           /* If true, extract field values from the aggregator | ||||
|                        ** while generating expressions.  Normally false */ | ||||
|  | ||||
|   /* Above is constant between recursions.  Below is reset before and after | ||||
|   ** each recursion */ | ||||
| @@ -1085,15 +1123,11 @@ struct Parse { | ||||
|   int nVarExprAlloc;   /* Number of allocated slots in apVarExpr[] */ | ||||
|   Expr **apVarExpr;    /* Pointers to :aaa and $aaaa wildcard expressions */ | ||||
|   u8 explain;          /* True if the EXPLAIN flag is found on the query */ | ||||
|   u8 useAgg;           /* If true, extract field values from the aggregator | ||||
|                        ** while generating expressions.  Normally false */ | ||||
| #ifndef SQLITE_OMIT_CURSOR | ||||
|   u8 fetchDir;         /* The direction argument to the FETCH command */ | ||||
|   int dirArg1;         /* First argument to the direction */ | ||||
|   int dirArg2;         /* Second argument to the direction */ | ||||
| #endif | ||||
|   int nAgg;            /* Number of aggregate expressions */ | ||||
|   AggExpr *aAgg;       /* An array of aggregate expressions */ | ||||
|   Token sErrToken;     /* The token at which the error occurred */ | ||||
|   Token sNameToken;    /* Token with unqualified schema object name */ | ||||
|   Token sLastToken;    /* The last token parsed */ | ||||
| @@ -1103,6 +1137,9 @@ struct Parse { | ||||
|   Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */ | ||||
|   TriggerStack *trigStack;  /* Trigger actions being coded */ | ||||
|   const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ | ||||
|   int nAgg;            /* Number of aggregate expressions */ | ||||
|   AggExpr *aAgg;       /* An array of aggregate expressions */ | ||||
|   int nMaxDepth;       /* Maximum depth of subquery recursion */ | ||||
| }; | ||||
|  | ||||
| /* | ||||
| @@ -1275,38 +1312,6 @@ typedef struct { | ||||
|   char **pzErrMsg;    /* Error message stored here */ | ||||
| } InitData; | ||||
|  | ||||
| /* | ||||
| ** A NameContext defines a context in which to resolve table and column | ||||
| ** names.  The context consists of a list of tables (the pSrcList) field and | ||||
| ** a list of named expression (pEList).  The named expression list may | ||||
| ** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or | ||||
| ** to the table being operated on by INSERT, UPDATE, or DELETE.  The | ||||
| ** pEList corresponds to the result set of a SELECT and is NULL for | ||||
| ** other statements. | ||||
| ** | ||||
| ** NameContexts can be nested.  When resolving names, the inner-most  | ||||
| ** context is searched first.  If no match is found, the next outer | ||||
| ** context is checked.  If there is still no match, the next context | ||||
| ** is checked.  This process continues until either a match is found | ||||
| ** or all contexts are check.  When a match is found, the nRef member of | ||||
| ** the context containing the match is incremented.  | ||||
| ** | ||||
| ** Each subquery gets a new NameContext.  The pNext field points to the | ||||
| ** NameContext in the parent query.  Thus the process of scanning the | ||||
| ** NameContext list corresponds to searching through successively outer | ||||
| ** subqueries looking for a match. | ||||
| */ | ||||
| struct NameContext { | ||||
|   Parse *pParse;       /* The parser */ | ||||
|   SrcList *pSrcList;   /* One or more tables used to resolve names */ | ||||
|   ExprList *pEList;    /* Optional list of named expressions */ | ||||
|   int nRef;            /* Number of names resolved by this context */ | ||||
|   int nErr;            /* Number of errors encountered while resolving names */ | ||||
|   u8 allowAgg;         /* Aggregate functions allowed here */ | ||||
|   u8 hasAgg;           /* Expression actually contains aggregate functions */ | ||||
|   NameContext *pNext;  /* Next outer name context.  NULL for outermost */ | ||||
| }; | ||||
|  | ||||
| /* | ||||
| ** Each SQL cursor (a cursor created by the DECLARE ... CURSOR syntax) | ||||
| ** is represented by an instance of the following structure. | ||||
| @@ -1413,8 +1418,7 @@ void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, | ||||
| void sqlite3DropIndex(Parse*, SrcList*); | ||||
| void sqlite3AddKeyType(Vdbe*, ExprList*); | ||||
| void sqlite3AddIdxKeyType(Vdbe*, Index*); | ||||
| int sqlite3Select(Parse*, Select*, int, int, Select*, int, int*, | ||||
|                   char *aff, NameContext*); | ||||
| int sqlite3Select(Parse*, Select*, int, int, Select*, int, int*, char *aff); | ||||
| Select *sqlite3SelectNew(ExprList*,SrcList*,Expr*,ExprList*,Expr*,ExprList*, | ||||
|                         int,int,int); | ||||
| void sqlite3SelectDelete(Select*); | ||||
| @@ -1444,8 +1448,7 @@ char *sqlite3NameFromToken(Token*); | ||||
| int sqlite3ExprCheck(Parse*, Expr*, int, int*); | ||||
| int sqlite3ExprCompare(Expr*, Expr*); | ||||
| int sqliteFuncId(Token*); | ||||
| int sqlite3ExprResolveNames(Parse*, SrcList*, ExprList*, NameContext*, | ||||
|                             Expr*, int, int); | ||||
| int sqlite3ExprResolveNames(NameContext *, Expr *); | ||||
| int sqlite3ExprAnalyzeAggregates(Parse*, Expr*); | ||||
| Vdbe *sqlite3GetVdbe(Parse*); | ||||
| void sqlite3Randomness(int, void*); | ||||
| @@ -1573,6 +1576,8 @@ void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); | ||||
| int sqlite3GetToken(const unsigned char *, int *); | ||||
| void sqlite3NestedParse(Parse*, const char*, ...); | ||||
| void sqlite3ExpirePreparedStatements(sqlite3*); | ||||
| void sqlite3CodeSubselect(Parse *, Expr *); | ||||
| int sqlite3SelectResolve(Parse *, Select *, NameContext *); | ||||
|  | ||||
| #ifndef SQLITE_OMIT_CURSOR | ||||
| void sqlite3CursorDelete(SqlCursor*); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user