From: drh Date: Thu, 11 Jul 2019 19:50:18 +0000 (+0000) Subject: Improved comments and extra testcase() macros on the serial-type computation X-Git-Tag: version-3.30.0~231 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76fd7be3a31d466202bc6ee9026d02150fcc12da;p=thirdparty%2Fsqlite.git Improved comments and extra testcase() macros on the serial-type computation logic in the OP_MakeRecord opcode. FossilOrigin-Name: 18bfb2179ce2c60cec8f5859a84b737731a5e53b28e35072cbb249f18b94262b --- diff --git a/manifest b/manifest index 8246ba53cc..d80704c8a3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sversion\snumber\sto\s3.30.0\sfor\sthe\snext\srelease\scycle. -D 2019-07-11T19:27:02.876 +C Improved\scomments\sand\sextra\stestcase()\smacros\son\sthe\sserial-type\scomputation\nlogic\sin\sthe\sOP_MakeRecord\sopcode. +D 2019-07-11T19:50:18.474 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -594,7 +594,7 @@ F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4 F src/utf.c 2f0fac345c7660d5c5bd3df9e9d8d33d4c27f366bcfb09e07443064d751a0507 F src/util.c aef606a78b85d042138a841babbc0f98471b19b9a340b962e8fae307bc8cf3da F src/vacuum.c 82dcec9e7b1afa980288718ad11bc499651c722d7b9f32933c4d694d91cb6ebf -F src/vdbe.c 6747c7db45059c04b29dbf4ac2d942fc64eb9be630e6b57e5383b14963d54d74 +F src/vdbe.c 0f2927b83545c544b6804ce46a1f5f9b6f135a4dab71287269c8f95fe73a8437 F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237 F src/vdbeInt.h 889c52272a02cea8af6e21b493b08bc9a043e3372a77fdfe838d25e73a47ac92 F src/vdbeapi.c f9161e5c77f512fbb80091ce8af621d19c9556bda5e734cffaac1198407400da @@ -1831,7 +1831,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 d837ab0da52632699abc09320980606aef020df5020c253f99c97e24bf3c6d00 -R 6833cc22c98f4349178f2938814a212d +P 2578e3c64b0a92ab92143f18d107a1a180bd6fa87243661930771c4c080f8098 +R a67b0a32f751a8da1c645dcd2a8e0e61 U drh -Z a695838ee167bf93e6ec909adf5a647f +Z 7bf344500406ecbc140109ce4e156421 diff --git a/manifest.uuid b/manifest.uuid index 18890a82e0..97170210e1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2578e3c64b0a92ab92143f18d107a1a180bd6fa87243661930771c4c080f8098 \ No newline at end of file +18bfb2179ce2c60cec8f5859a84b737731a5e53b28e35072cbb249f18b94262b \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 6c34fb0203..018ba97d32 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -2927,7 +2927,30 @@ case OP_MakeRecord: { #endif /* Loop through the elements that will make up the record to figure - ** out how much space is required for the new record. + ** out how much space is required for the new record. After this loop, + ** the Mem.uTemp field of each term should hold the serial-type that will + ** be used for that term in the generated record: + ** + ** Mem.uTemp value type + ** --------------- --------------- + ** 0 NULL + ** 1 1-byte signed integer + ** 2 2-byte signed integer + ** 3 3-byte signed integer + ** 4 4-byte signed integer + ** 5 6-byte signed integer + ** 6 8-byte signed integer + ** 7 IEEE float + ** 8 Integer constant 0 + ** 9 Integer constant 1 + ** 10,11 reserved for expansion + ** N>=12 and even BLOB + ** N>=13 and odd text + ** + ** The following additional values are computed: + ** nHdr Number of bytes needed for the record header + ** nData Number of bytes of data space needed for the record + ** nZero Zero bytes at the end of the record */ pRec = pLast; do{ @@ -2943,7 +2966,7 @@ case OP_MakeRecord: { assert( pOp->p5==OPFLAG_NOCHNG_MAGIC || CORRUPT_DB ); pRec->uTemp = 10; }else{ - pRec->uTemp = 0; /* Serial-type 0 means NULL */ + pRec->uTemp = 0; } nHdr++; }else if( pRec->flags & (MEM_Int|MEM_IntReal) ){ @@ -2958,6 +2981,11 @@ case OP_MakeRecord: { u = i; } nHdr++; + testcase( u==127 ); testcase( u==128 ); + testcase( u==32767 ); testcase( u==32768 ); + testcase( u==8388607 ); testcase( u==8388608 ); + testcase( u==2147483647 ); testcase( u==2147483648 ); + testcase( u==140737488355327LL ); testcase( u==140737488355328LL ); if( u<=127 ){ if( (i&1)==i && file_format>=4 ){ pRec->uTemp = 8+(u32)u;