diff options
author | drh <drh@noemail.net> | 2002-07-11 12:18:16 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2002-07-11 12:18:16 +0000 |
commit | 5080aaa7ab8da17be7cec13d0708c29d24d92455 (patch) | |
tree | 68318fdcfd0bde96ceb1765178d7342241782d65 /src/select.c | |
parent | fa173a764a713e8ac9f9a6733c4612edfc904f28 (diff) | |
download | sqlite-5080aaa7ab8da17be7cec13d0708c29d24d92455.tar.gz sqlite-5080aaa7ab8da17be7cec13d0708c29d24d92455.zip |
Turn of the reporting of datatypes in the 4th callback argument unless the
SHOW_DATATYPES pragma is ON. Eliminate the NULL pointer that used to separate
the beginning of datatypes from the end of column names so that the callback
can test to see whether or not datatypes are provided. This is an
incompatible changes, but since the prior behavior was never documented, we
will let it in. (CVS 670)
FossilOrigin-Name: b98727246d5fcc1b097b577be498a77e954c5dc4
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/select.c b/src/select.c index 73c1f6a3d..61be40e9c 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.104 2002/07/10 21:26:01 drh Exp $ +** $Id: select.c,v 1.105 2002/07/11 12:18:17 drh Exp $ */ #include "sqliteInt.h" @@ -612,7 +612,11 @@ static void generateColumnNames( int i; if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; pParse->colNamesSet = 1; - sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr*2+1, 0); + if( pParse->db->flags & SQLITE_ReportTypes ){ + sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr*2, 0); + }else{ + sqliteVdbeAddOp(v, OP_ColumnCount, pEList->nExpr, 0); + } for(i=0; i<pEList->nExpr; i++){ Expr *p; char *zType = 0; @@ -672,15 +676,17 @@ static void generateColumnNames( sqliteVdbeAddOp(v, OP_ColumnName, i, 0); sqliteVdbeChangeP3(v, -1, zName, strlen(zName)); } - if( zType==0 ){ - if( sqliteExprType(p)==SQLITE_SO_TEXT ){ - zType = "TEXT"; - }else{ - zType = "NUMERIC"; + if( pParse->db->flags & SQLITE_ReportTypes ){ + if( zType==0 ){ + if( sqliteExprType(p)==SQLITE_SO_TEXT ){ + zType = "TEXT"; + }else{ + zType = "NUMERIC"; + } } + sqliteVdbeAddOp(v, OP_ColumnName, i + pEList->nExpr, 0); + sqliteVdbeChangeP3(v, -1, zType, P3_STATIC); } - sqliteVdbeAddOp(v, OP_ColumnName, i + pEList->nExpr + 1, 0); - sqliteVdbeChangeP3(v, -1, zType, P3_STATIC); } } |