Remove the ColumnCount opcode, which had become a no-op. (CVS 821)

FossilOrigin-Name: 86deb12d68026913d181f9498144fa56445899f2
This commit is contained in:
drh 2003-01-11 13:30:57 +00:00
parent 820f3812d8
commit 836faa4843
10 changed files with 47 additions and 70 deletions

View File

@ -1,5 +1,5 @@
C Port\sot\sMacOS\sClassic.\s\sTicket\s#218.\s(CVS\s820)
D 2003-01-08T13:02:52
C Remove\sthe\sColumnCount\sopcode,\swhich\shad\sbecome\sa\sno-op.\s(CVS\s821)
D 2003-01-11T13:30:57
F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -20,28 +20,28 @@ F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
F src/btree.c 131b5903f66e148f0f9af0cedd1c6654932c4e04
F src/btree.h 17710339f7a8f46e3c7d6d0d4648ef19c584ffda
F src/build.c 8569ac014609add4b796260d3567a5090b90056d
F src/delete.c aad9d4051ab46e6f6391ea5f7b8994a7c05bdd15
F src/build.c f355fa02bb53cdaa417ea1c34a43de1129a57e94
F src/delete.c 1c677cad4879485c2aea5ef40f417b3ec3f7be12
F src/encode.c 6c9c87d5b7b2c0101d011ebc283a80abf672a4d1
F src/expr.c 9427b4d1d04ede1095994b8e042abe2e6fea7443
F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c 764300a0bd8074a2174946c0bf8a550bd833397a
F src/insert.c 74018ec733f2c443671840018e5e5f1ddbc37838
F src/main.c cee05c2ba23b5e78f9671f319dbd68e2130e0f68
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c 28447687e7914306650f72058f62f7162faeef1f
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
F src/pager.c 20ea93000c5580f1ee4fa56dcc3d3589da35c70f
F src/pager.c 6874ea294cbca2aef6e83eb745a67c01cbb5f94b
F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
F src/parse.y 427a17888c117cc9cc35311eda0603d55437f02b
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c cc8640e5d4e3ec1a8de58fde6b2fdd6f846b7263
F src/select.c 754af8fabcdfae2fd0f49a5b4cce6bc2bcc370f8
F src/shell.c c9946847b81b8b7f32ad195498dafbc623c6874f
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 98b1574b2362abe02c4a4c73b9dbf99bcd713ab3
F src/sqliteInt.h 65dfa06bc49ebff83361bfb259ee4c675534808a
F src/sqliteInt.h 4f7511446a7616ffa24542dda5bf596776852c2d
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
F src/test1.c a46e9f61915b32787c5d5a05a4b92e4dacc437d9
@ -50,9 +50,9 @@ F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
F src/update.c 881e4c8e7c786545da4fd2d95da19252b2e31137
F src/update.c ab3182eae676d7f198354df6a54e8611aac6ae9c
F src/util.c e2d108842e02810d3d3242cac0e024b09cdb3c4a
F src/vdbe.c 42577c260b0bba8ff8dce60a0ffd8c71f413ef35
F src/vdbe.c e1f66bb2f56bf3cd974d5a385bfd03ace5c108a5
F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
F src/where.c af235636b7bc7f7f42ee1c7162d1958ad0102cab
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
@ -152,7 +152,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P 2f89e9e6963cb715f3671f1fdbf4c966aadff6c8
R 4381eebdc5a5f587e474f3576a177725
P 13f82d67f60ae869d5bf2e31d9357a860aa62bad
R 739d9eedd846bdcebaf53de604e2ab96
U drh
Z e0436c44fc862536b296cf3de00d786b
Z 10fbc95a42ce97941079cb975b1ac545

View File

@ -1 +1 @@
13f82d67f60ae869d5bf2e31d9357a860aa62bad
86deb12d68026913d181f9498144fa56445899f2

View File

