-C Enhance\sdate/time\sfunctions\sto\swork\swith\snegative\syears.\s\sTicket\s#617.\s(CVS\s1255)
-D 2004-02-21T03:28:18
+C More\scode\scleanup\sand\ssize\sreduction.\s(CVS\s1256)
+D 2004-02-21T13:31:10
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/btree.c 0a40efb01fa3a431a16d8604f603431d8c9cebfa
F src/btree.h 41cb3ff6ebc3f6da2d0a074e39ff8c7a2287469f
F src/btree_rb.c 32b2cb4285c0fbd53b89de021637b63d52257e54
-F src/build.c e6d71a3babd1f523abdd806555be3430adbd69eb
+F src/build.c f6ef61a2b9524f5d1fd66a500747b6a5c114dd0f
F src/copy.c 391ce142f6b1faa093867ecee134f61a5028a9af
F src/date.c 6120c591cd905799318018cc67df53e9bdfaef28
F src/delete.c 8e2ff752bf485906effcc64f267cdd7227463567
F src/pager.c 29ddad4dd454f0aaa98e2bcd327710ab9f02f833
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
F src/parse.y 226bbdba2dee362d4b1cacc424bd82f7740071ee
-F src/pragma.c fe677be978d8cae19f73272d52f91ba4b95af2da
-F src/printf.c 84e4ea4ba49cbbf930e95e82295127ad5843ae1f
+F src/pragma.c dab17a6093fc249c0faf93c7b65dccc056fec7fb
+F src/printf.c ef1838bd06246d5d323600dc592d337b1c0762b0
F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
F src/select.c 9a41dace754f0dab5e991e402c05fa3c24d04f19
F src/shell.c c3d3404fa82bb0808444fda9884d1bb572fd18b9
F src/sqlite.h.in 64f016cd5ce190643a0f47760188fdf4e0b2227e
-F src/sqliteInt.h d943f207ab70368e83722a4f1e30cfe01f6da23a
+F src/sqliteInt.h c647413de0ab8f6e70a1972126da6ed2a84fb5cc
F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
F src/tclsqlite.c b84dafe3a8532ff534c36e96bd38880e4b9cedf3
F src/test1.c 56e9a156df3ad5e4e98df776776e963effc727f7
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
F src/test4.c dcbbbb382626fd466a7c46907f74db35fc8bad64
F src/tokenize.c 6676b946fd8825b67ab52140af4fdc57a70bda48
-F src/trigger.c 0d4f05097be308ea440629d17fdf3fd2a7244eba
+F src/trigger.c a9927b57c865b6f3df3fb5e40c9824d722660ded
F src/update.c e6eed1a4a429cc28f57533365c72293794c904cf
F src/util.c 64995b5949a5d377629ffd2598747bc771cade1e
F src/vacuum.c d9e80c2b36ee1f623dbf1bdf3cedad24a23f87ac
F src/vdbe.c f14e8e2ef82cb8480394697c40644d70195598e5
-F src/vdbe.h b9f6f1b5f9d1bfceb8bda5e396877ba584c4519c
+F src/vdbe.h b1b22ffca48f593d375fd846c583679d49c2e5c9
F src/vdbeInt.h b40ff02ce39fd076e6ff3369e19c1bbfe1986682
-F src/vdbeaux.c 9f8c7eeeeabd5c7b7fd10adb106212651c53796a
+F src/vdbeaux.c 2268af6441a55461ec80e5d8f57d77267cd46423
F src/where.c 1302d728bd338c237e6a8282e4e3eadbbdf11e45
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test ba8261d38da6b6a7d4f78ec543c548c4418582ef
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 6954d2c3240459842be655b600c6b160e918e74a
-R 3b2fc592a58487f152d3f08ba1a44ce5
+P ffa971934867b6bbe943c004154d5f161e0ea697
+R 3a6c0549c38d90190c4b2bf7000765c4
U drh
-Z 27734a3b760ca8def8dc98b0f2f23cfc
+Z dede23b0f1723cf1feddae3af208c31d
-ffa971934867b6bbe943c004154d5f161e0ea697
\ No newline at end of file
+8e3eda2a909bd80b2b14ace36ab44303750a4409
\ No newline at end of file
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.170 2004/02/14 23:59:57 drh Exp $
+** $Id: build.c,v 1.171 2004/02/21 13:31:10 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
*/
v = sqliteGetVdbe(pParse);
if( v ){
- static VdbeOp dropTable[] = {
+ static VdbeOpList dropTable[] = {
{ OP_Rewind, 0, ADDR(8), 0},
{ OP_String, 0, 0, 0}, /* 1 */
{ OP_MemStore, 1, 1, 0},
/* Generate code to remove the index and from the master table */
v = sqliteGetVdbe(pParse);
if( v ){
- static VdbeOp dropIndex[] = {
+ static VdbeOpList dropIndex[] = {
{ OP_Rewind, 0, ADDR(9), 0},
{ OP_String, 0, 0, 0}, /* 1 */
{ OP_MemStore, 1, 1, 0},
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.15 2004/02/20 14:50:58 drh Exp $
+** $Id: pragma.c,v 1.16 2004/02/21 13:31:10 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
** and a positive value means synchronous is on.
*/
if( sqliteStrICmp(zLeft,"default_cache_size")==0 ){
- static VdbeOp getCacheSize[] = {
+ static VdbeOpList getCacheSize[] = {
{ OP_ReadCookie, 0, 2, 0},
{ OP_AbsValue, 0, 0, 0},
{ OP_Dup, 0, 0, 0},
{ OP_Integer, 0, 0, 0},
{ OP_Ne, 0, 6, 0},
- { OP_Integer, MAX_PAGES,0, 0},
+ { OP_Integer, 0, 0, 0}, /* 5 */
{ OP_ColumnName, 0, 1, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
+ int addr;
if( pRight->z==pLeft->z ){
- sqliteVdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
+ addr = sqliteVdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
+ sqliteVdbeChangeP1(v, addr+5, MAX_PAGES);
}else{
- int addr;
int size = atoi(zRight);
if( size<0 ) size = -size;
sqliteBeginWriteOperation(pParse, 0, 0);
** N should be a positive integer.
*/
if( sqliteStrICmp(zLeft,"cache_size")==0 ){
- static VdbeOp getCacheSize[] = {
+ static VdbeOpList getCacheSize[] = {
{ OP_ColumnName, 0, 1, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
** zero, but with a write performance penalty. The default mode is NORMAL.
*/
if( sqliteStrICmp(zLeft,"default_synchronous")==0 ){
- static VdbeOp getSync[] = {
+ static VdbeOpList getSync[] = {
{ OP_ColumnName, 0, 1, "synchronous"},
{ OP_ReadCookie, 0, 3, 0},
{ OP_Dup, 0, 0, 0},
** opened.
*/
if( sqliteStrICmp(zLeft,"synchronous")==0 ){
- static VdbeOp getSync[] = {
+ static VdbeOpList getSync[] = {
{ OP_ColumnName, 0, 1, "synchronous"},
{ OP_Callback, 1, 0, 0},
};
Table *pTab;
pTab = sqliteFindTable(db, zRight, 0);
if( pTab ){
- static VdbeOp tableInfoPreface[] = {
+ static VdbeOpList tableInfoPreface[] = {
{ OP_ColumnName, 0, 0, "cid"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 0, "type"},
Table *pTab;
pIdx = sqliteFindIndex(db, zRight, 0);
if( pIdx ){
- static VdbeOp tableInfoPreface[] = {
+ static VdbeOpList tableInfoPreface[] = {
{ OP_ColumnName, 0, 0, "seqno"},
{ OP_ColumnName, 1, 0, "cid"},
{ OP_ColumnName, 2, 1, "name"},
}
if( pTab && pIdx ){
int i = 0;
- static VdbeOp indexListPreface[] = {
+ static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "seq"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 1, "unique"},
}
if( pTab && pFK ){
int i = 0;
- static VdbeOp indexListPreface[] = {
+ static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "id"},
{ OP_ColumnName, 1, 0, "seq"},
{ OP_ColumnName, 2, 0, "table"},
if( sqliteStrICmp(zLeft, "database_list")==0 ){
int i;
- static VdbeOp indexListPreface[] = {
+ static VdbeOpList indexListPreface[] = {
{ OP_ColumnName, 0, 0, "seq"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 1, "file"},
** override this setting
*/
if( sqliteStrICmp(zLeft, "temp_store")==0 ){
- static VdbeOp getTmpDbLoc[] = {
+ static VdbeOpList getTmpDbLoc[] = {
{ OP_ColumnName, 0, 1, "temp_store"},
{ OP_Callback, 1, 0, 0},
};
** override this setting
*/
if( sqliteStrICmp(zLeft, "default_temp_store")==0 ){
- static VdbeOp getTmpDbLoc[] = {
+ static VdbeOpList getTmpDbLoc[] = {
{ OP_ColumnName, 0, 1, "temp_store"},
{ OP_ReadCookie, 0, 5, 0},
{ OP_Callback, 1, 0, 0}};
/* Code that initializes the integrity check program. Set the
** error count 0
*/
- static VdbeOp initCode[] = {
+ static VdbeOpList initCode[] = {
{ OP_Integer, 0, 0, 0},
{ OP_MemStore, 0, 1, 0},
{ OP_ColumnName, 0, 1, "integrity_check"},
/* Code to do an BTree integrity check on a single database file.
*/
- static VdbeOp checkDb[] = {
+ static VdbeOpList checkDb[] = {
{ OP_SetInsert, 0, 0, "2"},
{ OP_Integer, 0, 0, 0}, /* 1 */
{ OP_OpenRead, 0, 2, 0},
** messages have been generated, output OK. Otherwise output the
** error message
*/
- static VdbeOp endCode[] = {
+ static VdbeOpList endCode[] = {
{ OP_MemLoad, 0, 0, 0},
{ OP_Integer, 0, 0, 0},
{ OP_Ne, 0, 0, 0}, /* 2 */
sqliteVdbeAddOp(v, OP_MemIncr, 1, 0);
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
int k, jmp2;
- static VdbeOp idxErr[] = {
+ static VdbeOpList idxErr[] = {
{ OP_MemIncr, 0, 0, 0},
{ OP_String, 0, 0, "rowid "},
{ OP_Recno, 1, 0, 0},
sqliteVdbeAddOp(v, OP_Next, 1, loopTop+1);
sqliteVdbeChangeP2(v, loopTop, sqliteVdbeCurrentAddr(v));
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
- static VdbeOp cntIdx[] = {
+ static VdbeOpList cntIdx[] = {
{ OP_Integer, 0, 0, 0},
{ OP_MemStore, 2, 1, 0},
{ OP_Rewind, 0, 0, 0}, /* 2 */
etByte errorflag = 0; /* True if an error is encountered */
etByte xtype; /* Conversion paradigm */
char *zExtra; /* Extra memory used for etTCLESCAPE conversions */
- static char spaces[] = " "
- " ";
+ static char spaces[] = " ";
#define etSPACESIZE (sizeof(spaces)-1)
#ifndef etNOFLOATINGPOINT
int exp; /* exponent of real numbers */
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.215 2004/02/20 22:53:39 rdc Exp $
+** @(#) $Id: sqliteInt.h,v 1.216 2004/02/21 13:31:10 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
#include "hash.h"
-#include "vdbe.h"
#include "parse.h"
#include "btree.h"
#include <stdio.h>
#ifndef UINT8_TYPE
# define UINT8_TYPE unsigned char
#endif
+#ifndef INT8_TYPE
+# define INT8_TYPE signed char
+#endif
#ifndef INTPTR_TYPE
# if SQLITE_PTR_SZ==4
# define INTPTR_TYPE int
typedef UINT32_TYPE u32; /* 4-byte unsigned integer */
typedef UINT16_TYPE u16; /* 2-byte unsigned integer */
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
+typedef UINT8_TYPE i8; /* 1-byte signed integer */
typedef INTPTR_TYPE ptr; /* Big enough to hold a pointer */
typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */
+/*
+** Defer sourcing vdbe.h until after the "u8" typedef is defined.
+*/
+#include "vdbe.h"
+
/*
** Most C compilers these days recognize "long double", don't they?
** Just in case we encounter one that does not, we will create a macro
** build the sqlite_master entry
*/
if( !db->init.busy ){
- static VdbeOp insertTrig[] = {
+ static VdbeOpList insertTrig[] = {
{ OP_NewRecno, 0, 0, 0 },
{ OP_String, 0, 0, "trigger" },
{ OP_String, 0, 0, 0 }, /* 2: trigger name */
*/
if( pTable!=0 && !nested && (v = sqliteGetVdbe(pParse))!=0 ){
int base;
- static VdbeOp dropTrigger[] = {
+ static VdbeOpList dropTrigger[] = {
{ OP_Rewind, 0, ADDR(9), 0},
{ OP_String, 0, 0, 0}, /* 1 */
{ OP_Column, 0, 1, 0},
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
-** $Id: vdbe.h,v 1.69 2004/02/14 23:59:58 drh Exp $
+** $Id: vdbe.h,v 1.70 2004/02/21 13:31:11 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
** as an instance of the following structure:
*/
struct VdbeOp {
- int opcode; /* What operation to perform */
+ u8 opcode; /* What operation to perform */
int p1; /* First operand */
int p2; /* Second parameter (often the jump destination) */
char *p3; /* Third parameter */
};
typedef struct VdbeOp VdbeOp;
+/*
+** A smaller version of VdbeOp used for the VdbeAddOpList() function because
+** it takes up less space.
+*/
+struct VdbeOpList {
+ u8 opcode; /* What operation to perform */
+ signed char p1; /* First operand */
+ short int p2; /* Second parameter (often the jump destination) */
+ char *p3; /* Third parameter */
+};
+typedef struct VdbeOpList VdbeOpList;
+
/*
** Allowed values of VdbeOp.p3type
*/
Vdbe *sqliteVdbeCreate(sqlite*);
void sqliteVdbeCreateCallback(Vdbe*, int*);
int sqliteVdbeAddOp(Vdbe*,int,int,int);
-int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOp const *aOp);
+int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
void sqliteVdbeChangeP1(Vdbe*, int addr, int P1);
void sqliteVdbeChangeP2(Vdbe*, int addr, int P2);
void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
** Add a whole list of operations to the operation stack. Return the
** address of the first operation added.
*/
-int sqliteVdbeAddOpList(Vdbe *p, int nOp, VdbeOp const *aOp){
+int sqliteVdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
int addr;
assert( p->magic==VDBE_MAGIC_INIT );
if( p->nOp + nOp >= p->nOpAlloc ){
addr = p->nOp;
if( nOp>0 ){
int i;
- for(i=0; i<nOp; i++){
- int p2 = aOp[i].p2;
- p->aOp[i+addr] = aOp[i];
- if( p2<0 ) p->aOp[i+addr].p2 = addr + ADDR(p2);
- p->aOp[i+addr].p3type = aOp[i].p3 ? P3_STATIC : P3_NOTUSED;
+ VdbeOpList const *pIn = aOp;
+ for(i=0; i<nOp; i++, pIn++){
+ int p2 = pIn->p2;
+ VdbeOp *pOut = &p->aOp[i+addr];
+ pOut->opcode = pIn->opcode;
+ pOut->p1 = pIn->p1;
+ pOut->p2 = p2<0 ? addr + ADDR(p2) : p2;
+ pOut->p3 = pIn->p3;
+ pOut->p3type = pIn->p3 ? P3_STATIC : P3_NOTUSED;
#ifndef NDEBUG
if( sqlite_vdbe_addop_trace ){
sqliteVdbePrintOp(0, i+addr, &p->aOp[i+addr]);