mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
If the LHS for an EXCEPT or INTERSECT operator is empty, skip over the
computation of the RHS. FossilOrigin-Name: 13f096ae8a850a05d4a8684561066f11693ee66289e6568c44ef32822cca06f6
This commit is contained in:
17
src/btree.c
17
src/btree.c
@@ -5667,6 +5667,23 @@ int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Return true if the BTree pointed to by cursor pCur contains zero
|
||||
** rows of content. Return false if the table contains content or if
|
||||
** if there is some kind of error. This routine is used as an optimization.
|
||||
** Returning false (a false negative) will always result in a correct
|
||||
** answer, though perhaps more slowly. But a false positive (an incorrect
|
||||
** return of true) can yield an incorrect answer.
|
||||
*/
|
||||
int sqlite3BtreeIsEmpty(BtCursor *pCur){
|
||||
int rc;
|
||||
|
||||
assert( cursorOwnsBtShared(pCur) );
|
||||
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
|
||||
if( pCur->eState==CURSOR_VALID ) return 0;
|
||||
rc = moveToRoot(pCur);
|
||||
return rc==SQLITE_EMPTY;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* The cursors is CURSOR_VALID and has BTCF_AtLast set. Verify that
|
||||
** this flags are true for a consistent database.
|
||||
|
Reference in New Issue
Block a user