Return the correct declared column type, origin column name, origin database

name, etc. from aggregate queries.  Ticket #1726 and #1755. (CVS 3169)

FossilOrigin-Name: e64809f0ae98ce9d152cf030cae72bf3df3e2403
This commit is contained in:
drh 2006-04-07 13:50:37 +00:00
parent 502b962b2d
commit 30bcf5dbaf
4 changed files with 24 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Avoid\sthe\suse\sof\satof().\s\sTicket\s#1756.\s(CVS\s3168)
D 2006-04-07T13:26:43
C Return\sthe\scorrect\sdeclared\scolumn\stype,\sorigin\scolumn\sname,\sorigin\sdatabase\nname,\setc.\sfrom\saggregate\squeries.\s\sTicket\s#1726\sand\s#1755.\s(CVS\s3169)
D 2006-04-07T13:50:37
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -66,7 +66,7 @@ F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55
F src/prepare.c 6afd730cc8851c0920b5f9050294646b1c2ab28c
F src/printf.c 358b4b585270f92a228e646e7bbb261c65f2a166
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c ca8ee9b54a52e31c22c23ae5264d323f723d253b
F src/select.c 3519dc645855e6ef73cab273e275e46a6b788980
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 5cce3dabcad1f61fa80f8cbcd29bcb5776bda585
F src/sqlite.h.in e783b895fe2fcd68f6c04408a4efaef58cd1cdda
@ -133,7 +133,7 @@ F test/btree7.test a6d3b842db22af97dd14b989e90a2fd96066b72f
F test/btree8.test fadc112bcbd6a0c622d34c813fc8a648eacf8804
F test/busy.test 0271c854738e23ad76e10d4096a698e5af29d211
F test/capi2.test cddd151c7b687e9e00fde408b9547ec93c2146a4
F test/capi3.test 6553fb89a4d6918e42b5f953c1d880bacb6917fe
F test/capi3.test 0d26e0ef558e3d409258f69dc74ca72f6a7aa76e
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/cast.test f88e7b6946e9a467cf4bb142d92bb65a83747fc2
F test/check.test 46c658566c2501faa3f91b941654119703da1f83
@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P a091a61d8832ad3454231f480ec605101bb9363a
R 8c9f22be40030bbe9c513fbb881bef66
P 76aef93c3e113b0077f534a437a339be2b15ca3d
R b895140886bedf91189ddd9cc3a44c7a
U drh
Z 7c78d77240a187b159e2aaf4cfe8a780
Z 406bc64563c9f79b54905625fb460237

View File

@ -1 +1 @@
76aef93c3e113b0077f534a437a339be2b15ca3d
e64809f0ae98ce9d152cf030cae72bf3df3e2403

View File

@ -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.310 2006/03/26 01:21:23 drh Exp $
** $Id: select.c,v 1.311 2006/04/07 13:50:37 drh Exp $
*/
#include "sqliteInt.h"
@ -805,6 +805,7 @@ static const char *columnType(
assert( pExpr->op!=TK_AS );
switch( pExpr->op ){
case TK_AGG_COLUMN:
case TK_COLUMN: {
/* The expression is a column. Locate the table the column is being
** extracted from in NameContext.pSrcList. This table may be real

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi3.test,v 1.44 2006/02/18 16:36:46 drh Exp $
# $Id: capi3.test,v 1.45 2006/04/07 13:50:38 drh Exp $
#
set testdir [file dirname $argv0]
@ -575,6 +575,19 @@ do_test capi3-5.12 {
sqlite3_finalize $STMT
} SQLITE_OK
do_test capi3-5.20 {
set sql "SELECT a, sum(b), max(c) FROM t1 GROUP BY a"
set STMT [sqlite3_prepare $DB $sql -1 TAIL]
sqlite3_column_count $STMT
} 3
check_header $STMT capi3-5.21 {a sum(b) max(c)} {VARINT {} {}}
check_origin_header $STMT capi3-5.22 {main {} {}} {t1 {} {}} {a {} {}}
do_test capi3-5.23 {
sqlite3_finalize $STMT
} SQLITE_OK
set ::ENC [execsql {pragma encoding}]
db close