mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add serial-types 8 and 9 for integer constants of 0 and 1 that use zero
bytes of storage. Make the default file format 4. Add the SQLITE_DEFAULT_FILE_FORMAT compile-time option to lower the default file format number so that newly created databases can be read and written by older versions of SQLite. (CVS 2845) FossilOrigin-Name: ae301db8a61a74bc72f67f5766811d89a3b3ec72
This commit is contained in:
28
manifest
28
manifest
@ -1,5 +1,5 @@
|
|||||||
C Fix\sfor\sticket\s#1575.\s(CVS\s2844)
|
C Add\sserial-types\s8\sand\s9\sfor\sinteger\sconstants\sof\s0\sand\s1\sthat\suse\szero\nbytes\sof\sstorage.\s\sMake\sthe\sdefault\sfile\sformat\s4.\s\sAdd\sthe\nSQLITE_DEFAULT_FILE_FORMAT\scompile-time\soption\sto\slower\sthe\sdefault\nfile\sformat\snumber\sso\sthat\snewly\screated\sdatabases\scan\sbe\sread\sand\nwritten\sby\solder\sversions\sof\sSQLite.\s(CVS\s2845)
|
||||||
D 2005-12-29T12:53:10
|
D 2005-12-29T19:23:07
|
||||||
F Makefile.in e3c6b3a38d734d41574c04f2fc90d18de2b87102
|
F Makefile.in e3c6b3a38d734d41574c04f2fc90d18de2b87102
|
||||||
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
|
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@ -36,7 +36,7 @@ F src/attach.c ee70131f128d31a9c6dcb8824e8471c91b18601a
|
|||||||
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
|
F src/auth.c 31e2304bef67f44d635655f44234387ea7d21454
|
||||||
F src/btree.c 2b2651e0f6f9f8c5976b662fbfab7fc8f54f02c9
|
F src/btree.c 2b2651e0f6f9f8c5976b662fbfab7fc8f54f02c9
|
||||||
F src/btree.h 8ff86378bb5af0cde282614c16bf0c0190b6d216
|
F src/btree.h 8ff86378bb5af0cde282614c16bf0c0190b6d216
|
||||||
F src/build.c 88a441416fb28139fa24fd0fa34288c618c2b3fc
|
F src/build.c 0982b00aeab443c1469ff83f54df4b383247ca92
|
||||||
F src/callback.c 62066afd516f220575e81b1a1239ab92a2eae252
|
F src/callback.c 62066afd516f220575e81b1a1239ab92a2eae252
|
||||||
F src/complete.c df1681cef40dec33a286006981845f87b194e7a4
|
F src/complete.c df1681cef40dec33a286006981845f87b194e7a4
|
||||||
F src/date.c bb079317bff6a2b78aba5c0d2ddae5f6f03acfb7
|
F src/date.c bb079317bff6a2b78aba5c0d2ddae5f6f03acfb7
|
||||||
@ -63,13 +63,13 @@ F src/pager.c 5227ea29acbea4b6a9c6f1dfd3e8493de5fc2a93
|
|||||||
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
|
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
|
||||||
F src/parse.y 13343510907419ecd2fe72a245f9880df9a7dc20
|
F src/parse.y 13343510907419ecd2fe72a245f9880df9a7dc20
|
||||||
F src/pragma.c 8883b4d34796efa315bdd0ec1b03f580ef1575b9
|
F src/pragma.c 8883b4d34796efa315bdd0ec1b03f580ef1575b9
|
||||||
F src/prepare.c 1417a396efe55e2767f9f97f694d21b8cac2f4d6
|
F src/prepare.c 1f2bf83038792294ef4a307d95993f90e6c70561
|
||||||
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
|
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812
|
||||||
F src/random.c ff5e9a8cad790e2a51cd4d2e7737dc8540e09d1d
|
F src/random.c ff5e9a8cad790e2a51cd4d2e7737dc8540e09d1d
|
||||||
F src/select.c 2292b065bc6be61e01aad39a2e1b93e332fb7e57
|
F src/select.c 2292b065bc6be61e01aad39a2e1b93e332fb7e57
|
||||||
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
|
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
|
||||||
F src/sqlite.h.in 015e02efa9e8bafa31b6c270116369ddff4e9803
|
F src/sqlite.h.in 015e02efa9e8bafa31b6c270116369ddff4e9803
|
||||||
F src/sqliteInt.h 361a613a1b7b1bdf1f040f11fd82e2c3a80a4259
|
F src/sqliteInt.h e3a49f17bd7cb6d3bf33d53d2fdb4e5d69c18e67
|
||||||
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
|
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
|
||||||
F src/tclsqlite.c ce481c0a21a20641cdfe87c9cbbb328cfb3a58b9
|
F src/tclsqlite.c ce481c0a21a20641cdfe87c9cbbb328cfb3a58b9
|
||||||
F src/test1.c 4691cc7235683324791a0be560308ca338de36de
|
F src/test1.c 4691cc7235683324791a0be560308ca338de36de
|
||||||
@ -84,11 +84,11 @@ F src/update.c ec8e540617b116725b5a55c8d6b4db8bc67fdd7d
|
|||||||
F src/utf.c b7bffac4260177ae7f83c01d025fe0f5ed70ce71
|
F src/utf.c b7bffac4260177ae7f83c01d025fe0f5ed70ce71
|
||||||
F src/util.c a690bbf549fc5c465384f624e90c009935b6d18b
|
F src/util.c a690bbf549fc5c465384f624e90c009935b6d18b
|
||||||
F src/vacuum.c fbfdd3967fd34e2f260fafed88dcbf3c10856b94
|
F src/vacuum.c fbfdd3967fd34e2f260fafed88dcbf3c10856b94
|
||||||
F src/vdbe.c c04d2e517e7b515993164f51a3a8fb0958b7f4ce
|
F src/vdbe.c 8b0d676bcd8d8b12606f684ea2d7934147b40101
|
||||||
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
|
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
|
||||||
F src/vdbeInt.h 7b8b8c5dcb203243e4a9a4414c9e488473f67741
|
F src/vdbeInt.h 9b78ba00cc006bff17e04a54ba3ded9fc7810a10
|
||||||
F src/vdbeapi.c b270b680cbc5d20b5a1abfdb08339667985df94e
|
F src/vdbeapi.c b270b680cbc5d20b5a1abfdb08339667985df94e
|
||||||
F src/vdbeaux.c 8fd4f36dba8729fabe7ed6b2a2c1b05b7bf96ebe
|
F src/vdbeaux.c 9dc10a70f0f697b9ede43237522e93ef863763e1
|
||||||
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
|
||||||
F src/vdbemem.c deba8d6e3727643924b210a8c531a496c2b8d386
|
F src/vdbemem.c deba8d6e3727643924b210a8c531a496c2b8d386
|
||||||
F src/where.c 0296a20c2e2a39c0cb785efe471fd1958a5259f3
|
F src/where.c 0296a20c2e2a39c0cb785efe471fd1958a5259f3
|
||||||
@ -145,8 +145,8 @@ F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb
|
|||||||
F test/delete.test e08ffb452f581d58703d0294242c9e2b8d091916
|
F test/delete.test e08ffb452f581d58703d0294242c9e2b8d091916
|
||||||
F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3
|
F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3
|
||||||
F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
|
F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
|
||||||
F test/descidx1.test 8e9c3b91fd70d7a781d4081d8a62e24b7fd88aef
|
F test/descidx1.test 466a9b87f3a7682156916dcbd5b77be55fd39d75
|
||||||
F test/descidx2.test c68734d4068b7f7039deb9586cf0117b86c0d850
|
F test/descidx2.test f9f73c562932b81207faa525cd52acdfd2fc0482
|
||||||
F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
|
F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9
|
||||||
F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
|
F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
|
||||||
F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
|
F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
|
||||||
@ -250,7 +250,7 @@ F test/trigger4.test 4bed3705c9df4aaf7a7b164a2d573410d05ca025
|
|||||||
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
|
F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83
|
||||||
F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9
|
F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9
|
||||||
F test/trigger7.test 0afa870be2ce1b132cdb85b17a4a4ef45aa8cece
|
F test/trigger7.test 0afa870be2ce1b132cdb85b17a4a4ef45aa8cece
|
||||||
F test/types.test 77b9cfe18dd9089f731bc4306dcc2ff079a8c1e0
|
F test/types.test effd31af136981ab970f72951ef33f4f62297a63
|
||||||
F test/types2.test 81dd1897be8ef4b5b73d0006e6076abe40610de3
|
F test/types2.test 81dd1897be8ef4b5b73d0006e6076abe40610de3
|
||||||
F test/types3.test e5f789503849294de74a23b433168e8211523a25
|
F test/types3.test e5f789503849294de74a23b433168e8211523a25
|
||||||
F test/unique.test 0253c4227a5dc533e312202ce21ecfad18058d18
|
F test/unique.test 0253c4227a5dc533e312202ce21ecfad18058d18
|
||||||
@ -331,7 +331,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P a4c547de83d8b27f06a58f9e530a7c983ec1dc3a
|
P 1586921b54da5ba3bea80e8e656a11d32996ab3a
|
||||||
R d2eb26dccbd5fff18c55c4a521df8e83
|
R bc4db2dc25be0402b8c9a8b5fd5e6e6b
|
||||||
U drh
|
U drh
|
||||||
Z 8810d9bb0581dec82c81c2f588a4d368
|
Z 530db925ca043764a717a222a6169115
|
||||||
|
@ -1 +1 @@
|
|||||||
1586921b54da5ba3bea80e8e656a11d32996ab3a
|
ae301db8a61a74bc72f67f5766811d89a3b3ec72
|
17
src/build.c
17
src/build.c
@ -22,7 +22,7 @@
|
|||||||
** COMMIT
|
** COMMIT
|
||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.362 2005/12/29 01:11:37 drh Exp $
|
** $Id: build.c,v 1.363 2005/12/29 19:23:07 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -764,7 +764,7 @@ void sqlite3StartTable(
|
|||||||
sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1); /* file_format */
|
sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1); /* file_format */
|
||||||
lbl = sqlite3VdbeMakeLabel(v);
|
lbl = sqlite3VdbeMakeLabel(v);
|
||||||
sqlite3VdbeAddOp(v, OP_If, 0, lbl);
|
sqlite3VdbeAddOp(v, OP_If, 0, lbl);
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, 1, 0); /* file format defaults to 1 */
|
sqlite3VdbeAddOp(v, OP_Integer, SQLITE_DEFAULT_FILE_FORMAT, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 1);
|
sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 1);
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, db->enc, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, db->enc, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 4);
|
sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 4);
|
||||||
@ -2112,7 +2112,6 @@ void sqlite3CreateIndex(
|
|||||||
Token nullId; /* Fake token for an empty ID list */
|
Token nullId; /* Fake token for an empty ID list */
|
||||||
DbFixer sFix; /* For assigning database names to pTable */
|
DbFixer sFix; /* For assigning database names to pTable */
|
||||||
int sortOrderMask; /* 1 to honor DESC in index. 0 to ignore. */
|
int sortOrderMask; /* 1 to honor DESC in index. 0 to ignore. */
|
||||||
int descSeen = 0; /* Changes to true if a DESC is seen */
|
|
||||||
sqlite3 *db = pParse->db;
|
sqlite3 *db = pParse->db;
|
||||||
Db *pDb; /* The specific table containing the indexed database */
|
Db *pDb; /* The specific table containing the indexed database */
|
||||||
int iDb; /* Index of the database that is being written */
|
int iDb; /* Index of the database that is being written */
|
||||||
@ -2264,7 +2263,7 @@ void sqlite3CreateIndex(
|
|||||||
|
|
||||||
/* Check to see if we should honor DESC requests on index columns
|
/* Check to see if we should honor DESC requests on index columns
|
||||||
*/
|
*/
|
||||||
if( pDb->file_format>=4 || (!pDb->descIndex && !db->init.busy) ){
|
if( pDb->file_format>=4 ){
|
||||||
sortOrderMask = -1; /* Honor DESC */
|
sortOrderMask = -1; /* Honor DESC */
|
||||||
}else{
|
}else{
|
||||||
sortOrderMask = 0; /* Ignore DESC */
|
sortOrderMask = 0; /* Ignore DESC */
|
||||||
@ -2299,11 +2298,8 @@ void sqlite3CreateIndex(
|
|||||||
){
|
){
|
||||||
goto exit_create_index;
|
goto exit_create_index;
|
||||||
}
|
}
|
||||||
requestedSortOrder = pListItem->sortOrder;
|
requestedSortOrder = pListItem->sortOrder & sortOrderMask;
|
||||||
pDb->descIndex |= requestedSortOrder;
|
|
||||||
requestedSortOrder &= sortOrderMask;
|
|
||||||
pIndex->keyInfo.aSortOrder[i] = requestedSortOrder;
|
pIndex->keyInfo.aSortOrder[i] = requestedSortOrder;
|
||||||
descSeen |= requestedSortOrder;
|
|
||||||
}
|
}
|
||||||
pIndex->keyInfo.nField = pList->nExpr;
|
pIndex->keyInfo.nField = pList->nExpr;
|
||||||
sqlite3DefaultRowEst(pIndex);
|
sqlite3DefaultRowEst(pIndex);
|
||||||
@ -2404,11 +2400,6 @@ void sqlite3CreateIndex(
|
|||||||
sqlite3VdbeAddOp(v, OP_CreateIndex, iDb, 0);
|
sqlite3VdbeAddOp(v, OP_CreateIndex, iDb, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_MemStore, iMem, 0);
|
sqlite3VdbeAddOp(v, OP_MemStore, iMem, 0);
|
||||||
|
|
||||||
/* Make sure the file_format is at least 4 if we have DESC indices. */
|
|
||||||
if( descSeen ){
|
|
||||||
sqlite3MinimumFileFormat(pParse, iDb, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Gather the complete text of the CREATE INDEX statement into
|
/* Gather the complete text of the CREATE INDEX statement into
|
||||||
** the zStmt variable
|
** the zStmt variable
|
||||||
*/
|
*/
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
** interface, and routines that contribute to loading the database schema
|
** interface, and routines that contribute to loading the database schema
|
||||||
** from disk.
|
** from disk.
|
||||||
**
|
**
|
||||||
** $Id: prepare.c,v 1.10 2005/12/16 01:06:17 drh Exp $
|
** $Id: prepare.c,v 1.11 2005/12/29 19:23:07 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@ -258,13 +258,13 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
|
|||||||
** file_format==1 Version 3.0.0.
|
** file_format==1 Version 3.0.0.
|
||||||
** file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN
|
** file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN
|
||||||
** file_format==3 Version 3.1.4. // ditto but with non-NULL defaults
|
** file_format==3 Version 3.1.4. // ditto but with non-NULL defaults
|
||||||
** file_format==4 Version 3.3.0. // DESC indices
|
** file_format==4 Version 3.3.0. // DESC indices. Boolean constants
|
||||||
*/
|
*/
|
||||||
pDb->file_format = meta[1];
|
pDb->file_format = meta[1];
|
||||||
if( pDb->file_format==0 ){
|
if( pDb->file_format==0 ){
|
||||||
pDb->file_format = 1;
|
pDb->file_format = 1;
|
||||||
}
|
}
|
||||||
if( pDb->file_format>4 ){
|
if( pDb->file_format>SQLITE_MAX_FILE_FORMAT ){
|
||||||
sqlite3BtreeCloseCursor(curMain);
|
sqlite3BtreeCloseCursor(curMain);
|
||||||
sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0);
|
sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0);
|
||||||
return SQLITE_ERROR;
|
return SQLITE_ERROR;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.443 2005/12/29 01:11:37 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.444 2005/12/29 19:23:07 drh Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITEINT_H_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@ -140,6 +140,17 @@
|
|||||||
*/
|
*/
|
||||||
#define SQLITE_MAX_VARIABLE_NUMBER 999
|
#define SQLITE_MAX_VARIABLE_NUMBER 999
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The "file format" number is an integer that is incremented whenever
|
||||||
|
** the VDBE-level file format changes. The following macros define the
|
||||||
|
** the default file format for new databases and the maximum file format
|
||||||
|
** that the library can read.
|
||||||
|
*/
|
||||||
|
#define SQLITE_MAX_FILE_FORMAT 4
|
||||||
|
#ifndef SQLITE_DEFAULT_FILE_FORMAT
|
||||||
|
# define SQLITE_DEFAULT_FILE_FORMAT 4
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Provide a default value for TEMP_STORE in case it is not specified
|
** Provide a default value for TEMP_STORE in case it is not specified
|
||||||
** on the command-line
|
** on the command-line
|
||||||
@ -360,7 +371,6 @@ struct Db {
|
|||||||
u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */
|
u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */
|
||||||
u8 safety_level; /* How aggressive at synching data to disk */
|
u8 safety_level; /* How aggressive at synching data to disk */
|
||||||
u8 file_format; /* Schema format version for this file */
|
u8 file_format; /* Schema format version for this file */
|
||||||
u8 descIndex; /* True if any index uses the DESC attribute */
|
|
||||||
int cache_size; /* Number of pages to use in the cache */
|
int cache_size; /* Number of pages to use in the cache */
|
||||||
Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */
|
Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */
|
||||||
void *pAux; /* Auxiliary data. Usually NULL */
|
void *pAux; /* Auxiliary data. Usually NULL */
|
||||||
|
31
src/vdbe.c
31
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.508 2005/12/21 18:36:46 drh Exp $
|
** $Id: vdbe.c,v 1.509 2005/12/29 19:23:07 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@ -2107,7 +2107,7 @@ op_column_out:
|
|||||||
**
|
**
|
||||||
** See also OP_MakeIdxRec
|
** See also OP_MakeIdxRec
|
||||||
*/
|
*/
|
||||||
/* Opcode: MakeRecordI P1 P2 P3
|
/* Opcode: MakeIdxRec P1 P2 P3
|
||||||
**
|
**
|
||||||
** This opcode works just OP_MakeRecord except that it reads an extra
|
** This opcode works just OP_MakeRecord except that it reads an extra
|
||||||
** integer from the stack (thus reading a total of abs(P1+1) entries)
|
** integer from the stack (thus reading a total of abs(P1+1) entries)
|
||||||
@ -2149,6 +2149,7 @@ case OP_MakeRecord: {
|
|||||||
int jumpIfNull; /* Jump here if non-zero and any entries are NULL. */
|
int jumpIfNull; /* Jump here if non-zero and any entries are NULL. */
|
||||||
int addRowid; /* True to append a rowid column at the end */
|
int addRowid; /* True to append a rowid column at the end */
|
||||||
char *zAffinity; /* The affinity string for the record */
|
char *zAffinity; /* The affinity string for the record */
|
||||||
|
int file_format; /* File format to use for encoding */
|
||||||
|
|
||||||
leaveOnStack = ((pOp->p1<0)?1:0);
|
leaveOnStack = ((pOp->p1<0)?1:0);
|
||||||
nField = pOp->p1 * (leaveOnStack?-1:1);
|
nField = pOp->p1 * (leaveOnStack?-1:1);
|
||||||
@ -2159,6 +2160,7 @@ case OP_MakeRecord: {
|
|||||||
pData0 = &pTos[1-nField];
|
pData0 = &pTos[1-nField];
|
||||||
assert( pData0>=p->aStack );
|
assert( pData0>=p->aStack );
|
||||||
containsNull = 0;
|
containsNull = 0;
|
||||||
|
file_format = p->minWriteFileFormat;
|
||||||
|
|
||||||
/* Loop through the elements that will make up the record to figure
|
/* 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.
|
||||||
@ -2170,7 +2172,7 @@ case OP_MakeRecord: {
|
|||||||
if( pRec->flags&MEM_Null ){
|
if( pRec->flags&MEM_Null ){
|
||||||
containsNull = 1;
|
containsNull = 1;
|
||||||
}
|
}
|
||||||
serial_type = sqlite3VdbeSerialType(pRec);
|
serial_type = sqlite3VdbeSerialType(pRec, file_format);
|
||||||
nData += sqlite3VdbeSerialTypeLen(serial_type);
|
nData += sqlite3VdbeSerialTypeLen(serial_type);
|
||||||
nHdr += sqlite3VarintLen(serial_type);
|
nHdr += sqlite3VarintLen(serial_type);
|
||||||
}
|
}
|
||||||
@ -2183,7 +2185,7 @@ case OP_MakeRecord: {
|
|||||||
pRowid = &pTos[0-nField];
|
pRowid = &pTos[0-nField];
|
||||||
assert( pRowid>=p->aStack );
|
assert( pRowid>=p->aStack );
|
||||||
sqlite3VdbeMemIntegerify(pRowid);
|
sqlite3VdbeMemIntegerify(pRowid);
|
||||||
serial_type = sqlite3VdbeSerialType(pRowid);
|
serial_type = sqlite3VdbeSerialType(pRowid, 0);
|
||||||
nData += sqlite3VdbeSerialTypeLen(serial_type);
|
nData += sqlite3VdbeSerialTypeLen(serial_type);
|
||||||
nHdr += sqlite3VarintLen(serial_type);
|
nHdr += sqlite3VarintLen(serial_type);
|
||||||
}
|
}
|
||||||
@ -2209,17 +2211,17 @@ 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++){
|
||||||
serial_type = sqlite3VdbeSerialType(pRec);
|
serial_type = sqlite3VdbeSerialType(pRec, file_format);
|
||||||
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
||||||
}
|
}
|
||||||
if( addRowid ){
|
if( addRowid ){
|
||||||
zCsr += sqlite3PutVarint(zCsr, sqlite3VdbeSerialType(pRowid));
|
zCsr += sqlite3PutVarint(zCsr, sqlite3VdbeSerialType(pRowid, 0));
|
||||||
}
|
}
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
zCsr += sqlite3VdbeSerialPut(zCsr, pRec); /* serial data */
|
zCsr += sqlite3VdbeSerialPut(zCsr, pRec, file_format); /* serial data */
|
||||||
}
|
}
|
||||||
if( addRowid ){
|
if( addRowid ){
|
||||||
zCsr += sqlite3VdbeSerialPut(zCsr, pRowid);
|
zCsr += sqlite3VdbeSerialPut(zCsr, pRowid, 0);
|
||||||
}
|
}
|
||||||
assert( zCsr==(zNewRecord+nByte) );
|
assert( zCsr==(zNewRecord+nByte) );
|
||||||
|
|
||||||
@ -2515,6 +2517,7 @@ case OP_OpenWrite: { /* no-push */
|
|||||||
Btree *pX;
|
Btree *pX;
|
||||||
int iDb;
|
int iDb;
|
||||||
Cursor *pCur;
|
Cursor *pCur;
|
||||||
|
Db *pDb;
|
||||||
|
|
||||||
assert( pTos>=p->aStack );
|
assert( pTos>=p->aStack );
|
||||||
sqlite3VdbeMemIntegerify(pTos);
|
sqlite3VdbeMemIntegerify(pTos);
|
||||||
@ -2522,9 +2525,17 @@ case OP_OpenWrite: { /* no-push */
|
|||||||
assert( (pTos->flags & MEM_Dyn)==0 );
|
assert( (pTos->flags & MEM_Dyn)==0 );
|
||||||
pTos--;
|
pTos--;
|
||||||
assert( iDb>=0 && iDb<db->nDb );
|
assert( iDb>=0 && iDb<db->nDb );
|
||||||
pX = db->aDb[iDb].pBt;
|
pDb = &db->aDb[iDb];
|
||||||
|
pX = pDb->pBt;
|
||||||
assert( pX!=0 );
|
assert( pX!=0 );
|
||||||
wrFlag = pOp->opcode==OP_OpenWrite;
|
if( pOp->opcode==OP_OpenWrite ){
|
||||||
|
wrFlag = 1;
|
||||||
|
if( pDb->file_format < p->minWriteFileFormat ){
|
||||||
|
p->minWriteFileFormat = pDb->file_format;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
wrFlag = 0;
|
||||||
|
}
|
||||||
if( p2<=0 ){
|
if( p2<=0 ){
|
||||||
assert( pTos>=p->aStack );
|
assert( pTos>=p->aStack );
|
||||||
sqlite3VdbeMemIntegerify(pTos);
|
sqlite3VdbeMemIntegerify(pTos);
|
||||||
|
@ -307,6 +307,7 @@ struct Vdbe {
|
|||||||
u8 changeCntOn; /* True to update the change-counter */
|
u8 changeCntOn; /* True to update the change-counter */
|
||||||
u8 aborted; /* True if ROLLBACK in another VM causes an abort */
|
u8 aborted; /* True if ROLLBACK in another VM causes an abort */
|
||||||
u8 expired; /* True if the VM needs to be recompiled */
|
u8 expired; /* True if the VM needs to be recompiled */
|
||||||
|
u8 minWriteFileFormat; /* Minimum file format for writable database files */
|
||||||
int nChange; /* Number of db changes made since last reset */
|
int nChange; /* Number of db changes made since last reset */
|
||||||
i64 startTime; /* Time when query started - used for profiling */
|
i64 startTime; /* Time when query started - used for profiling */
|
||||||
};
|
};
|
||||||
@ -332,8 +333,8 @@ void sqlite3VdbePrintOp(FILE*, int, Op*);
|
|||||||
void sqlite3VdbePrintSql(Vdbe*);
|
void sqlite3VdbePrintSql(Vdbe*);
|
||||||
#endif
|
#endif
|
||||||
int sqlite3VdbeSerialTypeLen(u32);
|
int sqlite3VdbeSerialTypeLen(u32);
|
||||||
u32 sqlite3VdbeSerialType(Mem*);
|
u32 sqlite3VdbeSerialType(Mem*, int);
|
||||||
int sqlite3VdbeSerialPut(unsigned char*, Mem*);
|
int sqlite3VdbeSerialPut(unsigned char*, Mem*, int);
|
||||||
int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
|
int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
|
||||||
void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
|
void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
|
||||||
|
|
||||||
|
@ -782,6 +782,7 @@ void sqlite3VdbeMakeReady(
|
|||||||
p->explain |= isExplain;
|
p->explain |= isExplain;
|
||||||
p->magic = VDBE_MAGIC_RUN;
|
p->magic = VDBE_MAGIC_RUN;
|
||||||
p->nChange = 0;
|
p->nChange = 0;
|
||||||
|
p->minWriteFileFormat = 255;
|
||||||
#ifdef VDBE_PROFILE
|
#ifdef VDBE_PROFILE
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1490,7 +1491,9 @@ int sqlite3VdbeCursorMoveto(Cursor *p){
|
|||||||
** 5 6 signed integer
|
** 5 6 signed integer
|
||||||
** 6 8 signed integer
|
** 6 8 signed integer
|
||||||
** 7 8 IEEE float
|
** 7 8 IEEE float
|
||||||
** 8-11 reserved for expansion
|
** 8 0 Integer constant 0
|
||||||
|
** 9 0 Integer constant 1
|
||||||
|
** 10,11 reserved for expansion
|
||||||
** N>=12 and even (N-12)/2 BLOB
|
** N>=12 and even (N-12)/2 BLOB
|
||||||
** N>=13 and odd (N-13)/2 text
|
** N>=13 and odd (N-13)/2 text
|
||||||
**
|
**
|
||||||
@ -1499,7 +1502,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.
|
||||||
*/
|
*/
|
||||||
u32 sqlite3VdbeSerialType(Mem *pMem){
|
u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
|
||||||
int flags = pMem->flags;
|
int flags = pMem->flags;
|
||||||
|
|
||||||
if( flags&MEM_Null ){
|
if( flags&MEM_Null ){
|
||||||
@ -1509,7 +1512,11 @@ u32 sqlite3VdbeSerialType(Mem *pMem){
|
|||||||
/* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
|
/* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
|
||||||
# define MAX_6BYTE ((((i64)0x00001000)<<32)-1)
|
# define MAX_6BYTE ((((i64)0x00001000)<<32)-1)
|
||||||
i64 i = pMem->i;
|
i64 i = pMem->i;
|
||||||
u64 u = i<0 ? -i : i;
|
u64 u;
|
||||||
|
if( file_format>=4 && (i&1)==i ){
|
||||||
|
return 8+i;
|
||||||
|
}
|
||||||
|
u = i<0 ? -i : i;
|
||||||
if( u<=127 ) return 1;
|
if( u<=127 ) return 1;
|
||||||
if( u<=32767 ) return 2;
|
if( u<=32767 ) return 2;
|
||||||
if( u<=8388607 ) return 3;
|
if( u<=8388607 ) return 3;
|
||||||
@ -1548,17 +1555,12 @@ int sqlite3VdbeSerialTypeLen(u32 serial_type){
|
|||||||
** buf. It is assumed that the caller has allocated sufficient space.
|
** buf. It is assumed that the caller has allocated sufficient space.
|
||||||
** 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, int file_format){
|
||||||
u32 serial_type = sqlite3VdbeSerialType(pMem);
|
u32 serial_type = sqlite3VdbeSerialType(pMem, file_format);
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* NULL */
|
|
||||||
if( serial_type==0 ){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Integer and Real */
|
/* Integer and Real */
|
||||||
if( serial_type<=7 ){
|
if( serial_type<=7 && serial_type>0 ){
|
||||||
u64 v;
|
u64 v;
|
||||||
int i;
|
int i;
|
||||||
if( serial_type==7 ){
|
if( serial_type==7 ){
|
||||||
@ -1573,12 +1575,16 @@ int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem){
|
|||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* String or blob */
|
/* String or blob */
|
||||||
assert( serial_type>=12 );
|
if( serial_type>=12 ){
|
||||||
len = sqlite3VdbeSerialTypeLen(serial_type);
|
len = sqlite3VdbeSerialTypeLen(serial_type);
|
||||||
memcpy(buf, pMem->z, len);
|
memcpy(buf, pMem->z, len);
|
||||||
return len;
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NULL or constants 0 or 1 */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1591,8 +1597,6 @@ int sqlite3VdbeSerialGet(
|
|||||||
Mem *pMem /* Memory cell to write value into */
|
Mem *pMem /* Memory cell to write value into */
|
||||||
){
|
){
|
||||||
switch( serial_type ){
|
switch( serial_type ){
|
||||||
case 8: /* Reserved for future use */
|
|
||||||
case 9: /* Reserved for future use */
|
|
||||||
case 10: /* Reserved for future use */
|
case 10: /* Reserved for future use */
|
||||||
case 11: /* Reserved for future use */
|
case 11: /* Reserved for future use */
|
||||||
case 0: { /* NULL */
|
case 0: { /* NULL */
|
||||||
@ -1651,6 +1655,12 @@ int sqlite3VdbeSerialGet(
|
|||||||
}
|
}
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
case 8: /* Integer 0 */
|
||||||
|
case 9: { /* Integer 1 */
|
||||||
|
pMem->i = serial_type-8;
|
||||||
|
pMem->flags = MEM_Int;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
int len = (serial_type-12)/2;
|
int len = (serial_type-12)/2;
|
||||||
pMem->z = (char *)buf;
|
pMem->z = (char *)buf;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this script is descending indices.
|
# focus of this script is descending indices.
|
||||||
#
|
#
|
||||||
# $Id: descidx1.test,v 1.2 2005/12/21 18:36:46 drh Exp $
|
# $Id: descidx1.test,v 1.3 2005/12/29 19:23:07 drh Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
@ -40,8 +40,7 @@ proc get_file_format {{fname test.db}} {
|
|||||||
lindex $meta 2
|
lindex $meta 2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify that the file format jumps to (at least) 4 as soon as a
|
# Verify that the file format starts as 4.
|
||||||
# descending index is created.
|
|
||||||
#
|
#
|
||||||
do_test descidx1-1.1 {
|
do_test descidx1-1.1 {
|
||||||
execsql {
|
execsql {
|
||||||
@ -49,7 +48,7 @@ do_test descidx1-1.1 {
|
|||||||
CREATE INDEX i1 ON t1(b ASC);
|
CREATE INDEX i1 ON t1(b ASC);
|
||||||
}
|
}
|
||||||
get_file_format
|
get_file_format
|
||||||
} {1}
|
} {4}
|
||||||
do_test descidx1-1.2 {
|
do_test descidx1-1.2 {
|
||||||
execsql {
|
execsql {
|
||||||
CREATE INDEX i2 ON t1(a DESC);
|
CREATE INDEX i2 ON t1(a DESC);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this script is descending indices.
|
# focus of this script is descending indices.
|
||||||
#
|
#
|
||||||
# $Id: descidx2.test,v 1.1 2005/12/21 18:36:46 drh Exp $
|
# $Id: descidx2.test,v 1.2 2005/12/29 19:23:07 drh Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
@ -40,8 +40,7 @@ proc get_file_format {{fname test.db}} {
|
|||||||
lindex $meta 2
|
lindex $meta 2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify that the file format jumps to (at least) 4 as soon as a
|
# Verify that the file format starts as 4
|
||||||
# descending index is created.
|
|
||||||
#
|
#
|
||||||
do_test descidx2-1.1 {
|
do_test descidx2-1.1 {
|
||||||
execsql {
|
execsql {
|
||||||
@ -49,7 +48,7 @@ do_test descidx2-1.1 {
|
|||||||
CREATE INDEX i1 ON t1(b ASC);
|
CREATE INDEX i1 ON t1(b ASC);
|
||||||
}
|
}
|
||||||
get_file_format
|
get_file_format
|
||||||
} {1}
|
} {4}
|
||||||
do_test descidx2-1.2 {
|
do_test descidx2-1.2 {
|
||||||
execsql {
|
execsql {
|
||||||
CREATE INDEX i2 ON t1(a DESC);
|
CREATE INDEX i2 ON t1(a DESC);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# it tests that the different storage classes (integer, real, text etc.)
|
# it tests that the different storage classes (integer, real, text etc.)
|
||||||
# all work correctly.
|
# all work correctly.
|
||||||
#
|
#
|
||||||
# $Id: types.test,v 1.16 2005/11/14 22:29:06 drh Exp $
|
# $Id: types.test,v 1.17 2005/12/29 19:23:07 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -208,7 +208,7 @@ do_test types-2.1.8 {
|
|||||||
do_test types-2.1.9 {
|
do_test types-2.1.9 {
|
||||||
set root [db eval {select rootpage from sqlite_master where name = 't1'}]
|
set root [db eval {select rootpage from sqlite_master where name = 't1'}]
|
||||||
record_sizes $root
|
record_sizes $root
|
||||||
} {3 3 3 4 4 6 6 10 10}
|
} {2 3 3 4 4 6 6 10 10}
|
||||||
|
|
||||||
# Insert some reals. These should be 10 byte records.
|
# Insert some reals. These should be 10 byte records.
|
||||||
do_test types-2.2.1 {
|
do_test types-2.2.1 {
|
||||||
@ -229,7 +229,7 @@ do_test types-2.2.2 {
|
|||||||
do_test types-2.2.3 {
|
do_test types-2.2.3 {
|
||||||
set root [db eval {select rootpage from sqlite_master where name = 't2'}]
|
set root [db eval {select rootpage from sqlite_master where name = 't2'}]
|
||||||
record_sizes $root
|
record_sizes $root
|
||||||
} {3 10 10}
|
} {2 10 10}
|
||||||
|
|
||||||
# Insert a NULL. This should be a two byte record.
|
# Insert a NULL. This should be a two byte record.
|
||||||
do_test types-2.3.1 {
|
do_test types-2.3.1 {
|
||||||
|
Reference in New Issue
Block a user