summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-11-18 18:28:51 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-11-18 18:28:51 +0200
commit4b8926ac1dedd9977089c8b45ea62ea7ccbb69f9 (patch)
treea55869643222627555bb60ebc97809da07dc271c
parentfb40381b1928a5be18f113e0ba71b356ceaa5a77 (diff)
downloadmariadb-git-4b8926ac1dedd9977089c8b45ea62ea7ccbb69f9.tar.gz
lot's of fixes with test cases
mysql-test/r/create.result: A test case for foreign key bug that is resolved mysql-test/r/select_found.result: test case for new select ... limit 0 behaviour mysql-test/t/create.test: test case for foreign key bug that is fixed mysql-test/t/select_found.test: test case for new behaviour of SELECT ... LIMIT 0 sql/sql_select.cc: SELECT ... LIMIT 0 sql/sql_union.cc: replacing my dirty hack with Sanja's "proper" fix
-rw-r--r--mysql-test/r/create.result3
-rw-r--r--mysql-test/r/select_found.result4
-rw-r--r--mysql-test/t/create.test3
-rw-r--r--mysql-test/t/select_found.test2
-rw-r--r--sql/sql_select.cc7
-rw-r--r--sql/sql_union.cc1
6 files changed, 13 insertions, 7 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index cc1780a12d0..49a42872fa3 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -158,3 +158,6 @@ select * from t1;
if('2002'='2002','Y','N')
Y
drop table if exists t1;
+create table t1 (a int, key(a));
+create table t2 (b int, foreign key(b) references t1(a), key(b));
+drop table if exists t1,t2;
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 6fb9ea0ee0b..bbf0a8ba09f 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -173,9 +173,9 @@ SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
SELECT FOUND_ROWS();
FOUND_ROWS()
1
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
titre numeropost maxnumrep
SELECT FOUND_ROWS();
FOUND_ROWS()
-3
+2
drop table t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 65be9683061..3bad053875c 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -110,3 +110,6 @@ drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
drop table if exists t1;
+create table t1 (a int, key(a));
+create table t2 (b int, foreign key(b) references t1(a), key(b));
+drop table if exists t1,t2;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index c67c99924c3..c8458dd3aea 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -86,6 +86,6 @@ SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost I
SELECT FOUND_ROWS();
SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
SELECT FOUND_ROWS();
drop table t1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 9f9e2c67c2d..db3acfba909 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -324,6 +324,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
this->group= group_list != 0;
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
unit->select_limit_cnt);
+ do_send_rows = (row_limit) ? 1 : 0;
this->unit= unit;
#ifdef RESTRICTED_GROUP
@@ -664,7 +665,7 @@ JOIN::exec()
result->send_fields(fields_list,1);
if (!having || having->val_int())
{
- if (do_send_rows && unit->select_limit_cnt && result->send_data(fields_list))
+ if (do_send_rows && result->send_data(fields_list))
error= 1;
else
{
@@ -2611,8 +2612,8 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join->sum_funcs=0;
join->send_records=(ha_rows) 0;
join->group=0;
- join->do_send_rows = 1;
join->row_limit=join->unit->select_limit_cnt;
+ join->do_send_rows = (join->row_limit) ? 1 : 0;
join_tab->cache.buff=0; /* No cacheing */
join_tab->table=tmp_table;
@@ -5184,7 +5185,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
error=0;
if (join->procedure)
error=join->procedure->send_row(*join->fields);
- else if (join->do_send_rows && join->unit->select_limit_cnt)
+ else if (join->do_send_rows)
error=join->result->send_data(*join->fields);
if (error)
DBUG_RETURN(-1); /* purecov: inspected */
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index aeaae92f0c3..0e6de306c0d 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -86,7 +86,6 @@ bool select_union::send_data(List<Item> &values)
}
else
return 1;
- thd->net.report_error=0; // donno why does it work, but it does ...
}
return 0;
}