List:Commits« Previous MessageNext Message »
From:konstantin Date:January 14 2006 1:55am
Subject:bk commit into 4.1 tree (konstantin:1.2481) BUG#12734
View as plain text  
Below is the list of changes that have just been committed into a local
4.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.2481 06/01/14 04:55:07 konstantin@stripped +4 -0
  A fix and a test case for Bug#12734 " prepared statement may 
  return incorrect result set for a select SQL request"

  sql/item_cmpfunc.h
    1.113 06/01/14 04:55:01 konstantin@stripped +1 -0
    Add Item_func_like::cleanup()

  sql/item_cmpfunc.cc
    1.205 06/01/14 04:55:01 konstantin@stripped +6 -0
    Reset canDoTurboBM in Item_func_like::cleanup()

  mysql-test/t/ps.test
    1.45 06/01/14 04:55:00 konstantin@stripped +30 -0
    A test case for Bug#12734

  mysql-test/r/ps.result
    1.44 06/01/14 04:55:00 konstantin@stripped +34 -0
    Test results fixed (Bug#12734)

# 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-4.1-12734

--- 1.204/sql/item_cmpfunc.cc	2006-01-08 20:07:47 +03:00
+++ 1.205/sql/item_cmpfunc.cc	2006-01-14 04:55:01 +03:00
@@ -2524,6 +2524,12 @@
   return 0;
 }
 
+void Item_func_like::cleanup()
+{
+  canDoTurboBM= FALSE;
+  Item_bool_func2::cleanup();
+}
+
 #ifdef USE_REGEX
 
 bool

--- 1.112/sql/item_cmpfunc.h	2005-09-29 04:07:36 +04:00
+++ 1.113/sql/item_cmpfunc.h	2006-01-14 04:55:01 +03:00
@@ -911,6 +911,7 @@
   cond_result eq_cmp_result() const { return COND_TRUE; }
   const char *func_name() const { return "like"; }
   bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
+  void cleanup();
 };
 
 #ifdef USE_REGEX

--- 1.43/mysql-test/r/ps.result	2005-11-25 13:25:25 +03:00
+++ 1.44/mysql-test/r/ps.result	2006-01-14 04:55:00 +03:00
@@ -718,3 +718,37 @@
 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;

--- 1.44/mysql-test/t/ps.test	2005-11-25 13:25:25 +03:00
+++ 1.45/mysql-test/t/ps.test	2006-01-14 04:55:00 +03:00
@@ -746,5 +746,35 @@
 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 4.1 tree (konstantin:1.2481) BUG#12734konstantin14 Jan