summaryrefslogtreecommitdiff
path: root/sql/ha_federated.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2006-06-28 12:26:21 -0700
committerunknown <jimw@mysql.com>2006-06-28 12:26:21 -0700
commit01d3a61fefdce51ae946b10359b8c1c39b90d8e5 (patch)
treee0a56f22164103a72115793083e5997fac5daa1c /sql/ha_federated.cc
parent23474afb8d061e70081f7c221d8b9a7152d1e7f8 (diff)
parent12e62a8e89c2c37268e7a0d845fa4029c7dd3e40 (diff)
downloadmariadb-git-01d3a61fefdce51ae946b10359b8c1c39b90d8e5.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-engines
into mysql.com:/home/jimw/my/mysql-5.0-16494 sql/ha_federated.cc: Auto merged mysql-test/r/federated.result: Resolve conflict mysql-test/t/federated.test: Resolve conflict
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r--sql/ha_federated.cc44
1 files changed, 17 insertions, 27 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 11f676d9cf6..e2988df1619 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -1810,19 +1810,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),
@@ -1835,8 +1829,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);
@@ -1850,8 +1843,8 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
In this loop, we want to match column names to values being inserted
(while building INSERT statement).
- Iterate through table->field (new data) and share->old_filed (old_data)
- using the same index to created an SQL UPDATE statement, new data is
+ Iterate through table->field (new data) and share->old_field (old_data)
+ using the same index to create an SQL UPDATE statement. New data is
used to create SET field=value and old data is used to create WHERE
field=oldvalue
*/
@@ -1863,30 +1856,28 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
update_string.append(FEDERATED_EQ);
if ((*field)->is_null())
- new_field_value.append(FEDERATED_NULL);
+ update_string.append(FEDERATED_NULL);
else
{
/* otherwise = */
- (*field)->val_str(&new_field_value);
- (*field)->quote_data(&new_field_value);
-
- if (!field_in_record_is_null(table, *field, (char*) old_data))
- where_string.append(FEDERATED_EQ);
+ (*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))
where_string.append(FEDERATED_ISNULL);
else
{
- (*field)->val_str(&old_field_value,
+ where_string.append(FEDERATED_EQ);
+ (*field)->val_str(&field_value,
(char*) (old_data + (*field)->offset()));
- (*field)->quote_data(&old_field_value);
- where_string.append(old_field_value);
+ (*field)->quote_data(&field_value);
+ where_string.append(field_value);
+ field_value.length(0);
}
- update_string.append(new_field_value);
- new_field_value.length(0);
-
/*
Only append conjunctions if we have another field in which
to iterate
@@ -1896,7 +1887,6 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
update_string.append(FEDERATED_COMMA);
where_string.append(FEDERATED_AND);
}
- old_field_value.length(0);
}
update_string.append(FEDERATED_WHERE);
update_string.append(where_string);