In the VDBE, allocate space to hold column names when the VDBE first starts.
The ColumnCount opcode now just writes the null terminator into this space. (CVS 818) FossilOrigin-Name: 46d8f5e377bf790c18a7acdd1f3bc20b538d69eb
This commit is contained in:
parent
371ac44d1c
commit
2b8ef743af
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
|||||||
C When\sconstructing\srecords\sand\sindex\skeys,\suse\sstatic\sstring\sspace\srather\sthan\nmallocing\s(when\spossible)\sfor\sa\ssmall\sspeed\simprovement.\s(CVS\s817)
|
C In\sthe\sVDBE,\sallocate\sspace\sto\shold\scolumn\snames\swhen\sthe\sVDBE\sfirst\sstarts.\nThe\sColumnCount\sopcode\snow\sjust\swrites\sthe\snull\sterminator\sinto\sthis\sspace.\s(CVS\s818)
|
||||||
D 2003-01-07T13:43:46
|
D 2003-01-07T13:55:23
|
||||||
F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e
|
F Makefile.in 868c17a1ae1c07603d491274cc8f86c04acf2a1e
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@ -52,7 +52,7 @@ F src/tokenize.c 7ac1c33e0149647c9eb5959c48992df6906d4809
|
|||||||
F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
|
F src/trigger.c 5ba917fc226b96065108da28186c2efaec53e481
|
||||||
F src/update.c 881e4c8e7c786545da4fd2d95da19252b2e31137
|
F src/update.c 881e4c8e7c786545da4fd2d95da19252b2e31137
|
||||||
F src/util.c e2d108842e02810d3d3242cac0e024b09cdb3c4a
|
F src/util.c e2d108842e02810d3d3242cac0e024b09cdb3c4a
|
||||||
F src/vdbe.c 07570003d3378b668408d8e54f4b137a12ca4df6
|
F src/vdbe.c 42577c260b0bba8ff8dce60a0ffd8c71f413ef35
|
||||||
F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
|
F src/vdbe.h 754eba497cfe0c3e352b9c101ab2f811f10d0a55
|
||||||
F src/where.c af235636b7bc7f7f42ee1c7162d1958ad0102cab
|
F src/where.c af235636b7bc7f7f42ee1c7162d1958ad0102cab
|
||||||
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
|
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
|
||||||
@ -152,7 +152,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803
|
|||||||
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
||||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||||
P a362981b20fd33254ad498619eedf75b576682e3
|
P 657c9fb5133aef93e4edd433912e6942ad9674ec
|
||||||
R 167f2117e4d0226460f1cb7008234b4d
|
R 30af34abe888623d0ad22c90d02b73df
|
||||||
U drh
|
U drh
|
||||||
Z 09ee972659cfc232fea37abfb187e33e
|
Z 10b12f5b3cbab70eee4329daa1b839b8
|
||||||
|
@ -1 +1 @@
|
|||||||
657c9fb5133aef93e4edd433912e6942ad9674ec
|
46d8f5e377bf790c18a7acdd1f3bc20b538d69eb
|
21
src/vdbe.c
21
src/vdbe.c
@ -36,7 +36,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.193 2003/01/07 13:43:46 drh Exp $
|
** $Id: vdbe.c,v 1.194 2003/01/07 13:55:23 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -247,7 +247,6 @@ struct Vdbe {
|
|||||||
int nLabelAlloc; /* Number of slots allocated in aLabel[] */
|
int nLabelAlloc; /* Number of slots allocated in aLabel[] */
|
||||||
int *aLabel; /* Space to hold the labels */
|
int *aLabel; /* Space to hold the labels */
|
||||||
int tos; /* Index of top of stack */
|
int tos; /* Index of top of stack */
|
||||||
int nStackAlloc; /* Size of the stack */
|
|
||||||
Stack *aStack; /* The operand stack, except string values */
|
Stack *aStack; /* The operand stack, except string values */
|
||||||
char **zStack; /* Text or binary values of the stack */
|
char **zStack; /* Text or binary values of the stack */
|
||||||
char **azColName; /* Becomes the 4th parameter to callbacks */
|
char **azColName; /* Becomes the 4th parameter to callbacks */
|
||||||
@ -1034,8 +1033,6 @@ static void SorterReset(Vdbe *p){
|
|||||||
static void Cleanup(Vdbe *p){
|
static void Cleanup(Vdbe *p){
|
||||||
int i;
|
int i;
|
||||||
PopStack(p, p->tos+1);
|
PopStack(p, p->tos+1);
|
||||||
sqliteFree(p->azColName);
|
|
||||||
p->azColName = 0;
|
|
||||||
closeAllCursors(p);
|
closeAllCursors(p);
|
||||||
if( p->aMem ){
|
if( p->aMem ){
|
||||||
for(i=0; i<p->nMem; i++){
|
for(i=0; i<p->nMem; i++){
|
||||||
@ -1105,7 +1102,6 @@ void sqliteVdbeDelete(Vdbe *p){
|
|||||||
sqliteFree(p->aOp);
|
sqliteFree(p->aOp);
|
||||||
sqliteFree(p->aLabel);
|
sqliteFree(p->aLabel);
|
||||||
sqliteFree(p->aStack);
|
sqliteFree(p->aStack);
|
||||||
sqliteFree(p->zStack);
|
|
||||||
sqliteFree(p);
|
sqliteFree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,8 +1406,10 @@ int sqliteVdbeExec(
|
|||||||
** Allocation all the stack space we will ever need.
|
** Allocation all the stack space we will ever need.
|
||||||
*/
|
*/
|
||||||
sqliteVdbeAddOp(p, OP_Halt, 0, 0);
|
sqliteVdbeAddOp(p, OP_Halt, 0, 0);
|
||||||
zStack = p->zStack = sqliteMalloc( p->nOp*sizeof(zStack[0]) );
|
aStack = sqliteMalloc( p->nOp*(sizeof(aStack[0]) + 2*sizeof(char*)) );
|
||||||
aStack = p->aStack = sqliteMalloc( p->nOp*sizeof(aStack[0]) );
|
p->aStack = aStack;
|
||||||
|
zStack = p->zStack = (char**)&aStack[p->nOp];
|
||||||
|
p->azColName = (char**)&zStack[p->nOp];
|
||||||
p->tos = -1;
|
p->tos = -1;
|
||||||
#ifdef VDBE_PROFILE
|
#ifdef VDBE_PROFILE
|
||||||
{
|
{
|
||||||
@ -1721,13 +1719,9 @@ case OP_Push: {
|
|||||||
/* Opcode: ColumnCount P1 * *
|
/* Opcode: ColumnCount P1 * *
|
||||||
**
|
**
|
||||||
** Specify the number of column values that will appear in the
|
** Specify the number of column values that will appear in the
|
||||||
** array passed as the 4th parameter to the callback. No checking
|
** array passed as the 4th parameter to the callback.
|
||||||
** is done. If this value is wrong, a coredump can result.
|
|
||||||
*/
|
*/
|
||||||
case OP_ColumnCount: {
|
case OP_ColumnCount: {
|
||||||
char **az = sqliteRealloc(p->azColName, (pOp->p1+1)*sizeof(char*));
|
|
||||||
if( az==0 ){ goto no_mem; }
|
|
||||||
p->azColName = az;
|
|
||||||
p->azColName[pOp->p1] = 0;
|
p->azColName[pOp->p1] = 0;
|
||||||
p->nCallback = 0;
|
p->nCallback = 0;
|
||||||
break;
|
break;
|
||||||
@ -1737,9 +1731,6 @@ case OP_ColumnCount: {
|
|||||||
**
|
**
|
||||||
** P3 becomes the P1-th column name (first is 0). An array of pointers
|
** P3 becomes the P1-th column name (first is 0). An array of pointers
|
||||||
** to all column names is passed as the 4th parameter to the callback.
|
** to all column names is passed as the 4th parameter to the callback.
|
||||||
** The ColumnCount opcode must be executed first to allocate space to
|
|
||||||
** hold the column names. Failure to do this will likely result in
|
|
||||||
** a coredump.
|
|
||||||
*/
|
*/
|
||||||
case OP_ColumnName: {
|
case OP_ColumnName: {
|
||||||
p->azColName[pOp->p1] = pOp->p3;
|
p->azColName[pOp->p1] = pOp->p3;
|
||||||
|
Loading…
Reference in New Issue
Block a user