/ Check-in [1cff1886]
Login

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

Overview
Comment:After code is generated for a subquery, delete the Select structure in order to force the temporary table to be used and to prevent the subquery from being evaluated a second time. Ticket #601. (CVS 1216)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1cff18868dab5f8ead8ed8d07e088d7fdda04569
User & Date: drh 2004-02-09 14:37:50
Context
2004-02-10
01:54
Allow SQLITE_PAGE_SIZE to be redefined on the compiler command-line. (CVS 1217) check-in: 4c7bf714 user: drh tags: trunk
2004-02-09
14:37
After code is generated for a subquery, delete the Select structure in order to force the temporary table to be used and to prevent the subquery from being evaluated a second time. Ticket #601. (CVS 1216) check-in: 1cff1886 user: drh tags: trunk
14:35
Add test case for ticket #601. (CVS 1215) check-in: 096312da user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2399
2400
2401
2402
2403
2404
2405












2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.150 2004/01/30 02:01:04 drh Exp $
*/
#include "sqliteInt.h"


/*
** Allocate a new Select structure and return a pointer to that
** structure.
................................................................................
  /* Issue a null callback if that is what the user wants.
  */
  if( eDest==SRT_Callback &&
    (pParse->useCallback==0 || (pParse->db->flags & SQLITE_NullCallback)!=0)
  ){
    sqliteVdbeAddOp(v, OP_NullCallback, pEList->nExpr, 0);
  }













  /* The SELECT was successfully coded.   Set the return code to 0
  ** to indicate no errors.
  */
  rc = 0;

  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  sqliteAggregateInfoReset(pParse);
  return rc;
}







|







 







>
>
>
>
>
>
>
>
>
>
>
>













8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.151 2004/02/09 14:37:50 drh Exp $
*/
#include "sqliteInt.h"


/*
** Allocate a new Select structure and return a pointer to that
** structure.
................................................................................
  /* Issue a null callback if that is what the user wants.
  */
  if( eDest==SRT_Callback &&
    (pParse->useCallback==0 || (pParse->db->flags & SQLITE_NullCallback)!=0)
  ){
    sqliteVdbeAddOp(v, OP_NullCallback, pEList->nExpr, 0);
  }

  /* If this was a subquery, we have now converted the subquery into a
  ** temporary table.  So delete the subquery structure from the parent
  ** to prevent this subquery from being evaluated again and to force the
  ** the use of the temporary table.
  */
  if( pParent ){
    assert( pParent->pSrc->nSrc>parentTab );
    assert( pParent->pSrc->a[parentTab].pSelect==p );
    sqliteSelectDelete(p);
    pParent->pSrc->a[parentTab].pSelect = 0;
  }

  /* The SELECT was successfully coded.   Set the return code to 0
  ** to indicate no errors.
  */
  rc = 0;

  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  sqliteAggregateInfoReset(pParse);
  return rc;
}