diff options
author | unknown <bell@sanja.is.com.ua> | 2004-02-08 20:57:14 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-02-08 20:57:14 +0200 |
commit | 89625e60215faabdb6007d102e47e2d9bef74349 (patch) | |
tree | 75c08bf3f555da5ff27b244e7fc44623412cf38f /tests | |
parent | 541cb675c87ae1efa1e1769abaed03e9535eaf27 (diff) | |
download | mariadb-git-89625e60215faabdb6007d102e47e2d9bef74349.tar.gz |
fixed cleupup() for distinct aggregate functions (BUG#2663)
sql/item_sum.cc:
fixed cleupup() for distinct aggregate functions
tests/client_test.c:
fixed subqueries test
test of distinct aggregate functions in PS
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index fbc9322b6b7..604514594dc 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -8117,6 +8117,7 @@ static void test_subqueries() myquery(rc); stmt= mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); for (i= 0; i < 3; i++) { rc= mysql_execute(stmt); @@ -8142,6 +8143,37 @@ static void test_bad_union() myerror(NULL); } +static void test_distinct() +{ + MYSQL_STMT *stmt; + int rc, i; + const char *query= "SELECT count(distinct b), group_concat(a) FROM t1"; + + myheader("test_subquery"); + + rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1"); + myquery(rc); + + rc= mysql_query(mysql,"CREATE TABLE t1 (a int , b int);"); + myquery(rc); + + rc= mysql_query(mysql, + "insert into t1 values (1,1), (2, 2), (3,3), (4,4), (5,5);"); + myquery(rc); + + for (i= 0; i < 3; i++) + { + stmt= mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + rc= mysql_execute(stmt); + mystmt(stmt, rc); + assert(1 == my_process_stmt_result(stmt)); + mysql_stmt_close(stmt); + } + + rc= mysql_query(mysql, "DROP TABLE t1"); + myquery(rc); +} /* Read and parse arguments and MySQL options from my.cnf @@ -8390,6 +8422,7 @@ int main(int argc, char **argv) prepared queries */ test_subqueries(); /* repeatable subqueries */ test_bad_union(); /* correct setup of UNION */ + test_distinct(); /* distinct aggregate functions */ end_time= time((time_t *)0); |