Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2084 06/01/26 16:36:33 konstantin@stripped +4 -0
Merge mysql.com:/opt/local/work/mysql-5.0-for-merge
into mysql.com:/opt/local/work/mysql-5.1-merge1
sql/sql_select.cc
1.383 06/01/26 16:36:23 konstantin@stripped +0 -0
Auto merged
sql/item_cmpfunc.cc
1.190 06/01/26 16:36:22 konstantin@stripped +0 -0
Auto merged
mysql-test/t/ps.test
1.58 06/01/26 16:36:22 konstantin@stripped +0 -0
Auto merged
mysql-test/r/ps.result
1.59 06/01/26 16:36:22 konstantin@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: konstantin
# Host: dragonfly.local
# Root: /opt/local/work/mysql-5.1-merge1/RESYNC
--- 1.189/sql/item_cmpfunc.cc 2006-01-16 16:26:26 +03:00
+++ 1.190/sql/item_cmpfunc.cc 2006-01-26 16:36:22 +03:00
@@ -3059,6 +3059,12 @@
return FALSE;
}
+void Item_func_like::cleanup()
+{
+ canDoTurboBM= FALSE;
+ Item_bool_func2::cleanup();
+}
+
#ifdef USE_REGEX
bool
--- 1.382/sql/sql_select.cc 2006-01-18 13:56:19 +03:00
+++ 1.383/sql/sql_select.cc 2006-01-26 16:36:23 +03:00
@@ -2961,6 +2961,56 @@
/*
+ Add to KEY_FIELD array all 'ref' access candidates within nested join
+
+ SYNPOSIS
+ add_key_fields_for_nj()
+ nested_join_table IN Nested join pseudo-table to process
+ end INOUT End of the key field array
+ and_level INOUT And-level
+
+ DESCRIPTION
+ This function populates KEY_FIELD array with entries generated from the
+ ON condition of the given nested join, and does the same for nested joins
+ contained within this nested join.
+
+ NOTES
+ We can add accesses to the tables that are direct children of this nested
+ join (1), and are not inner tables w.r.t their neighbours (2).
+
+ Example for #1 (outer brackets pair denotes nested join this function is
+ invoked for):
+ ... LEFT JOIN (t1 LEFT JOIN (t2 ... ) ) ON cond
+ Example for #2:
+ ... LEFT JOIN (t1 LEFT JOIN t2 ) ON cond
+ In examples 1-2 for condition cond, we can add 'ref' access candidates to
+ t1 only.
+ Example #3:
+ ... LEFT JOIN (t1, t2 LEFT JOIN t3 ON inner_cond) ON cond
+ Here we can add 'ref' access candidates for t1 and t2, but not for t3.
+*/
+
+static void add_key_fields_for_nj(TABLE_LIST *nested_join_table,
+ KEY_FIELD **end, uint *and_level)
+{
+ List_iterator<TABLE_LIST> li(nested_join_table->nested_join->join_list);
+ table_map tables= 0;
+ TABLE_LIST *table;
+ DBUG_ASSERT(nested_join_table->nested_join);
+
+ while ((table= li++))
+ {
+ if (table->nested_join)
+ add_key_fields_for_nj(table, end, and_level);
+ else
+ if (!table->on_expr)
+ tables |= table->table->map;
+ }
+ add_key_fields(end, and_level, nested_join_table->on_expr, tables);
+}
+
+
+/*
Update keyuse array with all possible keys we can use to fetch rows
SYNOPSIS
@@ -3024,23 +3074,21 @@
into account as well.
*/
if (*join_tab[i].on_expr_ref)
- {
add_key_fields(&end,&and_level,*join_tab[i].on_expr_ref,
join_tab[i].table->map);
- }
- else
+ }
+
+ /* Process ON conditions for the nested joins */
+ {
+ List_iterator<TABLE_LIST> li(*join_tab->join->join_list);
+ TABLE_LIST *table;
+ while ((table= li++))
{
- TABLE_LIST *tab= join_tab[i].table->pos_in_table_list;
- TABLE_LIST *embedding= tab->embedding;
- if (embedding)
- {
- NESTED_JOIN *nested_join= embedding->nested_join;
- if (nested_join->join_list.head() == tab)
- add_key_fields(&end, &and_level, embedding->on_expr,
- nested_join->used_tables);
- }
+ if (table->nested_join)
+ add_key_fields_for_nj(table, &end, &and_level);
}
}
+
/* fill keyuse with found key parts */
for ( ; field != end ; field++)
add_key_part(keyuse,field);
--- 1.58/mysql-test/r/ps.result 2006-01-10 21:50:16 +03:00
+++ 1.59/mysql-test/r/ps.result 2006-01-26 16:36:22 +03:00
@@ -825,6 +825,40 @@
drop table t1;
set names default;
deallocate prepare stmt;
+create table t1 (
+word_id mediumint(8) unsigned not null default '0',
+formatted varchar(20) not null default ''
+);
+insert into t1 values
+(80,'pendant'), (475,'pretendants'), (989,'tendances'),
+(1019,'cependant'),(1022,'abondance'),(1205,'independants'),
+(13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),
+(82,'decrocher');
+select count(*) from t1 where formatted like '%NDAN%';
+count(*)
+6
+select count(*) from t1 where formatted like '%ER';
+count(*)
+5
+prepare stmt from "select count(*) from t1 where formatted like ?";
+set @like="%NDAN%";
+execute stmt using @like;
+count(*)
+6
+set @like="%ER";
+execute stmt using @like;
+count(*)
+5
+set @like="%NDAN%";
+execute stmt using @like;
+count(*)
+6
+set @like="%ER";
+execute stmt using @like;
+count(*)
+5
+deallocate prepare stmt;
+drop table t1;
create table t1 (id int);
prepare ins_call from "insert into t1 (id) values (1)";
execute ins_call;
--- 1.57/mysql-test/t/ps.test 2005-12-26 10:16:29 +03:00
+++ 1.58/mysql-test/t/ps.test 2006-01-26 16:36:22 +03:00
@@ -870,6 +870,36 @@
set names default;
deallocate prepare stmt;
+#
+# A test case for Bug#12734 "prepared statement may return incorrect result
+# set for a select SQL request": test that canDoTurboBM is reset for each
+# execute of a prepared statement.
+#
+create table t1 (
+ word_id mediumint(8) unsigned not null default '0',
+ formatted varchar(20) not null default ''
+);
+
+insert into t1 values
+ (80,'pendant'), (475,'pretendants'), (989,'tendances'),
+ (1019,'cependant'),(1022,'abondance'),(1205,'independants'),
+ (13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),
+ (82,'decrocher');
+
+select count(*) from t1 where formatted like '%NDAN%';
+select count(*) from t1 where formatted like '%ER';
+prepare stmt from "select count(*) from t1 where formatted like ?";
+set @like="%NDAN%";
+execute stmt using @like;
+set @like="%ER";
+execute stmt using @like;
+set @like="%NDAN%";
+execute stmt using @like;
+set @like="%ER";
+execute stmt using @like;
+deallocate prepare stmt;
+drop table t1;
+
# End of 4.1 tests
#
| Thread |
|---|
| • bk commit into 5.1 tree (konstantin:1.2084) | konstantin | 26 Jan |