mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
76
third_party/sqlite3/resolve.c
vendored
76
third_party/sqlite3/resolve.c
vendored
|
@ -88,7 +88,7 @@ static void resolveAlias(
|
|||
pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
|
||||
}
|
||||
|
||||
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
|
||||
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
|
||||
** prevents ExprDelete() from deleting the Expr structure itself,
|
||||
** allowing it to be repopulated by the memcpy() on the following line.
|
||||
** The pExpr->u.zToken might point into memory that will be freed by the
|
||||
|
@ -193,7 +193,7 @@ Bitmask sqlite3ExprColUsed(Expr *pExpr){
|
|||
pExTab = pExpr->y.pTab;
|
||||
assert( pExTab!=0 );
|
||||
if( (pExTab->tabFlags & TF_HasGenerated)!=0
|
||||
&& (pExTab->aCol[n].colFlags & COLFLAG_GENERATED)!=0
|
||||
&& (pExTab->aCol[n].colFlags & COLFLAG_GENERATED)!=0
|
||||
){
|
||||
testcase( pExTab->nCol==BMS-1 );
|
||||
testcase( pExTab->nCol==BMS );
|
||||
|
@ -208,7 +208,7 @@ Bitmask sqlite3ExprColUsed(Expr *pExpr){
|
|||
|
||||
/*
|
||||
** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
|
||||
** that name in the set of source tables in pSrcList and make the pExpr
|
||||
** that name in the set of source tables in pSrcList and make the pExpr
|
||||
** expression node refer back to that source column. The following changes
|
||||
** are made to pExpr:
|
||||
**
|
||||
|
@ -338,7 +338,7 @@ static int lookupName(
|
|||
for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
|
||||
if( pCol->hName==hCol && sqlite3StrICmp(pCol->zName, zCol)==0 ){
|
||||
/* If there has been exactly one prior match and this match
|
||||
** is for the right-hand table of a NATURAL JOIN or is in a
|
||||
** is for the right-hand table of a NATURAL JOIN or is in a
|
||||
** USING clause, then skip this match.
|
||||
*/
|
||||
if( cnt==1 ){
|
||||
|
@ -366,7 +366,7 @@ static int lookupName(
|
|||
} /* if( pSrcList ) */
|
||||
|
||||
#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
|
||||
/* If we have not already resolved the name, then maybe
|
||||
/* If we have not already resolved the name, then maybe
|
||||
** it is a new.* or old.* trigger argument reference. Or
|
||||
** maybe it is an excluded.* from an upsert. Or maybe it is
|
||||
** a reference in the RETURNING clause to a table being modified.
|
||||
|
@ -403,7 +403,7 @@ static int lookupName(
|
|||
}
|
||||
#endif /* SQLITE_OMIT_UPSERT */
|
||||
|
||||
if( pTab ){
|
||||
if( pTab ){
|
||||
int iCol;
|
||||
u8 hCol = sqlite3StrIHash(zCol);
|
||||
pSchema = pTab->pSchema;
|
||||
|
@ -538,7 +538,7 @@ static int lookupName(
|
|||
}
|
||||
goto lookupname_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Advance to the next name context. The loop will exit when either
|
||||
|
@ -705,7 +705,7 @@ Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
|
|||
**
|
||||
** static void notValid(
|
||||
** Parse *pParse, // Leave error message here
|
||||
** NameContext *pNC, // The name context
|
||||
** NameContext *pNC, // The name context
|
||||
** const char *zMsg, // Type of error
|
||||
** int validMask, // Set of contexts for which prohibited
|
||||
** Expr *pExpr // Invalidate this expression on error
|
||||
|
@ -783,7 +783,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
|
||||
/* The special operator TK_ROW means use the rowid for the first
|
||||
** column in the FROM clause. This is used by the LIMIT and ORDER BY
|
||||
** clause processing on UPDATE and DELETE statements, and by
|
||||
** clause processing on UPDATE and DELETE statements, and by
|
||||
** UPDATE ... FROM statement processing.
|
||||
*/
|
||||
case TK_ROW: {
|
||||
|
@ -818,7 +818,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
int anRef[8];
|
||||
NameContext *p;
|
||||
int i;
|
||||
for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
|
||||
for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){
|
||||
anRef[i] = p->nRef;
|
||||
}
|
||||
sqlite3WalkExpr(pWalker, pExpr->pLeft);
|
||||
|
@ -845,7 +845,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
** Or a database, table and column: ID.ID.ID
|
||||
**
|
||||
** The TK_ID and TK_OUT cases are combined so that there will only
|
||||
** be one call to lookupName(). Then the compiler will in-line
|
||||
** be one call to lookupName(). Then the compiler will in-line
|
||||
** lookupName() for a size reduction and performance increase.
|
||||
*/
|
||||
case TK_ID:
|
||||
|
@ -934,7 +934,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
** to likelihood(X,0.9375). */
|
||||
/* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
|
||||
pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef SQLITE_OMIT_AUTHORIZATION
|
||||
{
|
||||
|
@ -996,11 +996,11 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
|| (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize)
|
||||
);
|
||||
if( pDef && pDef->xValue==0 && pWin ){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"%.*s() may not be used as a window function", nId, zId
|
||||
);
|
||||
pNC->nErr++;
|
||||
}else if(
|
||||
}else if(
|
||||
(is_agg && (pNC->ncFlags & NC_AllowAgg)==0)
|
||||
|| (is_agg && (pDef->funcFlags&SQLITE_FUNC_WINDOW) && !pWin)
|
||||
|| (is_agg && pWin && (pNC->ncFlags & NC_AllowWin)==0)
|
||||
|
@ -1036,8 +1036,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
}
|
||||
#ifndef SQLITE_OMIT_WINDOWFUNC
|
||||
else if( is_agg==0 && ExprHasProperty(pExpr, EP_WinFunc) ){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"FILTER may not be used with non-aggregate %.*s()",
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"FILTER may not be used with non-aggregate %.*s()",
|
||||
nId, zId
|
||||
);
|
||||
pNC->nErr++;
|
||||
|
@ -1100,7 +1100,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
pNC->ncFlags |= savedAllowFlags;
|
||||
}
|
||||
/* FIX ME: Compute pExpr->affinity based on the expected return
|
||||
** type of the function
|
||||
** type of the function
|
||||
*/
|
||||
return WRC_Prune;
|
||||
}
|
||||
|
@ -1185,7 +1185,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
|||
testcase( pExpr->op==TK_BETWEEN );
|
||||
sqlite3ErrorMsg(pParse, "row value misused");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
|
||||
|
@ -1296,7 +1296,7 @@ static void resolveOutOfRangeError(
|
|||
int i, /* The index (1-based) of the term out of range */
|
||||
int mx /* Largest permissible value of i */
|
||||
){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"%r %s BY term out of range - should be "
|
||||
"between 1 and %d", i, zType, mx);
|
||||
}
|
||||
|
@ -1361,7 +1361,7 @@ static int resolveCompoundOrderBy(
|
|||
iCol = resolveAsName(pParse, pEList, pE);
|
||||
if( iCol==0 ){
|
||||
/* Now test if expression pE matches one of the values returned
|
||||
** by pSelect. In the usual case this is done by duplicating the
|
||||
** by pSelect. In the usual case this is done by duplicating the
|
||||
** expression, resolving any symbols in it, and then comparing
|
||||
** it against each expression returned by the SELECT statement.
|
||||
** Once the comparisons are finished, the duplicate expression
|
||||
|
@ -1585,7 +1585,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
ExprList *pGroupBy; /* The GROUP BY clause */
|
||||
Select *pLeftmost; /* Left-most of SELECT of a compound */
|
||||
sqlite3 *db; /* Database connection */
|
||||
|
||||
|
||||
|
||||
assert( p!=0 );
|
||||
if( p->selFlags & SF_Resolved ){
|
||||
|
@ -1639,7 +1639,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
pSub->pOrderBy = p->pOrderBy;
|
||||
p->pOrderBy = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Recursively resolve names in all subqueries
|
||||
*/
|
||||
for(i=0; i<p->pSrc->nSrc; i++){
|
||||
|
@ -1665,19 +1665,19 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set up the local name-context to pass to sqlite3ResolveExprNames() to
|
||||
** resolve the result-set expression list.
|
||||
*/
|
||||
sNC.ncFlags = NC_AllowAgg|NC_AllowWin;
|
||||
sNC.pSrcList = p->pSrc;
|
||||
sNC.pNext = pOuterNC;
|
||||
|
||||
|
||||
/* Resolve names in the result set. */
|
||||
if( sqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort;
|
||||
sNC.ncFlags &= ~NC_AllowWin;
|
||||
|
||||
/* If there are no aggregate functions in the result-set, and no GROUP BY
|
||||
|
||||
/* If there are no aggregate functions in the result-set, and no GROUP BY
|
||||
** expression, do not allow aggregates in any of the other expressions.
|
||||
*/
|
||||
assert( (p->selFlags & SF_Aggregate)==0 );
|
||||
|
@ -1688,14 +1688,14 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
}else{
|
||||
sNC.ncFlags &= ~NC_AllowAgg;
|
||||
}
|
||||
|
||||
|
||||
/* If a HAVING clause is present, then there must be a GROUP BY clause.
|
||||
*/
|
||||
if( p->pHaving && !pGroupBy ){
|
||||
sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
|
||||
return WRC_Abort;
|
||||
}
|
||||
|
||||
|
||||
/* Add the output column list to the name-context before parsing the
|
||||
** other expressions in the SELECT statement. This is so that
|
||||
** expressions in the WHERE clause (etc.) can refer to expressions by
|
||||
|
@ -1714,19 +1714,19 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
for(i=0; i<p->pSrc->nSrc; i++){
|
||||
SrcItem *pItem = &p->pSrc->a[i];
|
||||
if( pItem->fg.isTabFunc
|
||||
&& sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
|
||||
&& sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
|
||||
){
|
||||
return WRC_Abort;
|
||||
}
|
||||
}
|
||||
|
||||
/* The ORDER BY and GROUP BY clauses may not refer to terms in
|
||||
** outer queries
|
||||
** outer queries
|
||||
*/
|
||||
sNC.pNext = 0;
|
||||
sNC.ncFlags |= NC_AllowAgg|NC_AllowWin;
|
||||
|
||||
/* If this is a converted compound query, move the ORDER BY clause from
|
||||
/* If this is a converted compound query, move the ORDER BY clause from
|
||||
** the sub-query back to the parent query. At this point each term
|
||||
** within the ORDER BY clause has been transformed to an integer value.
|
||||
** These integers will be replaced by copies of the corresponding result
|
||||
|
@ -1756,13 +1756,13 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
return WRC_Abort;
|
||||
}
|
||||
sNC.ncFlags &= ~NC_AllowWin;
|
||||
|
||||
/* Resolve the GROUP BY clause. At the same time, make sure
|
||||
|
||||
/* Resolve the GROUP BY clause. At the same time, make sure
|
||||
** the GROUP BY clause does not contain aggregate functions.
|
||||
*/
|
||||
if( pGroupBy ){
|
||||
struct ExprList_item *pItem;
|
||||
|
||||
|
||||
if( resolveOrderGroupBy(&sNC, p, pGroupBy, "GROUP") || db->mallocFailed ){
|
||||
return WRC_Abort;
|
||||
}
|
||||
|
@ -1817,7 +1817,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
** checking on function usage and set a flag if any aggregate functions
|
||||
** are seen.
|
||||
**
|
||||
** To resolve table columns references we look for nodes (or subtrees) of the
|
||||
** To resolve table columns references we look for nodes (or subtrees) of the
|
||||
** form X.Y.Z or Y.Z or just Z where
|
||||
**
|
||||
** X: The name of a database. Ex: "main" or "temp" or
|
||||
|
@ -1849,7 +1849,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
**
|
||||
** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;
|
||||
**
|
||||
** Function calls are checked to make sure that the function is
|
||||
** Function calls are checked to make sure that the function is
|
||||
** defined and that the correct number of arguments are specified.
|
||||
** If the function is an aggregate function, then the NC_HasAgg flag is
|
||||
** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
|
||||
|
@ -1859,7 +1859,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
|
|||
** An error message is left in pParse if anything is amiss. The number
|
||||
** if errors is returned.
|
||||
*/
|
||||
int sqlite3ResolveExprNames(
|
||||
int sqlite3ResolveExprNames(
|
||||
NameContext *pNC, /* Namespace to resolve expressions in. */
|
||||
Expr *pExpr /* The expression to be analyzed. */
|
||||
){
|
||||
|
@ -1898,7 +1898,7 @@ int sqlite3ResolveExprNames(
|
|||
** just like sqlite3ResolveExprNames() except that it works for an expression
|
||||
** list rather than a single expression.
|
||||
*/
|
||||
int sqlite3ResolveExprListNames(
|
||||
int sqlite3ResolveExprListNames(
|
||||
NameContext *pNC, /* Namespace to resolve expressions in. */
|
||||
ExprList *pList /* The expression list to be analyzed. */
|
||||
){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue