Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Reduce the amount of code used to implement OP_SeekGe and similar. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8b12a15a2a8139d75f56a099f3f6af84 |
User & Date: | dan 2013-11-26 18:22:59.246 |
Context
2013-11-26
| ||
21:18 | Changing the CAST behavior of REAL values actually changed a documented requirement. So we also have to change the requirement evidence text to match. (check-in: d84aa44e39 user: drh tags: trunk) | |
18:22 | Reduce the amount of code used to implement OP_SeekGe and similar. (check-in: 8b12a15a2a user: dan tags: trunk) | |
16:51 | Fix a possible NULL pointer deference in the wordcount test program. (check-in: 6f91dca0de user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
3506 3507 3508 3509 3510 3511 3512 | if( (pIn3->flags & MEM_Int)==0 ){ if( (pIn3->flags & MEM_Real)==0 ){ /* If the P3 value cannot be converted into any kind of a number, ** then the seek is not possible, so jump to P2 */ pc = pOp->p2 - 1; break; } | < < < < < < < > > > | < > > > | | < < < | | < < > | | < < < < < < > > | | < | > | | 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 | if( (pIn3->flags & MEM_Int)==0 ){ if( (pIn3->flags & MEM_Real)==0 ){ /* If the P3 value cannot be converted into any kind of a number, ** then the seek is not possible, so jump to P2 */ pc = pOp->p2 - 1; break; } /* If the approximation iKey is larger than the actual real search ** term, substitute >= for > and < for <=. e.g. if the search term ** is 4.9 and the integer approximation 5: ** ** (x > 4.9) -> (x >= 5) ** (x <= 4.9) -> (x < 5) */ if( pIn3->r<(double)iKey ){ assert( OP_SeekGe==(OP_SeekGt-1) ); assert( OP_SeekLt==(OP_SeekLe-1) ); assert( (OP_SeekLe & 0x0001)==(OP_SeekGt & 0x0001) ); if( (oc & 0x0001)==(OP_SeekGt & 0x0001) ) oc--; } /* If the approximation iKey is smaller than the actual real search ** term, substitute <= for < and > for >=. */ else if( pIn3->r>(double)iKey ){ assert( OP_SeekLe==(OP_SeekLt+1) ); assert( OP_SeekGt==(OP_SeekGe+1) ); assert( (OP_SeekLt & 0x0001)==(OP_SeekGe & 0x0001) ); if( (oc & 0x0001)==(OP_SeekLt & 0x0001) ) oc++; } } rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)iKey, 0, &res); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } if( res==0 ){ |
︙ | ︙ |