all repos — litestore @ a4182f901e87fe6c652812688fbd84aaec65d1ce

A minimalist nosql document store.

Fixed build.
h3rald h3rald@h3rald.com
Thu, 18 Aug 2022 19:36:35 +0000
commit

a4182f901e87fe6c652812688fbd84aaec65d1ce

parent

5646cbba2dc69517cb99e66dfd4b5e841993d3ce

2 files changed, 2 insertions(+), 250 deletions(-)

jump to
M src/litestorepkg/lib/types.nimsrc/litestorepkg/lib/types.nim

@@ -10,7 +10,6 @@ strutils,

sequtils, nativesockets, jwt, - uri, tables import config
M src/litestorepkg/vendor/sqlite/sqlite3.csrc/litestorepkg/vendor/sqlite/sqlite3.c

@@ -13665,26 +13665,6 @@ # define NEVER(X) (X)

#endif /* -** The harmless(X) macro indicates that expression X is usually false -** but can be true without causing any problems, but we don't know of -** any way to cause X to be true. -** -** In debugging and testing builds, this macro will abort if X is ever -** true. In this way, developers are alerted to a possible test case -** that causes X to be true. If a harmless macro ever fails, that is -** an opportunity to change the macro into a testcase() and add a new -** test case to the test suite. -** -** For normal production builds, harmless(X) is a no-op, since it does -** not matter whether expression X is true or false. -*/ -#ifdef SQLITE_DEBUG -# define harmless(X) assert(!(X)); -#else -# define harmless(X) -#endif - -/* ** Some conditionals are optimizations only. In other words, if the ** conditionals are replaced with a constant 1 (true) or 0 (false) then ** the correct answer is still obtained, though perhaps not as quickly.

@@ -18258,12 +18238,6 @@ */

#define EP_NoReduce 0x01 /* Cannot EXPRDUP_REDUCE this Expr */ #define EP_Immutable 0x02 /* Do not change this Expr node */ - -/* Flags for use with Expr.vvaFlags -*/ -#define EP_NoReduce 0x01 /* Cannot EXPRDUP_REDUCE this Expr */ -#define EP_Immutable 0x02 /* Do not change this Expr node */ - /* The ExprSetVVAProperty() macro is used for Verification, Validation, ** and Accreditation only. It works like ExprSetProperty() during VVA ** processes but is a no-op for delivery.

@@ -18462,46 +18436,6 @@ IdList *pUsing; /* The USING clause of a join */

}; /* -** The SrcItem object represents a single term in the FROM clause of a query. -** The SrcList object is mostly an array of SrcItems. -*/ -struct SrcItem { - Schema *pSchema; /* Schema to which this item is fixed */ - char *zDatabase; /* Name of database holding this table */ - char *zName; /* Name of the table */ - char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ - Table *pTab; /* An SQL table corresponding to zName */ - Select *pSelect; /* A SELECT statement used in place of a table name */ - int addrFillSub; /* Address of subroutine to manifest a subquery */ - int regReturn; /* Register holding return address of addrFillSub */ - int regResult; /* Registers holding results of a co-routine */ - struct { - u8 jointype; /* Type of join between this table and the previous */ - unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ - unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */ - unsigned isTabFunc :1; /* True if table-valued-function syntax */ - unsigned isCorrelated :1; /* True if sub-query is correlated */ - unsigned viaCoroutine :1; /* Implemented as a co-routine */ - unsigned isRecursive :1; /* True for recursive reference in WITH */ - unsigned fromDDL :1; /* Comes from sqlite_schema */ - unsigned isCte :1; /* This is a CTE */ - unsigned notCte :1; /* This item may not match a CTE */ - } fg; - int iCursor; /* The VDBE cursor number used to access this table */ - Expr *pOn; /* The ON clause of a join */ - IdList *pUsing; /* The USING clause of a join */ - Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */ - union { - char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */ - ExprList *pFuncArg; /* Arguments to table-valued-function */ - } u1; - union { - Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */ - CteUse *pCteUse; /* CTE Usage info info fg.isCte is true */ - } u2; -}; - -/* ** The following structure describes the FROM clause of a SELECT statement. ** Each table or subquery in the FROM clause is a separate element of ** the SrcList.a[] array.

@@ -31303,12 +31237,6 @@ }

if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){ sqlite3_str_appendf(&x, " ON"); } - if( pItem->fg.fromDDL ){ - sqlite3_str_appendf(&x, " DDL"); - } - if( pItem->fg.isCte ){ - sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse); - } sqlite3StrAccumFinish(&x); sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); n = 0;

@@ -31967,7 +31895,6 @@ for(i=0; i<pList->nExpr; i++){

int j = pList->a[i].u.x.iOrderByCol; char *zName = pList->a[i].zEName; int moreToFollow = i<pList->nExpr - 1; - if( pList->a[i].eEName!=ENAME_NAME ) zName = 0; if( j || zName ){ sqlite3TreeViewPush(&pView, moreToFollow); moreToFollow = 0;

@@ -33478,16 +33405,6 @@ if( db->pErr ) sqlite3ValueSetNull(db->pErr);

} /* -** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state -** and error message. -*/ -SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){ - assert( db!=0 ); - db->errCode = SQLITE_OK; - if( db->pErr ) sqlite3ValueSetNull(db->pErr); -} - -/* ** Load the sqlite3.iSysErrno field if that is an appropriate thing ** to do based on the SQLite error code in rc. */

