From 31a0bfde9b6994c3040a7f87b29487532d094319 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 16 Apr 2014 19:04:23 +0000 Subject: [PATCH] Clarify the purpose of the nField argument passed to sqlite3VdbeSorterInit(). FossilOrigin-Name: c0c8cff17b7311bbc4fd081313a5552f927c3833 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index b476a4c7f2..df788673d3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sname\sof\svdbeIncrInit2\sto\svdbePmaReaderIncrInit.\sAdd\sa\sheader\scomment\sto\sthe\ssame\sfunction. -D 2014-04-16T17:41:22.128 +C Clarify\sthe\spurpose\sof\sthe\snField\sargument\spassed\sto\ssqlite3VdbeSorterInit(). +D 2014-04-16T19:04:23.830 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ad0921c4b2780d01868cf69b419a4f102308d125 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -286,7 +286,7 @@ F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c d8dc38965507a34b0e150c0d7fc82b02f8cf25ea F src/vdbeblob.c 15377abfb59251bccedd5a9c7d014a895f0c04aa F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447 -F src/vdbesort.c 70e42f93ebc6c4b08fff55f3f3bc6b25916cfeda +F src/vdbesort.c fcd15eb438a3462f4dbeebf506ee9050947236bf F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 @@ -1164,7 +1164,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 69026ec7dc3bd3e33bbe17c221a53cf1dd0f8945 -R ed75157562bc112af42ea8e3070ab11f +P 6622d87675c1d7992b1e6d52ae7da1007a1568a4 +R dd88eb57ef2cb3488d23de10e0a80225 U dan -Z ff87db58800fcd075476469fa2fb9f2f +Z 28b7dc83a03f9f7e8d724df0f79c29e1 diff --git a/manifest.uuid b/manifest.uuid index 52fd8bbfbc..8d63094336 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6622d87675c1d7992b1e6d52ae7da1007a1568a4 \ No newline at end of file +c0c8cff17b7311bbc4fd081313a5552f927c3833 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index 348eb447fd..63f17e4e77 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -794,6 +794,22 @@ static int vdbeSorterDoCompare( /* ** Initialize the temporary index cursor just opened as a sorter cursor. +** +** Usually, the sorter module uses the value of (pCsr->pKeyInfo->nField) +** to determine the number of fields that should be compared from the +** records being sorted. However, if the value passed as argument nField +** is non-zero and the sorter is able to guarantee a stable sort, nField +** is used instead. This is used when sorting records for a CREATE INDEX +** statement. In this case, keys are always delivered to the sorter in +** order of the primary key, which happens to be make up the final part +** of the records being sorted. So if the sort is stable, there is never +** any reason to compare PK fields and they can be ignored for a small +** performance boost. +** +** The sorter can guarantee a stable sort when running in single-threaded +** mode, but not in multi-threaded mode. +** +** SQLITE_OK is returned if successful, or an SQLite error code otherwise. */ int sqlite3VdbeSorterInit( sqlite3 *db, /* Database connection (for malloc()) */ -- 2.47.2