aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expr.c11
-rw-r--r--src/sqliteInt.h14
2 files changed, 19 insertions, 6 deletions
diff --git a/src/expr.c b/src/expr.c
index 01e151e83..685b599f4 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.422 2009/03/24 15:08:10 drh Exp $
+** $Id: expr.c,v 1.423 2009/03/24 15:31:28 drh Exp $
*/
#include "sqliteInt.h"
@@ -408,17 +408,19 @@ Expr *sqlite3Expr(
assert( pToken->dyn==0 );
pNew->span = *pToken;
- /* The pToken->z value is constant and must not change. But
- ** this expression might be passed to sqlite3DequoteExpr() which
+ /* The pToken->z value is read-only. But the new expression
+ ** node created here might be passed to sqlite3DequoteExpr() which
** will attempt to modify pNew->token.z. Hence, if the token
** is quoted, make a copy now so that DequoteExpr() will change
- ** the copy rather than the original (read-only) text.
+ ** the copy rather than the original text.
*/
if( pToken->n>=2
&& ((c = pToken->z[0])=='\'' || c=='"' || c=='[' || c=='`') ){
sqlite3TokenCopy(db, &pNew->token, pToken);
}else{
pNew->token = *pToken;
+ pNew->flags |= EP_Dequoted;
+ VVA_ONLY( pNew->vvaFlags |= EVVA_ReadOnlyToken; )
}
}else if( pLeft ){
if( pRight ){
@@ -660,6 +662,7 @@ void sqlite3ExprDelete(sqlite3 *db, Expr *p){
void sqlite3DequoteExpr(sqlite3 *db, Expr *p){
if( !ExprHasAnyProperty(p, EP_Dequoted) ){
ExprSetProperty(p, EP_Dequoted);
+ assert( (p->vvaFlags & EVVA_ReadOnlyToken)==0 );
sqlite3Dequote((char*)p->token.z);
}
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index bb79aaa7c..781040bbd 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.846 2009/03/24 15:08:10 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.847 2009/03/24 15:31:28 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@@ -1458,7 +1458,8 @@ struct AggInfo {
struct Expr {
u8 op; /* Operation performed by this node */
char affinity; /* The affinity of the column or 0 if not a column */
- u16 flags; /* Various flags. See below */
+ VVA_ONLY(u8 vvaFlags;) /* Flags used for VV&A only. EVVA_* below. */
+ u16 flags; /* Various flags. EP_* See below */
Token token; /* An operand token */
/* If the EP_TokenOnly flag is set in the Expr.flags mask, then no
@@ -1519,6 +1520,15 @@ struct Expr {
#define EP_SpanOnly 0x8000 /* Expr struct is EXPR_SPANONLYSIZE bytes only */
/*
+** The following are the meanings of bits in the Expr.vvaFlags field.
+** This information is only used when SQLite is compiled with
+** SQLITE_DEBUG defined.
+*/
+#ifndef NDEBUG
+#define EVVA_ReadOnlyToken 0x01 /* Expr.token.z is read-only */
+#endif
+
+/*
** These macros can be used to test, set, or clear bits in the
** Expr.flags field.
*/