From: danielk1977 Date: Tue, 18 May 2004 01:31:14 +0000 (+0000) Subject: Bugfix for row format. (CVS 1391) X-Git-Tag: version-3.6.10~4683 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb015e03e1c1e436bf17d457d8f98cc26e97aa41;p=thirdparty%2Fsqlite.git Bugfix for row format. (CVS 1391) FossilOrigin-Name: c1745f47ae6597953426c852559c3ba559b5ecd4 --- diff --git a/manifest b/manifest index 19ccba2e9e..b470d8842a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sthe\s'\\0'\sat\sthe\send\sof\sUTF-8\sstrings\son\sdisk\s(it\sis\simplied).\sAlso\ndon't\sstore\sthe\snumber\sof\srows\sat\sthe\sbeginning\sof\seach\stable\srecord.\s(CVS\s1390) -D 2004-05-18T01:23:38 +C Bugfix\sfor\srow\sformat.\s(CVS\s1391) +D 2004-05-18T01:31:14 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -66,7 +66,7 @@ F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 F src/vdbe.c 8a6b971c130227fc90a6e899afe218277aa29fdd F src/vdbe.h 94457ca73bae972dc61bca33a4dccc2e6e14e2f8 F src/vdbeInt.h 311c2a046ea419781d0ef331198b7b0a65eebc92 -F src/vdbeaux.c 394bde6b1715e28b869d55e5cd90682d87f527e4 +F src/vdbeaux.c 618861394df84d475e574e22b95e6ed1c9453b1d F src/where.c 5f480219a943b0fed1f6922d2fdbfba8616a9148 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83 @@ -192,7 +192,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 0f6c9b05e688e281fa168aacdd867db408df2863 -R 9aea282a59c85bfd7c0b6fa8bda19f62 +P 202a470f2c1804a96e69f16709d1a92e405971f0 +R ffc409e8b16e570dc32c405b3b469d03 U danielk1977 -Z 2f567abfa9bbe1670a49c48e7ddc69a6 +Z 5eff88f75ed7e1dd3ba47379b0123d5b diff --git a/manifest.uuid b/manifest.uuid index 57c51eb0ac..02e88e32a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -202a470f2c1804a96e69f16709d1a92e405971f0 \ No newline at end of file +c1745f47ae6597953426c852559c3ba559b5ecd4 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index e88341e844..4814647fb6 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1169,7 +1169,12 @@ u64 sqlite3VdbeSerialType(const Mem *pMem){ return 5; } if( flags&MEM_Str ){ - return (pMem->n*2 + 13); + /* We assume that the string is NULL-terminated. We don't store the + ** NULL-terminator - it is implied by the string storage class. + */ + assert( pMem->n>0 ); + assert( pMem->z[pMem->n-1]=='\0' ); + return (pMem->n*2 + 11); /* (pMem->n-1)*2 + 13 */ } if( flags&MEM_Blob ){ return (pMem->n*2 + 12); @@ -1286,15 +1291,17 @@ int sqlite3VdbeSerialGet(const unsigned char *buf, u64 serial_type, Mem *pMem){ /* String or blob */ assert( serial_type>=12 ); + len = sqlite3VdbeSerialTypeLen(serial_type); if( serial_type&0x01 ){ pMem->flags = MEM_Str; + pMem->n = len+1; }else{ pMem->flags = MEM_Blob; + pMem->n = len; } - len = sqlite3VdbeSerialTypeLen(serial_type); - pMem->n = len; - if( len>NBFS ){ - pMem->z = sqliteMallocRaw( len ); + + if( (pMem->n)>NBFS ){ + pMem->z = sqliteMallocRaw( pMem->n ); if( !pMem->z ){ return -1; } @@ -1303,7 +1310,11 @@ int sqlite3VdbeSerialGet(const unsigned char *buf, u64 serial_type, Mem *pMem){ pMem->z = pMem->zShort; pMem->flags |= MEM_Short; } + memcpy(pMem->z, buf, len); + if( pMem->flags&MEM_Str ){ + pMem->z[len] = '\0'; + } return len; } @@ -1461,6 +1472,30 @@ int sqlite3VdbeKeyCompare( return 0; } +/* +** This function compares the two table row records specified by +** {nKey1, pKey1} and {nKey2, pKey2}, returning a negative, zero +** or positive integer if {nKey1, pKey1} is less than, equal to or +** greater than {nKey2, pKey2}. +** +** This function is pretty inefficient and will probably be replace +** by something else in the near future. It is currently required +** by compound SELECT operators. +*/ +int sqlite3VdbeRowCompare( + void *userData, + int nKey1, const void *pKey1, + int nKey2, const void *pKey2 +){ + int offset1 = 0; + int offset2 = 0; + const unsigned char *aKey1 = (const unsigned char *)pKey1; + const unsigned char *aKey2 = (const unsigned char *)pKey2; + + assert( userData==0 ); +} + + /* ** pCur points at an index entry. Read the rowid (varint occuring at ** the end of the entry and store it in *rowid. Return SQLITE_OK if