From 63b2e8d9dfab1cb2ed0b8f1c1fce267512cf5493 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/ramil.myoffice.izhnet.ru" <> Date: Fri, 18 May 2007 12:08:07 +0500 Subject: Fix for bug #28464: a string argument to 'limit ?' PS - replication fails Problem: we may get syntactically incorrect queries in the binary log if we use a string value user variable executing a PS which contains '... limit ?' clause, e.g. prepare s from "select 1 limit ?"; set @a='qwe'; execute s using @a; Fix: raise an error in such cases. --- sql/item.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/item.cc') diff --git a/sql/item.cc b/sql/item.cc index 827c872adbc..155b2a962c8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2312,6 +2312,7 @@ default_set_param_func(Item_param *param, Item_param::Item_param(unsigned pos_in_query_arg) : + strict_type(FALSE), state(NO_VALUE), item_result_type(STRING_RESULT), /* Don't pretend to be a literal unless value for this item is set. */ @@ -2506,6 +2507,8 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) if (entry && entry->value) { item_result_type= entry->type; + if (strict_type && required_result_type != item_result_type) + DBUG_RETURN(1); switch (entry->type) { case REAL_RESULT: set_double(*(double*)entry->value); -- cgit v1.2.1