From: drh <> Date: Sat, 14 Jun 2025 18:02:12 +0000 (+0000) Subject: Generalize the indexCellCompare() so that works on any index page, not just X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fflex-search;p=thirdparty%2Fsqlite.git Generalize the indexCellCompare() so that works on any index page, not just the current page that a cursor is pointing to. FossilOrigin-Name: eda518028f60efc7f879b8c10c900b4b1d4861b62f69a076051e98e61e5b1fee --- diff --git a/manifest b/manifest index a1994582f5..de6e6e49ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sissues\swith\sexpression\sindexes\sfor\sflex-search\squeries. -D 2025-06-14T14:46:39.866 +C Generalize\sthe\sindexCellCompare()\sso\sthat\sworks\son\sany\sindex\spage,\snot\sjust\nthe\scurrent\spage\sthat\sa\scursor\sis\spointing\sto. +D 2025-06-14T18:02:12.057 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -726,7 +726,7 @@ F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c e242d4496774dfc88fa278177dd23b607dce369ccafb3f61b41638eea2c9b399 F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea -F src/btree.c fe36ce9242cca45b6c313c2dbd07674ff64328cb02d4ea2623f95567306b5cf7 +F src/btree.c 062be9340c7a61e51130c1cf84821bdde19d0c6c03d9fd8630f15ce0f53d5685 F src/btree.h 70f5f4a2c4767fcada25a94c8ac1fbada4b416e3b18be48a4a090c3a5314505c F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886 F src/build.c 67c1db4c5e89a8519fe9b6dafc287f6bc3627696b5b8536dc5e06db570d8c05f @@ -2208,8 +2208,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5319a55ab2351288261ebf650bca5f18afbfd5a789f01b8976f8f6a1a7b299c0 -R 05e27b22638f8ae759cfda5e7881423d +P 711608e49b0ec2ed885f8b3d0d770ec0590841fc4aaf2c331e4627c64ad7d069 +R 0f91953f10cf45f8030c38e629ad41c9 U drh -Z c7af01466156e21a9f84bc866f8f1d55 +Z f4b14aa877610f8cc0135cf0804977a5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c7562f7f0a..119ce5c0a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -711608e49b0ec2ed885f8b3d0d770ec0590841fc4aaf2c331e4627c64ad7d069 +eda518028f60efc7f879b8c10c900b4b1d4861b62f69a076051e98e61e5b1fee diff --git a/src/btree.c b/src/btree.c index fe368cc96b..d4f9fae419 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5882,8 +5882,8 @@ moveto_table_finish: } /* -** Compare the "idx"-th cell on the page the cursor pCur is currently -** pointing to to pIdxKey using xRecordCompare. Return negative or +** Compare the "idx"-th cell on the page pPage against the key +** pointing to by pIdxKey using xRecordCompare. Return negative or ** zero if the cell is less than or equal pIdxKey. Return positive ** if unknown. ** @@ -5898,12 +5898,11 @@ moveto_table_finish: ** a positive value as that will cause the optimization to be skipped. */ static int indexCellCompare( - BtCursor *pCur, + MemPage *pPage, int idx, UnpackedRecord *pIdxKey, RecordCompare xRecordCompare ){ - MemPage *pPage = pCur->pPage; int c; int nCell; /* Size of the pCell cell in bytes */ u8 *pCell = findCellPastPtr(pPage, idx); @@ -6012,14 +6011,14 @@ int sqlite3BtreeIndexMoveto( ){ int c; if( pCur->ix==pCur->pPage->nCell-1 - && (c = indexCellCompare(pCur, pCur->ix, pIdxKey, xRecordCompare))<=0 + && (c = indexCellCompare(pCur->pPage,pCur->ix,pIdxKey,xRecordCompare))<=0 && pIdxKey->errCode==SQLITE_OK ){ *pRes = c; return SQLITE_OK; /* Cursor already pointing at the correct spot */ } if( pCur->iPage>0 - && indexCellCompare(pCur, 0, pIdxKey, xRecordCompare)<=0 + && indexCellCompare(pCur->pPage, 0, pIdxKey, xRecordCompare)<=0 && pIdxKey->errCode==SQLITE_OK ){ pCur->curFlags &= ~(BTCF_ValidOvfl|BTCF_AtLast);