@@ -74194,7 +74111,7 @@ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */

assert( i<iEnd ); j = get2byte(&aData[hdr+5]); - if( NEVER(j>(u32)usableSize) ){ j = 0; } + if( j>(u32)usableSize ){ j = 0; } memcpy(&pTmp[j], &aData[j], usableSize - j); for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}

@@ -76337,7 +76254,7 @@ }else{

return SQLITE_CORRUPT_BKPT; } } - assert( CORRUPT_DB || pCur->eState==CURSOR_VALID ); + assert( pCur->eState==CURSOR_VALID ); iCellDepth = pCur->iPage; iCellIdx = pCur->ix;

@@ -107233,7 +107150,6 @@ destStep2 = destIfFalse;

}else{ destStep2 = destStep6 = sqlite3VdbeMakeLabel(pParse); } - if( pParse->nErr ) goto sqlite3ExprCodeIN_finished; for(i=0; i<nVector; i++){ Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i); if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error;

@@ -109813,62 +109729,6 @@ pWalker->xSelectCallback = sqlite3SelectWalkNoop;

} /* -** This is a Walker expression node callback. -** -** For Expr nodes that contain pAggInfo pointers, make sure the AggInfo -** object that is referenced does not refer directly to the Expr. If -** it does, make a copy. This is done because the pExpr argument is -** subject to change. -** -** The copy is stored on pParse->pConstExpr with a register number of 0. -** This will cause the expression to be deleted automatically when the -** Parse object is destroyed, but the zero register number means that it -** will not generate any code in the preamble. -*/ -static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){ - if( ALWAYS(!ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced)) - && pExpr->pAggInfo!=0 - ){ - AggInfo *pAggInfo = pExpr->pAggInfo; - int iAgg = pExpr->iAgg; - Parse *pParse = pWalker->pParse; - sqlite3 *db = pParse->db; - assert( pExpr->op==TK_AGG_COLUMN || pExpr->op==TK_AGG_FUNCTION ); - if( pExpr->op==TK_AGG_COLUMN ){ - assert( iAgg>=0 && iAgg<pAggInfo->nColumn ); - if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){ - pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ - pAggInfo->aCol[iAgg].pCExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); - } - } - }else{ - assert( iAgg>=0 && iAgg<pAggInfo->nFunc ); - if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){ - pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ - pAggInfo->aFunc[iAgg].pFExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); - } - } - } - } - return WRC_Continue; -} - -/* -** Initialize a Walker object so that will persist AggInfo entries referenced -** by the tree that is walked. -*/ -SQLITE_PRIVATE void sqlite3AggInfoPersistWalkerInit(Walker *pWalker, Parse *pParse){ - memset(pWalker, 0, sizeof(*pWalker)); - pWalker->pParse = pParse; - pWalker->xExprCallback = agginfoPersistExprCb; - pWalker->xSelectCallback = sqlite3SelectWalkNoop; -} - -/* ** Add a new element to the pAggInfo->aCol[] array. Return the index of ** the new element. Return a negative number if malloc fails. */