@ -25,7 +25,7 @@
** ROLLBACK
** PRAGMA
**
** $Id: build.c,v 1.118 2003/01/02 14:43:56 drh Exp $
** $Id: build.c,v 1.119 2003/01/11 13:30:57 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -1872,7 +1872,6 @@ void sqliteCopy(
sqliteVdbeAddOp(v, OP_Noop, 0, 0);
sqliteEndWriteOperation(pParse);
if( db->flags & SQLITE_CountRows ){
sqliteVdbeAddOp(v, OP_ColumnCount, 1, 0);
sqliteVdbeAddOp(v, OP_ColumnName, 0, 0);
sqliteVdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
sqliteVdbeAddOp(v, OP_Callback, 1, 0);
@ -2077,7 +2076,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
{ OP_Integer, 0, 0, 0},
{ OP_Ne, 0, 6, 0},
{ OP_Integer, MAX_PAGES,0, 0},
{ OP_ColumnCount, 1, 0, 0},
{ OP_ColumnName, 0, 0, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
@ -2118,7 +2116,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqliteStrICmp(zLeft,"cache_size")==0 ){
static VdbeOp getCacheSize[] = {
{ OP_ColumnCount, 1, 0, 0},
{ OP_ColumnName, 0, 0, "cache_size"},
{ OP_Callback, 1, 0, 0},
};
@ -2168,7 +2165,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
{ OP_Integer, 0, 0, 0},
{ OP_Lt, 0, 5, 0},
{ OP_AddImm, 1, 0, 0},
{ OP_ColumnCount, 1, 0, 0},
{ OP_ColumnName, 0, 0, "synchronous"},
{ OP_Callback, 1, 0, 0},
};
@ -2209,7 +2205,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
*/
if( sqliteStrICmp(zLeft,"synchronous")==0 ){
static VdbeOp getSync[] = {
{ OP_ColumnCount, 1, 0, 0},
{ OP_ColumnName, 0, 0, "synchronous"},
{ OP_Callback, 1, 0, 0},
};
@ -2290,7 +2285,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
if( pTab ) v = sqliteGetVdbe(pParse);
if( pTab && v ){
static VdbeOp tableInfoPreface[] = {
{ OP_ColumnCount, 5, 0, 0},
{ OP_ColumnName, 0, 0, "cid"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 0, "type"},
@ -2323,7 +2317,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
if( pIdx ) v = sqliteGetVdbe(pParse);
if( pIdx && v ){
static VdbeOp tableInfoPreface[] = {
{ OP_ColumnCount, 3, 0, 0},
{ OP_ColumnName, 0, 0, "seqno"},
{ OP_ColumnName, 1, 0, "cid"},
{ OP_ColumnName, 2, 0, "name"},
@ -2355,7 +2348,6 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
if( pTab && pIdx && v ){
int i = 0;
static VdbeOp indexListPreface[] = {
{ OP_ColumnCount, 3, 0, 0},
{ OP_ColumnName, 0, 0, "seq"},
{ OP_ColumnName, 1, 0, "name"},
{ OP_ColumnName, 2, 0, "unique"},
@ -2394,16 +2386,15 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
{ OP_SetInsert, 0, 0, 0},
{ OP_Next, 0, 3, 0},
{ OP_IntegrityCk, 0, 0, 0}, /* 6 */
{ OP_ColumnCount, 1, 0, 0},
{ OP_ColumnName, 0, 0, "integrity_check"},
{ OP_Callback, 1, 0, 0},
{ OP_SetInsert, 1, 0, "2"},
{ OP_OpenAux, 1, 2, 0},
{ OP_Rewind, 1, 16, 0},
{ OP_Column, 1, 3, 0}, /* 13 */
{ OP_Rewind, 1, 15, 0},
{ OP_Column, 1, 3, 0}, /* 12 */
{ OP_SetInsert, 1, 0, 0},
{ OP_Next, 1, 13, 0},
{ OP_IntegrityCk, 1, 1, 0}, /* 16 */
{ OP_Next, 1, 12, 0},
{ OP_IntegrityCk, 1, 1, 0}, /* 15 */
{ OP_Callback, 1, 0, 0},
};
Vdbe *v = sqliteGetVdbe(pParse);

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements.
**
** $Id: delete.c,v 1.42 2002/09/14 13:47:32 drh Exp $
** $Id: delete.c,v 1.43 2003/01/11 13:30:57 drh Exp $
*/
#include "sqliteInt.h"
@ -296,7 +296,6 @@ void sqliteDeleteFrom(
** Return the number of rows that were deleted.
*/
if( db->flags & SQLITE_CountRows ){
sqliteVdbeAddOp(v, OP_ColumnCount, 1, 0);
sqliteVdbeAddOp(v, OP_ColumnName, 0, 0);
sqliteVdbeChangeP3(v, -1, "rows deleted", P3_STATIC);
sqliteVdbeAddOp(v, OP_Callback, 1, 0);

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.67 2002/09/14 13:47:32 drh Exp $
** $Id: insert.c,v 1.68 2003/01/11 13:30:58 drh Exp $
*/
#include "sqliteInt.h"
@ -510,7 +510,6 @@ void sqliteInsert(
** Return the number of rows inserted.
*/
if( db->flags & SQLITE_CountRows ){
sqliteVdbeAddOp(v, OP_ColumnCount, 1, 0);
sqliteVdbeAddOp(v, OP_ColumnName, 0, 0);
sqliteVdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
sqliteVdbeAddOp(v, OP_MemLoad, iCntMem, 0);

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.65 2003/01/07 14:46:08 drh Exp $
** @(#) $Id: pager.c,v 1.66 2003/01/11 13:30:58 drh Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
@ -93,9 +93,14 @@ struct PgHdr {
/*
** How big to make the hash table used for locating in-memory pages
** by page number. Knuth says this should be a prime number.
** by page number.
*/
#define N_PG_HASH 2003
#define N_PG_HASH 2048
/*
** Hash a page number
*/
#define pager_hash(PN) ((PN)&(N_PG_HASH-1))
/*
** A open page cache is an instance of the following structure.
@ -187,11 +192,6 @@ int pager_old_format = 0;
# define pager_old_format 0
#endif
/*
** Hash a page number
*/
#define pager_hash(PN) ((PN)%N_PG_HASH)
/*
** Enable reference count tracking here:
*/
@ -302,7 +302,7 @@ static void page_remove_from_ckpt_list(PgHdr *pPg){
** a pointer to the page or NULL if not found.
*/
static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
PgHdr *p = pPager->aHash[pgno % N_PG_HASH];
PgHdr *p = pPager->aHash[pager_hash(pgno)];
while( p && p->pgno!=pgno ){
p = p->pNextHash;
}
@ -778,7 +778,8 @@ Pgno sqlitepager_pagenumber(void *pData){
** currently on the freelist (the reference count is zero) then
** remove it from the freelist.
*/
static void page_ref(PgHdr *pPg){
#define page_ref(P) ((P)->nRef==0?_page_ref(P):(void)(P)->nRef++)
static void _page_ref(PgHdr *pPg){
if( pPg->nRef==0 ){
/* The page is currently on the freelist. Remove it. */
if( pPg->pPrevFree ){
@ -888,9 +889,8 @@ int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
/* Make sure we have not hit any critical errors.
*/
if( pPager==0 || pgno==0 ){
return SQLITE_ERROR;
}
assert( pPager!=0 );
assert( pgno!=0 );
if( pPager->errMask & ~(PAGER_ERR_FULL) ){
return pager_errcode(pPager);
}
@ -1114,17 +1114,15 @@ int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
void *sqlitepager_lookup(Pager *pPager, Pgno pgno){
PgHdr *pPg;
/* Make sure we have not hit any critical errors.
*/
if( pPager==0 || pgno==0 ){
return 0;
}
assert( pPager!=0 );
assert( pgno!=0 );
if( pPager->errMask & ~(PAGER_ERR_FULL) ){
return 0;
}
if( pPager->nRef==0 ){
return 0;
}
/* if( pPager->nRef==0 ){
** return 0;
** }
*/
pPg = pager_lookup(pPager, pgno);
if( pPg==0 ) return 0;
page_ref(pPg);

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.117 2002/12/03 02:34:50 drh Exp $
** $Id: select.c,v 1.118 2003/01/11 13:30:58 drh Exp $
*/
#include "sqliteInt.h"
@ -689,11 +689,13 @@ static void generateColumnNames(
int i;
if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return;
pParse->colNamesSet = 1;
#if 0
if( pParse->db->flags & SQLITE_ReportTypes ){
sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr*2, 0);
}else{
sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr, 0);
}
#endif
for(i=0; i<pEList->nExpr; i++){
Expr *p;
char *zType = 0;

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.151 2003/01/02 14:43:57 drh Exp $
** @(#) $Id: sqliteInt.h,v 1.152 2003/01/11 13:30:58 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
@ -726,7 +726,7 @@ struct Parse {
Token sLastToken; /* The last token parsed */
Table *pNewTable; /* A table being constructed by CREATE TABLE */
Vdbe *pVdbe; /* An engine for executing database bytecode */
u8 colNamesSet; /* TRUE after OP_ColumnCount has been issued to pVdbe */
u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
u8 explain; /* True if the EXPLAIN flag is found on the query */
u8 initFlag; /* True if reparsing CREATE TABLEs */
u8 nameClash; /* A permanent table name clashes with temp table name */

View File

@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.50 2002/09/14 13:47:32 drh Exp $
** $Id: update.c,v 1.51 2003/01/11 13:30:58 drh Exp $
*/
#include "sqliteInt.h"
@ -386,7 +386,6 @@ void sqliteUpdate(
** Return the number of rows that were changed.
*/
if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
sqliteVdbeAddOp(v, OP_ColumnCount, 1, 0);
sqliteVdbeAddOp(v, OP_ColumnName, 0, 0);
sqliteVdbeChangeP3(v, -1, "rows updated", P3_STATIC);
sqliteVdbeAddOp(v, OP_Callback, 1, 0);

View File

@ -36,7 +36,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.194 2003/01/07 13:55:23 drh Exp $
** $Id: vdbe.c,v 1.195 2003/01/11 13:30:58 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -1716,17 +1716,6 @@ case OP_Push: {
break;
}
/* Opcode: ColumnCount P1 * *
**
** Specify the number of column values that will appear in the
** array passed as the 4th parameter to the callback.
*/
case OP_ColumnCount: {
p->azColName[pOp->p1] = 0;
p->nCallback = 0;
break;
}
/* Opcode: ColumnName P1 * P3
**
** P3 becomes the P1-th column name (first is 0). An array of pointers