mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Prepared_statement deployed instead of PREP_STMT.
This commit is contained in:
@ -743,90 +743,3 @@ bool Protocol::convert_str(const char *from, uint length)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool setup_params_data(st_prep_stmt *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
Item_param *param;
|
||||
ulong param_no= 0;
|
||||
MYSQL_BIND *client_param= thd->client_params;
|
||||
|
||||
DBUG_ENTER("setup_params_data");
|
||||
|
||||
for (;(param= (Item_param *)param_iterator++); client_param++)
|
||||
{
|
||||
setup_param_functions(param, client_param->buffer_type);
|
||||
if (!param->long_data_supplied)
|
||||
{
|
||||
if (*client_param->is_null)
|
||||
param->maybe_null= param->null_value= 1;
|
||||
else
|
||||
{
|
||||
uchar *buff= (uchar*)client_param->buffer;
|
||||
param->maybe_null= param->null_value= 0;
|
||||
param->setup_param_func(param,&buff,
|
||||
client_param->length ?
|
||||
*client_param->length :
|
||||
client_param->buffer_length);
|
||||
}
|
||||
}
|
||||
param_no++;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
bool setup_params_data_withlog(st_prep_stmt *stmt)
|
||||
{
|
||||
THD *thd= stmt->thd;
|
||||
List<Item> ¶ms= thd->lex->param_list;
|
||||
List_iterator<Item> param_iterator(params);
|
||||
Item_param *param;
|
||||
MYSQL_BIND *client_param= thd->client_params;
|
||||
|
||||
DBUG_ENTER("setup_params_data");
|
||||
|
||||
String str, *res, *query= new String(stmt->query->alloced_length());
|
||||
query->copy(*stmt->query);
|
||||
|
||||
ulong param_no= 0;
|
||||
uint32 length= 0;
|
||||
|
||||
for (;(param= (Item_param *)param_iterator++); client_param++)
|
||||
{
|
||||
setup_param_functions(param, client_param->buffer_type);
|
||||
if (param->long_data_supplied)
|
||||
res= param->query_val_str(&str);
|
||||
|
||||
else
|
||||
{
|
||||
if (*client_param->is_null)
|
||||
{
|
||||
param->maybe_null= param->null_value= 1;
|
||||
res= &my_null_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
uchar *buff= (uchar*)client_param->buffer;
|
||||
param->maybe_null= param->null_value= 0;
|
||||
param->setup_param_func(param,&buff,
|
||||
client_param->length ?
|
||||
*client_param->length :
|
||||
client_param->buffer_length);
|
||||
res= param->query_val_str(&str);
|
||||
}
|
||||
}
|
||||
if (query->replace(param->pos_in_query+length, 1, *res))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
length+= res->length()-1;
|
||||
param_no++;
|
||||
}
|
||||
|
||||
if (alloc_query(stmt->thd, (char *)query->ptr(), query->length()+1))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
query->free();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user