@@ -110447,22 +110307,6 @@

exit_rename_table: sqlite3SrcListDelete(db, pSrc); sqlite3DbFree(db, zName); -} - -/* -** Write code that will raise an error if the table described by -** zDb and zTab is not empty. -*/ -static void sqlite3ErrorIfNotEmpty( - Parse *pParse, /* Parsing context */ - const char *zDb, /* Schema holding the table */ - const char *zTab, /* Table to check for empty */ - const char *zErr /* Error message text */ -){ - sqlite3NestedParse(pParse, - "SELECT raise(ABORT,%Q) FROM \"%w\".\"%w\"", - zErr, zDb, zTab - ); } /*

@@ -113421,30 +113265,6 @@ #else

# define analyzeVdbeCommentIndexWithColumnName(a,b,c) #endif /* SQLITE_DEBUG */ -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS -/* Add a comment to the most recent VDBE opcode that is the name -** of the k-th column of the pIdx index. -*/ -static void analyzeVdbeCommentIndexWithColumnName( - Vdbe *v, /* Prepared statement under construction */ - Index *pIdx, /* Index whose column is being loaded */ - int k /* Which column index */ -){ - int i; /* Index of column in the table */ - assert( k>=0 && k<pIdx->nColumn ); - i = pIdx->aiColumn[k]; - if( NEVER(i==XN_ROWID) ){ - VdbeComment((v,"%s.rowid",pIdx->zName)); - }else if( i==XN_EXPR ){ - VdbeComment((v,"%s.expr(%d)",pIdx->zName, k)); - }else{ - VdbeComment((v,"%s.%s", pIdx->zName, pIdx->pTable->aCol[i].zName)); - } -} -#else -# define analyzeVdbeCommentIndexWithColumnName(a,b,c) -#endif /* SQLITE_DEBUG */ - /* ** Generate code to do an analysis of all indices associated with ** a single table.

@@ -115569,11 +115389,6 @@ Returning *pRet = pParse->u1.pReturning;

if( pRet->nRetCol ){ sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); } - } - - if( pParse->bReturning ){ - Returning *pRet = pParse->u1.pReturning; - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); } /* Finally, jump back to the beginning of the executable code. */

@@ -139408,9 +139223,6 @@ pPrior->pNext = pSplit;

sqlite3ExprListDelete(db, pPrior->pOrderBy); pPrior->pOrderBy = 0; - sqlite3ExprListDelete(db, pPrior->pOrderBy); - pPrior->pOrderBy = 0; - /*** TBD: Insert subroutine calls to close cursors on incomplete **** subqueries ****/ ExplainQueryPlanPop(pParse);

@@ -146653,7 +146465,6 @@ if( p ) upsertDelete(db, p);

} - /* ** Duplicate an Upsert object. */

@@ -150611,9 +150422,6 @@ pExpr->iColumn = pX->iIdxCol;

testcase( ExprHasProperty(pExpr, EP_Unlikely) ); ExprClearProperty(pExpr, EP_Skip|EP_Unlikely|EP_WinFunc|EP_Subrtn); pExpr->y.pTab = 0; - testcase( ExprHasProperty(pExpr, EP_Skip) ); - testcase( ExprHasProperty(pExpr, EP_Unlikely) ); - ExprClearProperty(pExpr, EP_Skip|EP_Unlikely); return WRC_Prune; }else{ return WRC_Continue;

@@ -150949,7 +150757,6 @@ assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );

