Commit 12e62a8e authored by unknown's avatar unknown

Optimize stack usage of ha_federated::update_row().


sql/ha_federated.cc:
  We only need one string buffer for fields in ::update_row()
parent f3c3c9c3
...@@ -1817,19 +1817,13 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) ...@@ -1817,19 +1817,13 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
/* /*
buffers for following strings buffers for following strings
*/ */
char old_field_value_buffer[STRING_BUFFER_USUAL_SIZE]; char field_value_buffer[STRING_BUFFER_USUAL_SIZE];
char new_field_value_buffer[STRING_BUFFER_USUAL_SIZE];
char update_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char update_buffer[FEDERATED_QUERY_BUFFER_SIZE];
char where_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char where_buffer[FEDERATED_QUERY_BUFFER_SIZE];
/* stores the value to be replaced of the field were are updating */ /* Work area for field values */
String old_field_value(old_field_value_buffer, String field_value(field_value_buffer, sizeof(field_value_buffer),
sizeof(old_field_value_buffer), &my_charset_bin);
&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);
/* stores the update query */ /* stores the update query */
String update_string(update_buffer, String update_string(update_buffer,
sizeof(update_buffer), sizeof(update_buffer),
...@@ -1842,8 +1836,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) ...@@ -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 set string lengths to 0 to avoid misc chars in string
*/ */
old_field_value.length(0); field_value.length(0);
new_field_value.length(0);
update_string.length(0); update_string.length(0);
where_string.length(0); where_string.length(0);
...@@ -1874,10 +1867,10 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) ...@@ -1874,10 +1867,10 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
else else
{ {
/* otherwise = */ /* otherwise = */
(*field)->val_str(&new_field_value); (*field)->val_str(&field_value);
(*field)->quote_data(&new_field_value); (*field)->quote_data(&field_value);
update_string.append(new_field_value); update_string.append(field_value);
new_field_value.length(0); field_value.length(0);
} }
if (field_in_record_is_null(table, *field, (char*) old_data)) 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) ...@@ -1885,11 +1878,11 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
else else
{ {
where_string.append(FEDERATED_EQ); where_string.append(FEDERATED_EQ);
(*field)->val_str(&old_field_value, (*field)->val_str(&field_value,
(char*) (old_data + (*field)->offset())); (char*) (old_data + (*field)->offset()));
(*field)->quote_data(&old_field_value); (*field)->quote_data(&field_value);
where_string.append(old_field_value); where_string.append(field_value);
old_field_value.length(0); field_value.length(0);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment