mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Optimize stack usage of ha_federated::update_row().
This commit is contained in:
parent
a1c2dc5e6f
commit
46dcf66114
1 changed files with 13 additions and 20 deletions
|
@ -1817,19 +1817,13 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
|
|||
/*
|
||||
buffers for following strings
|
||||
*/
|
||||
char old_field_value_buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
char new_field_value_buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
char field_value_buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
char update_buffer[FEDERATED_QUERY_BUFFER_SIZE];
|
||||
char where_buffer[FEDERATED_QUERY_BUFFER_SIZE];
|
||||
|
||||
/* stores the value to be replaced of the field were are updating */
|
||||
String old_field_value(old_field_value_buffer,
|
||||
sizeof(old_field_value_buffer),
|
||||
&my_charset_bin);
|
||||
/* stores the new value of the field */
|
||||
String new_field_value(new_field_value_buffer,
|
||||
sizeof(new_field_value_buffer),
|
||||
&my_charset_bin);
|
||||
/* Work area for field values */
|
||||
String field_value(field_value_buffer, sizeof(field_value_buffer),
|
||||
&my_charset_bin);
|
||||
/* stores the update query */
|
||||
String update_string(update_buffer,
|
||||
sizeof(update_buffer),
|
||||
|
@ -1842,8 +1836,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
|
|||
/*
|
||||
set string lengths to 0 to avoid misc chars in string
|
||||
*/
|
||||
old_field_value.length(0);
|
||||
new_field_value.length(0);
|
||||
field_value.length(0);
|
||||
update_string.length(0);
|
||||
where_string.length(0);
|
||||
|
||||
|
@ -1874,10 +1867,10 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
|
|||
else
|
||||
{
|
||||
/* otherwise = */
|
||||
(*field)->val_str(&new_field_value);
|
||||
(*field)->quote_data(&new_field_value);
|
||||
update_string.append(new_field_value);
|
||||
new_field_value.length(0);
|
||||
(*field)->val_str(&field_value);
|
||||
(*field)->quote_data(&field_value);
|
||||
update_string.append(field_value);
|
||||
field_value.length(0);
|
||||
}
|
||||
|
||||
if (field_in_record_is_null(table, *field, (char*) old_data))
|
||||
|
@ -1885,11 +1878,11 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
|
|||
else
|
||||
{
|
||||
where_string.append(FEDERATED_EQ);
|
||||
(*field)->val_str(&old_field_value,
|
||||
(*field)->val_str(&field_value,
|
||||
(char*) (old_data + (*field)->offset()));
|
||||
(*field)->quote_data(&old_field_value);
|
||||
where_string.append(old_field_value);
|
||||
old_field_value.length(0);
|
||||
(*field)->quote_data(&field_value);
|
||||
where_string.append(field_value);
|
||||
field_value.length(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue