diff options
author | drh <drh@noemail.net> | 2014-08-26 02:15:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-08-26 02:15:07 +0000 |
commit | e1ed0b0e1787b0e5c6b2b59de4e2f161a82bec22 (patch) | |
tree | 8db8af1187650d9cb47db76e85cfb7aa4b0a8682 /src/expr.c | |
parent | 2571e4eddd05dceb9c707e8356153d0836d84228 (diff) | |
parent | 05bbb2e824df2af559aaf301a4a44f16c080ffc8 (diff) | |
download | sqlite-e1ed0b0e1787b0e5c6b2b59de4e2f161a82bec22.tar.gz sqlite-e1ed0b0e1787b0e5c6b2b59de4e2f161a82bec22.zip |
Merge recent performance enhancements and the CAST operator enhancements
into the sessions branch.
FossilOrigin-Name: 08ae974ac80fabe53f515bbbd93ccf55de8ee671
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/expr.c b/src/expr.c index 0d2292e94..fabdae2fc 100644 --- a/src/expr.c +++ b/src/expr.c @@ -2595,26 +2595,13 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ #ifndef SQLITE_OMIT_CAST case TK_CAST: { /* Expressions of the form: CAST(pLeft AS token) */ - int aff, to_op; inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - aff = sqlite3AffinityType(pExpr->u.zToken, 0); - to_op = aff - SQLITE_AFF_TEXT + OP_ToText; - assert( to_op==OP_ToText || aff!=SQLITE_AFF_TEXT ); - assert( to_op==OP_ToBlob || aff!=SQLITE_AFF_NONE ); - assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC ); - assert( to_op==OP_ToInt || aff!=SQLITE_AFF_INTEGER ); - assert( to_op==OP_ToReal || aff!=SQLITE_AFF_REAL ); - testcase( to_op==OP_ToText ); - testcase( to_op==OP_ToBlob ); - testcase( to_op==OP_ToNumeric ); - testcase( to_op==OP_ToInt ); - testcase( to_op==OP_ToReal ); if( inReg!=target ){ sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); inReg = target; } - sqlite3VdbeAddOp1(v, to_op, inReg); + sqlite3VdbeAddOp2(v, OP_Cast, target, + sqlite3AffinityType(pExpr->u.zToken, 0)); testcase( usedAsColumnCache(pParse, inReg, inReg) ); sqlite3ExprCacheAffinityChange(pParse, inReg, 1); break; |