/ Check-in [cc5eda54]
Login

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

Overview
Comment:Make sure temporary registers used within a co-routine are not also used outside of that co-routine, in order to prevent concurrent use of the same register for two different things. Ticket [8c63ff0eca81a9132d8]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | tkt-8c63ff0eca
Files: files | file ages | folders
SHA1: cc5eda54226506652057687f711e0a7d3aa584af
User & Date: drh 2014-02-25 19:38:46
Context
2014-02-25
19:38
Make sure temporary registers used within a co-routine are not also used outside of that co-routine, in order to prevent concurrent use of the same register for two different things. Ticket [8c63ff0eca81a9132d8] Closed-Leaf check-in: cc5eda54 user: drh tags: tkt-8c63ff0eca
18:12
Also adjust the order of files in the amalgamation to ensure that _FILE_OFFSET_BITS is defined before any #include, for QNX. check-in: 23001a85 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

   643    643       dest.iSdst = bIdListInOrder ? regData : 0;
   644    644       dest.nSdst = pTab->nCol;
   645    645       rc = sqlite3Select(pParse, pSelect, &dest);
   646    646       regFromSelect = dest.iSdst;
   647    647       assert( pParse->nErr==0 || rc );
   648    648       if( rc || db->mallocFailed ) goto insert_cleanup;
   649    649       sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);
          650  +    sqlite3ClearTempRegCache(pParse);
   650    651       sqlite3VdbeJumpHere(v, addrTop - 1);                       /* label B: */
   651    652       assert( pSelect->pEList );
   652    653       nColumn = pSelect->pEList->nExpr;
   653    654   
   654    655       /* Set useTempTable to TRUE if the result of the SELECT statement
   655    656       ** should be written into a temporary table (template 4).  Set to
   656    657       ** FALSE if each output row of the SELECT can be written directly into

Changes to src/select.c.

  2747   2747     addrSelectA = sqlite3VdbeCurrentAddr(v) + 1;
  2748   2748     j1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrA, 0, addrSelectA);
  2749   2749     VdbeComment((v, "left SELECT"));
  2750   2750     pPrior->iLimit = regLimitA;
  2751   2751     explainSetInteger(iSub1, pParse->iNextSelectId);
  2752   2752     sqlite3Select(pParse, pPrior, &destA);
  2753   2753     sqlite3VdbeAddOp1(v, OP_EndCoroutine, regAddrA);
         2754  +  sqlite3ClearTempRegCache(pParse);
  2754   2755     sqlite3VdbeJumpHere(v, j1);
  2755   2756   
  2756   2757     /* Generate a coroutine to evaluate the SELECT statement on 
  2757   2758     ** the right - the "B" select
  2758   2759     */
  2759   2760     addrSelectB = sqlite3VdbeCurrentAddr(v) + 1;
  2760   2761     j1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrB, 0, addrSelectB);
................................................................................
  2764   2765     p->iLimit = regLimitB;
  2765   2766     p->iOffset = 0;  
  2766   2767     explainSetInteger(iSub2, pParse->iNextSelectId);
  2767   2768     sqlite3Select(pParse, p, &destB);
  2768   2769     p->iLimit = savedLimit;
  2769   2770     p->iOffset = savedOffset;
  2770   2771     sqlite3VdbeAddOp1(v, OP_EndCoroutine, regAddrB);
         2772  +  sqlite3ClearTempRegCache(pParse);
  2771   2773   
  2772   2774     /* Generate a subroutine that outputs the current row of the A
  2773   2775     ** select as the next output row of the compound select.
  2774   2776     */
  2775   2777     VdbeNoopComment((v, "Output routine for A"));
  2776   2778     addrOutA = generateOutputSubroutine(pParse,
  2777   2779                    p, &destA, pDest, regOutA,