1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Reinsert code deleted by (1998) that we thought was unused but was in fact

needed.  Fix for ticket #966. (CVS 2025)

FossilOrigin-Name: 370ca539506a431dbe77dcb644215886760f34e9
This commit is contained in:
drh
2004-10-19 16:40:59 +00:00
parent 63afe89499
commit 6138df56e7
4 changed files with 39 additions and 11 deletions

View File

@@ -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.418 2004/10/06 15:41:17 drh Exp $
** $Id: vdbe.c,v 1.419 2004/10/19 16:40:59 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -4237,7 +4237,20 @@ case OP_AggGet: {
AggElem *pFocus;
int i = pOp->p2;
pFocus = p->agg.pCurrent;
if( pFocus==0 ) goto no_mem;
if( pFocus==0 ){
int res;
if( sqlite3_malloc_failed ) goto no_mem;
rc = sqlite3BtreeFirst(p->agg.pCsr, &res);
if( rc!=SQLITE_OK ){
return rc;
}
if( res!=0 ){
rc = AggInsert(&p->agg,"",1);
pFocus = p->agg.pCurrent;
}else{
rc = sqlite3BtreeData(p->agg.pCsr, 0, 4, (char *)&pFocus);
}
}
assert( i>=0 && i<p->agg.nMem );
pTos++;
sqlite3VdbeMemShallowCopy(pTos, &pFocus->aMem[i], MEM_Ephem);