MCPcopy Create free account
hub / github.com/audacity/audacity / idxCreateFromWhere

Function idxCreateFromWhere

lib-src/sqlite/shell.c:9356–9389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9354}
9355
9356static int idxCreateFromWhere(
9357 sqlite3expert *p,
9358 IdxScan *pScan, /* Create indexes for this scan */
9359 IdxConstraint *pTail /* range/ORDER BY constraints for inclusion */
9360){
9361 IdxConstraint *p1 = 0;
9362 IdxConstraint *pCon;
9363 int rc;
9364
9365 /* Gather up all the == constraints. */
9366 for(pCon=pScan->pEq; pCon; pCon=pCon->pNext){
9367 if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){
9368 pCon->pLink = p1;
9369 p1 = pCon;
9370 }
9371 }
9372
9373 /* Create an index using the == constraints collected above. And the
9374 ** range constraint/ORDER BY terms passed in by the caller, if any. */
9375 rc = idxCreateFromCons(p, pScan, p1, pTail);
9376
9377 /* If no range/ORDER BY passed by the caller, create a version of the
9378 ** index for each range constraint. */
9379 if( pTail==0 ){
9380 for(pCon=pScan->pRange; rc==SQLITE_OK && pCon; pCon=pCon->pNext){
9381 assert( pCon->pLink==0 );
9382 if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){
9383 rc = idxCreateFromCons(p, pScan, p1, pCon);
9384 }
9385 }
9386 }
9387
9388 return rc;
9389}
9390
9391/*
9392** Create candidate indexes in database [dbm] based on the data in

Callers 1

idxCreateCandidatesFunction · 0.85

Calls 2

idxFindConstraintFunction · 0.85
idxCreateFromConsFunction · 0.85

Tested by

no test coverage detected