diff options
author | unknown <bell@sanja.is.com.ua> | 2004-02-08 20:14:13 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-02-08 20:14:13 +0200 |
commit | 541cb675c87ae1efa1e1769abaed03e9535eaf27 (patch) | |
tree | 14b2b58964802549177419493c886e1dd62be7e3 /tests | |
parent | 715e7a63a6f9a1b278c03f13b4580194161b2ed4 (diff) | |
download | mariadb-git-541cb675c87ae1efa1e1769abaed03e9535eaf27.tar.gz |
fixed subquery with PS (BUG#2462)
fixed UNION preparation
sql/item.cc:
debug output added
sql/item.h:
debug output added
sql/item_cmpfunc.cc:
correct cleunup() for Item_in_optimizer
sql/item_cmpfunc.h:
correct cleunup() for Item_in_optimizer
debug output added
sql/item_func.h:
debug output added
sql/item_subselect.cc:
support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup()
sql/item_subselect.h:
support of prepared statemnts added - mostly memorry allocation manegement, only one trabsformatio & correct cleupup()
sql/item_sum.cc:
debug output added
sql/item_sum.h:
debug output added
sql/sql_class.cc:
function to switch allocation arena for Items
sql/sql_class.h:
function to switch allocation arena for Items
pointer on current prepared statement added
sql/sql_lex.cc:
comment fixed
sql/sql_lex.h:
item cleanup support
sql/sql_prepare.cc:
- fixed preparation of PS to avoid storing junk in its memory + correct work with union
- fixed tables cleanup for UNION & subqueries
sql/sql_select.cc:
removed condition which is always true for now
fixed layout
sql/sql_union.cc:
support of UNION subquery cleanup
tests/client_test.c:
test of repeatable subqueries
test of correct UNION initialisation
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 66637dcb04b..fbc9322b6b7 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -8095,6 +8095,53 @@ static void test_bug1946() rc= mysql_query(mysql,"DROP TABLE prepare_command"); } +static void test_subqueries() +{ + MYSQL_STMT *stmt; + int rc, i; + const char *query= "SELECT (SELECT SUM(a+b) FROM t2 where t1.b=t2.b GROUP BY t1.a LIMIT 1) as scalar_s, exists (select 1 from t2 where t2.a/2=t1.a) as exists_s, a in (select a+3 from t2) as in_s, (a-1,b-1) in (select a,b from t2) as in_row_s FROM t1"; + + myheader("test_subquery"); + + rc = mysql_query(mysql, "DROP TABLE IF EXISTS t1,t2"); + 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); + + rc= mysql_query(mysql,"create table t2 select * from t1;"); + myquery(rc); + + stmt= mysql_prepare(mysql, query, strlen(query)); + for (i= 0; i < 3; i++) + { + rc= mysql_execute(stmt); + mystmt(stmt, rc); + assert(5 == my_process_stmt_result(stmt)); + } + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP TABLE t1,t2"); + myquery(rc); +} + + +static void test_bad_union() +{ + MYSQL_STMT *stmt; + const char *query= "SELECT 1, 2 union SELECT 1"; + + myheader("test_bad_union"); + + stmt= mysql_prepare(mysql, query, strlen(query)); + assert(stmt == 0); + myerror(NULL); +} + /* Read and parse arguments and MySQL options from my.cnf @@ -8234,6 +8281,7 @@ int main(int argc, char **argv) test_count= 1; start_time= time((time_t *)0); + client_query(); /* simple client query test */ #if NOT_YET_WORKING /* Used for internal new development debugging */ @@ -8340,6 +8388,9 @@ int main(int argc, char **argv) test_bug1644(); /* BUG#1644 */ test_bug1946(); /* test that placeholders are allowed only in prepared queries */ + test_subqueries(); /* repeatable subqueries */ + test_bad_union(); /* correct setup of UNION */ + end_time= time((time_t *)0); total_time+= difftime(end_time, start_time); |