mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Remove the encoding argument from sqlite3VdbeSerialGet. Use the 32-bit
version of sqlite3GetVarint for schema-level parameters. (CVS 1480) FossilOrigin-Name: 321f8c463520e99681de878b743027c570b73e35
This commit is contained in:
18
manifest
18
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\sAPI\sfunctions\ssqlite3_open_varargs(),\ssqlite3_open16_varargs()\sand\nsqlite3_complete16().\s(CVS\s1479)
|
C Remove\sthe\sencoding\sargument\sfrom\ssqlite3VdbeSerialGet.\s\sUse\sthe\s32-bit\nversion\sof\ssqlite3GetVarint\sfor\sschema-level\sparameters.\s(CVS\s1480)
|
||||||
D 2004-05-27T23:56:16
|
D 2004-05-28T01:39:01
|
||||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -69,11 +69,11 @@ F src/update.c 96461bcf4e946697e83c09c77c7e61b545a2f66e
|
|||||||
F src/utf.c 59b5c8f06a4384a9f64933d6c57a2de02ce3673b
|
F src/utf.c 59b5c8f06a4384a9f64933d6c57a2de02ce3673b
|
||||||
F src/util.c d299404febd509556e720fbecadd880756b0f899
|
F src/util.c d299404febd509556e720fbecadd880756b0f899
|
||||||
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
|
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
|
||||||
F src/vdbe.c c068f9ab3d82906de297c1f20e50d601981328fb
|
F src/vdbe.c ea44f5bef30c7fd8eeb28fb4aa5f05875566b369
|
||||||
F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb
|
F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb
|
||||||
F src/vdbeInt.h 0c30699ea21371980bc278e4e3d17d80ced722df
|
F src/vdbeInt.h 57b649105aeab1e39e77bdb3de3c1560deddc69e
|
||||||
F src/vdbeapi.c b0bb1f98c899ba00c8a5cbca612c2a28a1bb79de
|
F src/vdbeapi.c b0bb1f98c899ba00c8a5cbca612c2a28a1bb79de
|
||||||
F src/vdbeaux.c 408a8949e895d2bf491dbe5e7847f17a7071b185
|
F src/vdbeaux.c 97f240824de0d347967ea1616c5f59bbcf933591
|
||||||
F src/vdbemem.c b487e8a903012de1c0b7f603e8efeede2b51b21d
|
F src/vdbemem.c b487e8a903012de1c0b7f603e8efeede2b51b21d
|
||||||
F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
|
F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
|
||||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||||
@@ -203,7 +203,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
|||||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 0c4d138807f367d75b3fb5b2dadf206df725659f
|
P 203af2b2e3a25f4fe0e128e350c21834cad0bd7f
|
||||||
R c4417647d8e1e01a4408e7060f25760a
|
R 2b74d4b0c22d8325d92f20886c62da43
|
||||||
U danielk1977
|
U drh
|
||||||
Z c4d7bdcd4bae75cf8bc8d11709178bcb
|
Z e19993d4f4e147db54eb88d1ba253c94
|
||||||
|
@@ -1 +1 @@
|
|||||||
203af2b2e3a25f4fe0e128e350c21834cad0bd7f
|
321f8c463520e99681de878b743027c570b73e35
|
28
src/vdbe.c
28
src/vdbe.c
@@ -43,7 +43,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** commenting and indentation practices when changing or adding code.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.341 2004/05/27 19:59:32 drh Exp $
|
** $Id: vdbe.c,v 1.342 2004/05/28 01:39:01 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -1827,7 +1827,7 @@ case OP_Column: {
|
|||||||
BtCursor *pCrsr; /* The BTree cursor */
|
BtCursor *pCrsr; /* The BTree cursor */
|
||||||
u32 *aType; /* aType[i] holds the numeric type of the i-th column */
|
u32 *aType; /* aType[i] holds the numeric type of the i-th column */
|
||||||
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
|
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
|
||||||
u64 nField; /* number of fields in the record */
|
u32 nField; /* number of fields in the record */
|
||||||
u32 szHdr; /* Number of bytes in the record header */
|
u32 szHdr; /* Number of bytes in the record header */
|
||||||
int len; /* The length of the serialized data for the column */
|
int len; /* The length of the serialized data for the column */
|
||||||
int offset = 0; /* Offset into the data */
|
int offset = 0; /* Offset into the data */
|
||||||
@@ -1974,7 +1974,8 @@ case OP_Column: {
|
|||||||
getBtreeMem(pCrsr, aOffset[p2], len, pC->keyAsData, &sMem);
|
getBtreeMem(pCrsr, aOffset[p2], len, pC->keyAsData, &sMem);
|
||||||
zData = sMem.z;
|
zData = sMem.z;
|
||||||
}
|
}
|
||||||
sqlite3VdbeSerialGet(zData, aType[p2], pTos, p->db->enc);
|
sqlite3VdbeSerialGet(zData, aType[p2], pTos);
|
||||||
|
pTos->enc = db->enc;
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
goto abort_due_to_error;
|
goto abort_due_to_error;
|
||||||
}
|
}
|
||||||
@@ -2044,7 +2045,7 @@ case OP_MakeRecord: {
|
|||||||
** out how much space is required for the new record.
|
** out how much space is required for the new record.
|
||||||
*/
|
*/
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type;
|
u32 serial_type;
|
||||||
if( zAffinity ){
|
if( zAffinity ){
|
||||||
applyAffinity(pRec, zAffinity[pRec-pData0], db->enc);
|
applyAffinity(pRec, zAffinity[pRec-pData0], db->enc);
|
||||||
}
|
}
|
||||||
@@ -2070,7 +2071,7 @@ case OP_MakeRecord: {
|
|||||||
zCsr = zNewRecord;
|
zCsr = zNewRecord;
|
||||||
zCsr += sqlite3PutVarint(zCsr, nHdr);
|
zCsr += sqlite3PutVarint(zCsr, nHdr);
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type = sqlite3VdbeSerialType(pRec);
|
u32 serial_type = sqlite3VdbeSerialType(pRec);
|
||||||
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
||||||
}
|
}
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
@@ -2167,7 +2168,7 @@ case OP_MakeIdxKey: {
|
|||||||
** OP_MakeKey when P2 is 0 (used by DISTINCT).
|
** OP_MakeKey when P2 is 0 (used by DISTINCT).
|
||||||
*/
|
*/
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type;
|
u32 serial_type;
|
||||||
if( zAffinity ){
|
if( zAffinity ){
|
||||||
applyAffinity(pRec, zAffinity[pRec-pData0], db->enc);
|
applyAffinity(pRec, zAffinity[pRec-pData0], db->enc);
|
||||||
}
|
}
|
||||||
@@ -2205,7 +2206,7 @@ case OP_MakeIdxKey: {
|
|||||||
|
|
||||||
/* Build the key in the buffer pointed to by zKey. */
|
/* Build the key in the buffer pointed to by zKey. */
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type = sqlite3VdbeSerialType(pRec);
|
u32 serial_type = sqlite3VdbeSerialType(pRec);
|
||||||
offset += sqlite3PutVarint(&zKey[offset], serial_type);
|
offset += sqlite3PutVarint(&zKey[offset], serial_type);
|
||||||
offset += sqlite3VdbeSerialPut(&zKey[offset], pRec);
|
offset += sqlite3VdbeSerialPut(&zKey[offset], pRec);
|
||||||
}
|
}
|
||||||
@@ -3354,7 +3355,7 @@ case OP_Recno: {
|
|||||||
case OP_IdxColumn: {
|
case OP_IdxColumn: {
|
||||||
char *zData;
|
char *zData;
|
||||||
i64 n;
|
i64 n;
|
||||||
u64 serial_type;
|
u32 serial_type;
|
||||||
int len;
|
int len;
|
||||||
int freeZData = 0;
|
int freeZData = 0;
|
||||||
BtCursor *pCsr;
|
BtCursor *pCsr;
|
||||||
@@ -3370,7 +3371,7 @@ case OP_IdxColumn: {
|
|||||||
zData = (char *)sqlite3BtreeKeyFetch(pCsr, n);
|
zData = (char *)sqlite3BtreeKeyFetch(pCsr, n);
|
||||||
assert( zData );
|
assert( zData );
|
||||||
|
|
||||||
len = sqlite3GetVarint(zData, &serial_type);
|
len = sqlite3GetVarint32(zData, &serial_type);
|
||||||
n = sqlite3VdbeSerialTypeLen(serial_type);
|
n = sqlite3VdbeSerialTypeLen(serial_type);
|
||||||
|
|
||||||
zData = (char *)sqlite3BtreeKeyFetch(pCsr, len+n);
|
zData = (char *)sqlite3BtreeKeyFetch(pCsr, len+n);
|
||||||
@@ -3389,7 +3390,8 @@ case OP_IdxColumn: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pTos++;
|
pTos++;
|
||||||
sqlite3VdbeSerialGet(&zData[len], serial_type, pTos, p->db->enc);
|
sqlite3VdbeSerialGet(&zData[len], serial_type, pTos);
|
||||||
|
pTos->enc = db->enc;
|
||||||
if( freeZData ){
|
if( freeZData ){
|
||||||
sqliteFree(zData);
|
sqliteFree(zData);
|
||||||
}
|
}
|
||||||
@@ -3708,7 +3710,7 @@ case OP_IdxRecno: {
|
|||||||
while( len && buf[len-1] ){
|
while( len && buf[len-1] ){
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
sqlite3GetVarint(&buf[len], &sz);
|
sqlite3GetVarint32(&buf[len], &sz);
|
||||||
pTos->flags = MEM_Int;
|
pTos->flags = MEM_Int;
|
||||||
pTos->i = sz;
|
pTos->i = sz;
|
||||||
}
|
}
|
||||||
@@ -3810,8 +3812,8 @@ case OP_IdxIsNull: {
|
|||||||
z = pTos->z;
|
z = pTos->z;
|
||||||
n = pTos->n;
|
n = pTos->n;
|
||||||
for(k=0; k<n && i>0; i--){
|
for(k=0; k<n && i>0; i--){
|
||||||
u64 serial_type;
|
u32 serial_type;
|
||||||
k += sqlite3GetVarint(&z[k], &serial_type);
|
k += sqlite3GetVarint32(&z[k], &serial_type);
|
||||||
if( serial_type==6 ){ /* Serial type 6 is a NULL */
|
if( serial_type==6 ){ /* Serial type 6 is a NULL */
|
||||||
pc = pOp->p2-1;
|
pc = pOp->p2-1;
|
||||||
break;
|
break;
|
||||||
|
@@ -339,10 +339,10 @@ int sqlite3VdbeCursorMoveto(Cursor*);
|
|||||||
#if !defined(NDEBUG) || defined(VDBE_PROFILE)
|
#if !defined(NDEBUG) || defined(VDBE_PROFILE)
|
||||||
void sqlite3VdbePrintOp(FILE*, int, Op*);
|
void sqlite3VdbePrintOp(FILE*, int, Op*);
|
||||||
#endif
|
#endif
|
||||||
int sqlite3VdbeSerialTypeLen(u64);
|
int sqlite3VdbeSerialTypeLen(u32);
|
||||||
u64 sqlite3VdbeSerialType(Mem *);
|
u32 sqlite3VdbeSerialType(Mem*);
|
||||||
int sqlite3VdbeSerialPut(unsigned char *, Mem *);
|
int sqlite3VdbeSerialPut(unsigned char*, Mem*);
|
||||||
int sqlite3VdbeSerialGet(const unsigned char *, u64, Mem *, u8 enc);
|
int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
|
||||||
|
|
||||||
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
|
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
|
||||||
int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int*);
|
int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int*);
|
||||||
|
@@ -1163,7 +1163,7 @@ int sqlite3VdbeCursorMoveto(Cursor *p){
|
|||||||
/*
|
/*
|
||||||
** Return the serial-type for the value stored in pMem.
|
** Return the serial-type for the value stored in pMem.
|
||||||
*/
|
*/
|
||||||
u64 sqlite3VdbeSerialType(Mem *pMem){
|
u32 sqlite3VdbeSerialType(Mem *pMem){
|
||||||
int flags = pMem->flags;
|
int flags = pMem->flags;
|
||||||
|
|
||||||
if( flags&MEM_Null ){
|
if( flags&MEM_Null ){
|
||||||
@@ -1194,7 +1194,7 @@ u64 sqlite3VdbeSerialType(Mem *pMem){
|
|||||||
/*
|
/*
|
||||||
** Return the length of the data corresponding to the supplied serial-type.
|
** Return the length of the data corresponding to the supplied serial-type.
|
||||||
*/
|
*/
|
||||||
int sqlite3VdbeSerialTypeLen(u64 serial_type){
|
int sqlite3VdbeSerialTypeLen(u32 serial_type){
|
||||||
assert( serial_type!=0 );
|
assert( serial_type!=0 );
|
||||||
switch(serial_type){
|
switch(serial_type){
|
||||||
case 6: return 0; /* NULL */
|
case 6: return 0; /* NULL */
|
||||||
@@ -1214,7 +1214,7 @@ int sqlite3VdbeSerialTypeLen(u64 serial_type){
|
|||||||
** Return the number of bytes written.
|
** Return the number of bytes written.
|
||||||
*/
|
*/
|
||||||
int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem){
|
int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem){
|
||||||
u64 serial_type = sqlite3VdbeSerialType(pMem);
|
u32 serial_type = sqlite3VdbeSerialType(pMem);
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
assert( serial_type!=0 );
|
assert( serial_type!=0 );
|
||||||
@@ -1254,9 +1254,8 @@ int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem){
|
|||||||
*/
|
*/
|
||||||
int sqlite3VdbeSerialGet(
|
int sqlite3VdbeSerialGet(
|
||||||
const unsigned char *buf, /* Buffer to deserialize from */
|
const unsigned char *buf, /* Buffer to deserialize from */
|
||||||
u64 serial_type, /* Serial type to deserialize */
|
u32 serial_type, /* Serial type to deserialize */
|
||||||
Mem *pMem, /* Memory cell to write value into */
|
Mem *pMem /* Memory cell to write value into */
|
||||||
u8 enc /* Text encoding. Used to determine nul term. character */
|
|
||||||
){
|
){
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1304,7 +1303,6 @@ int sqlite3VdbeSerialGet(
|
|||||||
pMem->n = len;
|
pMem->n = len;
|
||||||
if( serial_type&0x01 ){
|
if( serial_type&0x01 ){
|
||||||
pMem->flags = MEM_Str | MEM_Ephem;
|
pMem->flags = MEM_Str | MEM_Ephem;
|
||||||
pMem->enc = enc;
|
|
||||||
}else{
|
}else{
|
||||||
pMem->flags = MEM_Blob | MEM_Ephem;
|
pMem->flags = MEM_Blob | MEM_Ephem;
|
||||||
}
|
}
|
||||||
@@ -1336,7 +1334,6 @@ int sqlite3VdbeKeyCompare(
|
|||||||
int offset2 = 0;
|
int offset2 = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
u8 enc = pKeyInfo->enc;
|
|
||||||
const unsigned char *aKey1 = (const unsigned char *)pKey1;
|
const unsigned char *aKey1 = (const unsigned char *)pKey1;
|
||||||
const unsigned char *aKey2 = (const unsigned char *)pKey2;
|
const unsigned char *aKey2 = (const unsigned char *)pKey2;
|
||||||
|
|
||||||
@@ -1344,12 +1341,12 @@ int sqlite3VdbeKeyCompare(
|
|||||||
while( offset1<nKey1 && offset2<nKey2 ){
|
while( offset1<nKey1 && offset2<nKey2 ){
|
||||||
Mem mem1;
|
Mem mem1;
|
||||||
Mem mem2;
|
Mem mem2;
|
||||||
u64 serial_type1;
|
u32 serial_type1;
|
||||||
u64 serial_type2;
|
u32 serial_type2;
|
||||||
|
|
||||||
/* Read the serial types for the next element in each key. */
|
/* Read the serial types for the next element in each key. */
|
||||||
offset1 += sqlite3GetVarint(&aKey1[offset1], &serial_type1);
|
offset1 += sqlite3GetVarint32(&aKey1[offset1], &serial_type1);
|
||||||
offset2 += sqlite3GetVarint(&aKey2[offset2], &serial_type2);
|
offset2 += sqlite3GetVarint32(&aKey2[offset2], &serial_type2);
|
||||||
|
|
||||||
/* If either of the varints just read in are 0 (not a type), then
|
/* If either of the varints just read in are 0 (not a type), then
|
||||||
** this is the end of the keys. The remaining data in each key is
|
** this is the end of the keys. The remaining data in each key is
|
||||||
@@ -1358,8 +1355,8 @@ int sqlite3VdbeKeyCompare(
|
|||||||
*/
|
*/
|
||||||
if( !serial_type1 || !serial_type2 ){
|
if( !serial_type1 || !serial_type2 ){
|
||||||
assert( !serial_type1 && !serial_type2 );
|
assert( !serial_type1 && !serial_type2 );
|
||||||
sqlite3GetVarint(&aKey1[offset1], &serial_type1);
|
sqlite3GetVarint32(&aKey1[offset1], &serial_type1);
|
||||||
sqlite3GetVarint(&aKey2[offset2], &serial_type2);
|
sqlite3GetVarint32(&aKey2[offset2], &serial_type2);
|
||||||
if( serial_type1 < serial_type2 ){
|
if( serial_type1 < serial_type2 ){
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}else if( serial_type1 > serial_type2 ){
|
}else if( serial_type1 > serial_type2 ){
|
||||||
@@ -1377,8 +1374,8 @@ int sqlite3VdbeKeyCompare(
|
|||||||
** the file is corrupted. Then read the value from each key into mem1
|
** the file is corrupted. Then read the value from each key into mem1
|
||||||
** and mem2 respectively.
|
** and mem2 respectively.
|
||||||
*/
|
*/
|
||||||
offset1 += sqlite3VdbeSerialGet(&aKey1[offset1], serial_type1, &mem1, enc);
|
offset1 += sqlite3VdbeSerialGet(&aKey1[offset1], serial_type1, &mem1);
|
||||||
offset2 += sqlite3VdbeSerialGet(&aKey2[offset2], serial_type2, &mem2, enc);
|
offset2 += sqlite3VdbeSerialGet(&aKey2[offset2], serial_type2, &mem2);
|
||||||
|
|
||||||
rc = sqlite3MemCompare(&mem1, &mem2, pKeyInfo->aColl[i]);
|
rc = sqlite3MemCompare(&mem1, &mem2, pKeyInfo->aColl[i]);
|
||||||
if( mem1.flags&MEM_Dyn ){
|
if( mem1.flags&MEM_Dyn ){
|
||||||
@@ -1460,8 +1457,8 @@ int sqlite3VdbeRowCompare(
|
|||||||
** the file is corrupted. Then read the value from each key into mem1
|
** the file is corrupted. Then read the value from each key into mem1
|
||||||
** and mem2 respectively.
|
** and mem2 respectively.
|
||||||
*/
|
*/
|
||||||
d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1, 0);
|
d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
|
||||||
d2 += sqlite3VdbeSerialGet(&aKey2[d2], serial_type2, &mem2, 0);
|
d2 += sqlite3VdbeSerialGet(&aKey2[d2], serial_type2, &mem2);
|
||||||
|
|
||||||
rc = sqlite3MemCompare(&mem1, &mem2, pKeyInfo->aColl[i]);
|
rc = sqlite3MemCompare(&mem1, &mem2, pKeyInfo->aColl[i]);
|
||||||
if( mem1.flags&MEM_Dyn ){
|
if( mem1.flags&MEM_Dyn ){
|
||||||
|
Reference in New Issue
Block a user