for(j=0; j<nConstraint; j++){ pTerm = pLoop->aLTerm[j]; - if( (pTerm->eOperator & WO_IN)!=0 ) iIn--; if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ disableTerm(pLevel, pTerm); continue;

@@ -154259,32 +154066,6 @@ sqlite3VdbeGoto(v, pWInfo->iBreak);

} /* -** While generating code for the min/max optimization, after handling -** the aggregate-step call to min() or max(), check to see if any -** additional looping is required. If the output order is such that -** we are certain that the correct answer has already been found, then -** code an OP_Goto to by pass subsequent processing. -** -** Any extra OP_Goto that is coded here is an optimization. The -** correct answer should be obtained regardless. This OP_Goto just -** makes the answer appear faster. -*/ -SQLITE_PRIVATE void sqlite3WhereMinMaxOptEarlyOut(Vdbe *v, WhereInfo *pWInfo){ - WhereLevel *pInner; - int i; - if( !pWInfo->bOrderedInnerLoop ) return; - if( pWInfo->nOBSat==0 ) return; - for(i=pWInfo->nLevel-1; i>=0; i--){ - pInner = &pWInfo->a[i]; - if( (pInner->pWLoop->wsFlags & WHERE_COLUMN_IN)!=0 ){ - sqlite3VdbeGoto(v, pInner->addrNxt); - return; - } - } - sqlite3VdbeGoto(v, pWInfo->iBreak); -} - -/* ** Return the VDBE address or label to jump to in order to continue ** immediately with the next row of a WHERE clause. */

@@ -157555,7 +157336,6 @@ ** consider index pProbe. */

for(; rc==SQLITE_OK && pProbe; pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++ ){ - int isLeft = (pSrc->fg.jointype & JT_OUTER)!=0; if( pProbe->pPartIdxWhere!=0 && !whereUsablePartialIndex(pSrc->iCursor, pSrc->fg.jointype, pWC, pProbe->pPartIdxWhere)

@@ -159913,11 +159693,6 @@ if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */

sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); sqlite3WhereClausePrint(sWLB.pWC); } -#if defined(WHERETRACE_ENABLED) - if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ - sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); - sqlite3WhereClausePrint(sWLB.pWC); - } WHERETRACE(0xffff,("*** Optimizer Finished ***\n")); #endif pWInfo->pParse->nQueryLoop += pWInfo->nRowOut;

@@ -160534,7 +160309,6 @@ sqlite3VdbeResolveLabel(v, pWInfo->iBreak);

/* Final cleanup */ - if( pWInfo->pExprMods ) whereUndoExprMods(pWInfo); pParse->nQueryLoop = pWInfo->savedNQueryLoop; whereInfoFree(db, pWInfo); pParse->withinRJSubrtn -= nRJ;

@@ -163734,7 +163508,6 @@ sqlite3 *db = pParse->db;

pParse->disableLookaside++; DisableLookaside; } -#endif /* SQLITE_ENABLE_UPDATE_DELETE_LIMIT */ #if !defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) \ && defined(SQLITE_UDL_CAPABLE_PARSER)

@@ -165112,7 +164885,6 @@

/* #include <assert.h> */ #ifndef NDEBUG /* #include <stdio.h> */ -/* #include <assert.h> */ static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */

@@ -198737,23 +198509,6 @@ # endif

#endif /* -** Make sure that the compiler intrinsics we desire are enabled when -** compiling with an appropriate version of MSVC unless prevented by -** the SQLITE_DISABLE_INTRINSIC define. -*/ -#if !defined(SQLITE_DISABLE_INTRINSIC) -# if defined(_MSC_VER) && _MSC_VER>=1400 -# if !defined(_WIN32_WCE) -/* # include <intrin.h> */ -# pragma intrinsic(_byteswap_ulong) -# pragma intrinsic(_byteswap_uint64) -# else -/* # include <cmnintrin.h> */ -# endif -# endif -#endif - -/* ** Macros to determine whether the machine is big or little endian, ** and whether or not that determination is run-time or compile-time. **

@@ -220422,7 +220177,6 @@

/* #include <assert.h> */ #ifndef NDEBUG /* #include <stdio.h> */ -/* #include <assert.h> */ static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */

@@ -222438,7 +222192,6 @@ }else{

i64 iOff = *piOff; u32 iVal; fts5FastGetVarint32(a, i, iVal); - assert( iVal>=0 ); if( iVal<=1 ){ if( iVal==0 ){ *pi = i;