diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 11 | ||||
-rw-r--r-- | src/vdbeInt.h | 1 | ||||
-rw-r--r-- | src/vdbeaux.c | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index c55dbbe62..d25ae75ab 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,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.464 2005/03/31 18:40:05 drh Exp $ +** $Id: vdbe.c,v 1.465 2005/04/01 10:47:40 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -4117,8 +4117,13 @@ case OP_SortPut: { /* no-push */ if( Dynamicify(pTos, db->enc) ) goto no_mem; pSorter = sqliteMallocRaw( sizeof(Sorter) ); if( pSorter==0 ) goto no_mem; - pSorter->pNext = p->pSort; - p->pSort = pSorter; + pSorter->pNext = 0; + if( p->pSortTail ){ + p->pSortTail->pNext = pSorter; + }else{ + p->pSort = pSorter; + } + p->pSortTail = pSorter; assert( pTos->flags & MEM_Dyn ); pSorter->nKey = pTos->n; pSorter->zKey = pTos->z; diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 37dada46d..23a65067c 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -314,6 +314,7 @@ struct Vdbe { int nCursor; /* Number of slots in apCsr[] */ Cursor **apCsr; /* One element of this array for each open cursor */ Sorter *pSort; /* A linked list of objects to be sorted */ + Sorter *pSortTail; /* Last element on the pSort list */ int nVar; /* Number of entries in aVar[] */ Mem *aVar; /* Values for the OP_Variable opcode. */ char **azVar; /* Name of variables */ diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 2866c3f9b..c4009eae0 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -779,6 +779,7 @@ void sqlite3VdbeSorterReset(Vdbe *p){ sqlite3VdbeMemRelease(&pSorter->data); sqliteFree(pSorter); } + p->pSortTail = 0; } /* |