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

Most sorting problems are fixed. Dead code has been removed. 3 test failures

remain but will be fixed by the new function API once it gets implemented. (CVS 1425)

FossilOrigin-Name: 3b55095e036d68886d007239333bbf90acd15692
This commit is contained in:
drh
2004-05-21 02:14:24 +00:00
parent 2f2322fa9c
commit 736c22b803
9 changed files with 64 additions and 132 deletions

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.172 2004/05/21 01:29:06 drh Exp $
** $Id: select.c,v 1.173 2004/05/21 02:14:25 drh Exp $
*/
#include "sqliteInt.h"
@@ -319,28 +319,9 @@ static void sqliteAggregateInfoReset(Parse *pParse){
*/
static void pushOntoSorter(Parse *pParse, Vdbe *v, ExprList *pOrderBy){
int i;
#if 0
char *zSortOrder;
zSortOrder = sqliteMalloc( pOrderBy->nExpr + 1 );
if( zSortOrder==0 ) return;
#endif
for(i=0; i<pOrderBy->nExpr; i++){
#if 0
int order = pOrderBy->a[i].sortOrder;
int c;
if( order==SQLITE_SO_ASC ){
c = 'A';
}else{
c = 'D';
}
zSortOrder[i] = c;
#endif
sqlite3ExprCode(pParse, pOrderBy->a[i].pExpr);
}
#if 0
zSortOrder[pOrderBy->nExpr] = 0;
sqlite3VdbeOp3(v, OP_SortMakeKey, pOrderBy->nExpr, 0, zSortOrder, P3_DYNAMIC);
#endif
sqlite3VdbeAddOp(v, OP_MakeKey, pOrderBy->nExpr, 0);
sqlite3VdbeAddOp(v, OP_SortPut, 0, 0);
}
@@ -675,9 +656,11 @@ static void generateColumnTypes(
zType = pTab->aCol[iCol].zType;
}
}else{
zType = "ANY";
/** TODO: Perhaps something related to the affinity of the
** exprsssion? */
switch( sqlite3ExprType(p) ){
case SQLITE_AFF_TEXT: zType = "TEXT"; break;
case SQLITE_AFF_NUMERIC: zType = "NUMERIC"; break;
default: zType = "ANY"; break;
}
}
sqlite3VdbeOp3(v, OP_ColumnName, i + pEList->nExpr, 0, zType, 0);
}
@@ -1226,11 +1209,15 @@ static void computeLimitRegisters(Parse *pParse, Select *p){
*/
static void openTempIndex(Parse *pParse, Select *p, int iTab, int keyAsData){
KeyInfo *pKeyInfo;
int nColumn = p->pEList->nExpr;
int nColumn;
sqlite *db = pParse->db;
int i;
Vdbe *v = pParse->pVdbe;
if( fillInColumnList(pParse, p) ){
return;
}
nColumn = p->pEList->nExpr;
pKeyInfo = sqliteMalloc( sizeof(*pKeyInfo)+nColumn*sizeof(CollSeq*) );
if( pKeyInfo==0 ) return;
pKeyInfo->nField = nColumn;