From: drh Date: Tue, 14 Feb 2017 20:00:16 +0000 (+0000) Subject: Enable the SQLITE_ENABLE_NULL_TRIM option for WITHOUT ROWID tables. X-Git-Tag: version-3.18.0~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e4acf7b4428d7da85900c58f567d979719bfcf8;p=thirdparty%2Fsqlite.git Enable the SQLITE_ENABLE_NULL_TRIM option for WITHOUT ROWID tables. FossilOrigin-Name: 54836270c9c0bfa5910f7ad74ec238b9d7ddee5f --- diff --git a/manifest b/manifest index 9b10871ba3..66d9fc8753 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\srealistic\slengths\sof\sstring\svalues\sin\sspeedtest1\swith\s--testset\sorm. -D 2017-02-14T16:30:13.697 +C Enable\sthe\sSQLITE_ENABLE_NULL_TRIM\soption\sfor\sWITHOUT\sROWID\stables. +D 2017-02-14T20:00:16.259 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 067a6766f800cc8d72845ab61f8de4ffe8f3fc99 @@ -356,7 +356,7 @@ F src/hash.c 63d0ee752a3b92d4695b2b1f5259c4621b2cfebd F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 -F src/insert.c 444354c23d4d140a57d6eb46f34e376a7f8f62e8 +F src/insert.c 891f6789bafca1f0a3b4f7cbb9c363229eaec828 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e F src/loadext.c a68d8d1d14cf7488bb29dc5311cb1ce9a4404258 F src/main.c e207b81542d13b9f13d61e78ca441f9781f055b0 @@ -1555,7 +1555,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 58b2f911eec2e3eb9944dd6d8573ff5c7bd43f70 -R 20b26eda0719e5594bae6bc77f8993f3 +P e4731fd65f9698817690b741cc454f25e8e871e6 +R 239d7ae4b4c76fa68b6a3d5959c5ddbe U drh -Z ceef40c49fe3ba25325b7e3939c1bded +Z 558f1297c34d38d9f2c9884a0e7f3db0 diff --git a/manifest.uuid b/manifest.uuid index 38bf6ebaca..545a5042ea 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e4731fd65f9698817690b741cc454f25e8e871e6 \ No newline at end of file +54836270c9c0bfa5910f7ad74ec238b9d7ddee5f \ No newline at end of file diff --git a/src/insert.c b/src/insert.c index 894bfc2cc1..897a048ac9 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1527,6 +1527,9 @@ void sqlite3GenerateConstraintChecks( } sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); VdbeComment((v, "for %s", pIdx->zName)); +#ifdef SQLITE_ENABLE_NULL_TRIM + if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable); +#endif /* In an UPDATE operation, if this index is the PRIMARY KEY index ** of a WITHOUT ROWID table and there has been no change the @@ -1682,8 +1685,11 @@ void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ ** version 2 and later (SQLite version 3.1.4, 2005-02-20). */ if( pTab->pSchema->file_format<2 ) return; - for(i=pTab->nCol; i>1 && pTab->aCol[i-1].pDflt==0; i--){} - sqlite3VdbeChangeP5(v, i); + for(i=pTab->nCol-1; i>0; i--){ + if( pTab->aCol[i].pDflt!=0 ) break; + if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break; + } + sqlite3VdbeChangeP5(v, i+1); } #endif