/ Check-in [fa9eef86]
Login

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

Overview
Comment:Back out part of the previous change that was not really necessary in order to fix [80ba201079ea60], and which in fact serves no useful purpose.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fa9eef865f2f399870305bef82296db25e5b3e90
User & Date: drh 2010-12-06 18:59:14
Context
2010-12-06
21:06
Add the ability to disable constant factoring using sqlite3_test_control(). Add a TCL interface to this new capability and add tests cases to the TCL test scripts to actually use the new capability. check-in: ad8bc681 user: drh tags: trunk
18:59
Back out part of the previous change that was not really necessary in order to fix [80ba201079ea60], and which in fact serves no useful purpose. check-in: fa9eef86 user: drh tags: trunk
18:50
Initialize all constants at the very beginning of a prepared statement. Do not allow constant initialization to occur once control flow has a chance to diverge, to avoid the possibility of having uninitialized registers. Ticket [80ba201079ea60807]. check-in: c5c53152 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
    pExpr->op = TK_REGISTER;
    pExpr->iTable = r2;
    return WRC_Prune;
  }
  return WRC_Continue;
}

/* This routine is part of the parse-tree walker for
** sqlite3ExprCodeConstants().  Simply return WRC_Continue so that
** tree walker logic will extend constant extraction and precoding
** into subqueires.
*/
static int evalConstSelect(Walker *pNotUsed1, Select *pNotUsed2){
  UNUSED_PARAMETER(pNotUsed1);
  UNUSED_PARAMETER(pNotUsed2);
  return WRC_Continue;
}

/*
** Preevaluate constant subexpressions within pExpr and store the
** results in registers.  Modify pExpr so that the constant subexpresions
** are TK_REGISTER opcodes that refer to the precomputed values.
*/
void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){
  Walker w;
  if( pParse->cookieGoto ) return;
  w.xExprCallback = evalConstExpr;
  w.xSelectCallback = evalConstSelect;
  w.pParse = pParse;
  sqlite3WalkExpr(&w, pExpr);
}


/*
** Generate code that pushes the value of every element of the given







<
<
<
<
<
<
<
<
<
<
<









|







3032
3033
3034
3035
3036
3037
3038











3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
    pExpr->op = TK_REGISTER;
    pExpr->iTable = r2;
    return WRC_Prune;
  }
  return WRC_Continue;
}












/*
** Preevaluate constant subexpressions within pExpr and store the
** results in registers.  Modify pExpr so that the constant subexpresions
** are TK_REGISTER opcodes that refer to the precomputed values.
*/
void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){
  Walker w;
  if( pParse->cookieGoto ) return;
  w.xExprCallback = evalConstExpr;
  w.xSelectCallback = 0;
  w.pParse = pParse;
  sqlite3WalkExpr(&w, pExpr);
}


/*
** Generate code that pushes the value of every element of the given