summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-05-24 15:42:46 +0500
committerunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-05-24 15:42:46 +0500
commitf4958aa30d23e861c6c6580bed744f1dbb64924b (patch)
tree19eb3f1b85862dcd28feee3d2eea957d0e84f791 /sql/sql_prepare.cc
parent0197ee1d719fcab4e75d2bd929c8656699ce5a42 (diff)
parent3791e35f79e640f7bd2e20c895692ed1ec81e720 (diff)
downloadmariadb-git-f4958aa30d23e861c6c6580bed744f1dbb64924b.tar.gz
Merge mysql.com:/home/ram/work/b26842/b26842.5.0
into mysql.com:/home/ram/work/b26842/b26842.5.1 sql/sql_prepare.cc: Auto merged
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc37
1 files changed, 12 insertions, 25 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 21d0308a830..1276e23208c 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -981,6 +981,7 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
String buf;
const String *val;
uint32 length= 0;
+ THD *thd= stmt->thd;
DBUG_ENTER("insert_params_from_vars");
@@ -991,34 +992,20 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
{
Item_param *param= *it;
varname= var_it++;
- if (get_var_with_binlog(stmt->thd, stmt->lex->sql_command,
- *varname, &entry))
- DBUG_RETURN(1);
- if (param->set_from_user_var(stmt->thd, entry))
+ entry= (user_var_entry *) hash_search(&thd->user_vars, (byte*) varname->str,
+ varname->length);
+ /*
+ We have to call the setup_one_conversion_function() here to set
+ the parameter's members that might be needed further
+ (e.g. value.cs_info.character_set_client is used in the query_val_str()).
+ */
+ setup_one_conversion_function(thd, param, param->param_type);
+ if (param->set_from_user_var(thd, entry))
DBUG_RETURN(1);
- /* Insert @'escaped-varname' instead of parameter in the query */
- if (entry)
- {
- char *start, *ptr;
- buf.length(0);
- if (buf.reserve(entry->name.length*2+3))
- DBUG_RETURN(1);
+ val= param->query_val_str(&buf);
- start= ptr= buf.c_ptr_quick();
- *ptr++= '@';
- *ptr++= '\'';
- ptr+= escape_string_for_mysql(&my_charset_utf8_general_ci,
- ptr, 0, entry->name.str,
- entry->name.length);
- *ptr++= '\'';
- buf.length(ptr - start);
- val= &buf;
- }
- else
- val= &my_null_string;
-
- if (param->convert_str_value(stmt->thd))
+ if (param->convert_str_value(thd))
DBUG_RETURN(1); /* out of memory */
if (query->replace(param->pos_in_query+length, 1, *val))