/ Check-in [0a513235]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in the sorting of compound selects. (CVS 423)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0a51323561b7235d46621d9fa25c7111b81c528f
User & Date: drh 2002-03-07 02:02:51
Context
2002-03-08
02:12
Added prototypes to sqlite.h for sqlite_freemem(), sqlite_libversion() and sqlite_libencoding(). (CVS 424) check-in: 145516c9 user: drh tags: trunk
2002-03-07
02:02
Fix a bug in the sorting of compound selects. (CVS 423) check-in: 0a513235 user: drh tags: trunk
2002-03-06
22:04
Beta 2 (CVS 422) check-in: 6c3fb547 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.74 2002/03/03 18:59:41 drh Exp $
           15  +** $Id: select.c,v 1.75 2002/03/07 02:02:51 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Allocate a new Select structure and return a pointer to that
    21     21   ** structure.
    22     22   */
................................................................................
  1192   1192       pParse->nErr++;
  1193   1193       goto select_end;
  1194   1194     }
  1195   1195   
  1196   1196     /* ORDER BY is ignored if we are not sending the result to a callback.
  1197   1197     */
  1198   1198     if( eDest!=SRT_Callback ){
  1199         -    sqliteExprListDelete(p->pOrderBy);
  1200         -    pOrderBy = p->pOrderBy = 0;
         1199  +    pOrderBy = 0;
  1201   1200     }
  1202   1201   
  1203   1202     /* At this point, we should have allocated all the cursors that we
  1204   1203     ** need to handle subquerys and temporary tables.  
  1205   1204     **
  1206   1205     ** Resolve the column names and do a semantics check on all the expressions.
  1207   1206     */
................................................................................
  1287   1286     */
  1288   1287     for(i=0; i<pTabList->nId; i++){
  1289   1288       if( pTabList->a[i].pSelect==0 ) continue;
  1290   1289       sqliteSelect(pParse, pTabList->a[i].pSelect, SRT_TempTable, base+i,
  1291   1290                    p, i, &isAgg);
  1292   1291       pTabList = p->pSrc;
  1293   1292       pWhere = p->pWhere;
  1294         -    pOrderBy = p->pOrderBy;
         1293  +    if( eDest==SRT_Callback ){
         1294  +      pOrderBy = p->pOrderBy;
         1295  +    }
  1295   1296       pGroupBy = p->pGroupBy;
  1296   1297       pHaving = p->pHaving;
  1297   1298       isDistinct = p->isDistinct;
  1298   1299     }
  1299   1300   
  1300   1301     /* Check to see if this is a subquery that can be "flattened" into its parent.
  1301   1302     ** If flattening is a possiblity, do so and return immediately.