Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove routines related to sqlite3 varint format. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a30bf1665b277a2dc60071b03ba38b0a |
User & Date: | dan 2013-07-24 18:56:33.919 |
Context
2013-07-24
| ||
19:25 | Replace test file distinct.test with the version from sqlite3. This version accounts for NGQP related changes. check-in: 41fc47c1cd user: dan tags: trunk | |
18:56 | Remove routines related to sqlite3 varint format. check-in: a30bf1665b user: dan tags: trunk | |
18:47 | Remove the (non-working) xfer-optimization code. check-in: edd188471c user: drh tags: trunk | |
Changes
Changes to src/fts5.c.
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 | int iOff = 0; int nStream = 0; int nAlloc; /* If pnRow is not NULL, then this is the global record. Read the ** number of documents in the table from the start of the record. */ if( pnRow ){ | | | | 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | int iOff = 0; int nStream = 0; int nAlloc; /* If pnRow is not NULL, then this is the global record. Read the ** number of documents in the table from the start of the record. */ if( pnRow ){ iOff += sqlite4GetVarint64(&aData[iOff], nData-iOff, (u64 *)pnRow); } iOff += getVarint32(&aData[iOff], nStream); nAlloc = (nStream < nMinStream ? nMinStream : nStream); pSz = sqlite4DbMallocZero(db, sizeof(Fts5Size) + sizeof(i64) * pInfo->nCol * nAlloc ); if( pSz==0 ){ rc = SQLITE4_NOMEM; }else{ int iCol = 0; pSz->aSz = (i64 *)&pSz[1]; pSz->nCol = pInfo->nCol; pSz->nStream = nAlloc; while( iOff<nData ){ int i; i64 *aSz = &pSz->aSz[iCol*nAlloc]; for(i=0; i<nStream; i++){ iOff += sqlite4GetVarint64(&aData[iOff],nData-iOff,(u64*)&aSz[i]); } iCol++; } } } } sqlite4KVCursorClose(pCsr); |
︙ | ︙ | |||
1430 1431 1432 1433 1434 1435 1436 | i64 nRow, u8 *a /* Space to serialize record in */ ){ int iOff = 0; int iCol; if( nRow>=0 ){ | | | | | 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | i64 nRow, u8 *a /* Space to serialize record in */ ){ int iOff = 0; int iCol; if( nRow>=0 ){ iOff += sqlite4PutVarint64(&a[iOff], nRow); } iOff += sqlite4PutVarint64(&a[iOff], pSz->nStream); for(iCol=0; iCol<pSz->nCol; iCol++){ int i; for(i=0; i<pSz->nStream; i++){ iOff += sqlite4PutVarint64(&a[iOff], pSz->aSz[iCol*pSz->nStream+i]); } } return sqlite4KVStoreReplace(p, aKey, nKey, a, iOff); } static int fts5CsrLoadGlobal(Fts5Cursor *pCsr){ |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
2894 2895 2896 2897 2898 2899 2900 | ** file. Code should use the MACRO forms below, as the Varint32 versions ** are coded to assume the single byte case is already handled (which ** the MACRO form does). */ int sqlite4PutVarint(unsigned char*, u64); int sqlite4PutVarint32(unsigned char*, u32); u8 sqlite4GetVarint(const unsigned char *, u64 *); | | | 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 | ** file. Code should use the MACRO forms below, as the Varint32 versions ** are coded to assume the single byte case is already handled (which ** the MACRO form does). */ int sqlite4PutVarint(unsigned char*, u64); int sqlite4PutVarint32(unsigned char*, u32); u8 sqlite4GetVarint(const unsigned char *, u64 *); int sqlite4GetVarint32(const unsigned char *, u32 *); int sqlite4VarintLen(u64 v); int sqlite4GetVarint64(const unsigned char*, int, sqlite4_uint64 *pResult); int sqlite4PutVarint64(unsigned char*, sqlite4_uint64); /* ** The header of a record consists of a sequence variable-length integers. ** These integers are almost always small and are encoded as a single byte. |
︙ | ︙ |
Changes to src/util.c.
︙ | ︙ | |||
376 377 378 379 380 381 382 | ** string is not an integer, just return 0. */ int sqlite4Atoi(const char *z){ int x = 0; if( z ) sqlite4GetInt32(z, &x); return x; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | ** string is not an integer, just return 0. */ int sqlite4Atoi(const char *z){ int x = 0; if( z ) sqlite4GetInt32(z, &x); return x; } /* ** Read or write a four-byte big-endian integer value. */ u32 sqlite4Get4byte(const u8 *p){ return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3]; } |
︙ | ︙ |
Changes to src/varint.c.
︙ | ︙ | |||
219 220 221 222 223 224 225 226 227 228 229 230 231 232 | return 8; } z[0] = 255; varintWrite32(z+1, w); varintWrite32(z+5, y); return 9; } /* ** Compile this one file with the -DTEST_VARINT option to run the simple ** test case below. The test program generates 10 million random 64-bit ** values, weighted toward smaller numbers, and for each value it encodes ** and then decodes the varint to verify that the same number comes back. ** It also checks to make sure the if x<y then memcmp(varint(x),varint(y))<0. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | return 8; } z[0] = 255; varintWrite32(z+1, w); varintWrite32(z+5, y); return 9; } /* ** Return the number of bytes required to encode value v as a varint. */ int sqlite4VarintLen(sqlite4_uint64 v){ unsigned char aDummy[9]; return sqlite4PutVarint64(aDummy, v); } /* ** Read a varint from buffer z and set *pResult to the value read. ** Return the number of bytes read from the buffer. */ int sqlite4GetVarint32(const unsigned char *z, u32 *pResult){ sqlite4_uint64 iRes; int ret; ret = sqlite4GetVarint64(z, 9, &iRes); *pResult = (u32)iRes; return ret; } /* ** Encode v as a varint and write the result to buffer p. Return the ** number of bytes written. */ int sqlite4PutVarint32(unsigned char *p, u32 v){ return sqlite4PutVarint64(p, v); } /* ** Compile this one file with the -DTEST_VARINT option to run the simple ** test case below. The test program generates 10 million random 64-bit ** values, weighted toward smaller numbers, and for each value it encodes ** and then decodes the varint to verify that the same number comes back. ** It also checks to make sure the if x<y then memcmp(varint(x),varint(y))<0. |
︙ | ︙ |