diff options
author | unknown <msvensson@neptunus.(none)> | 2006-07-25 08:49:26 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-07-25 08:49:26 +0200 |
commit | 8e12b66bd047719b0d36f9352747b43c05ca6206 (patch) | |
tree | 499f93b3752f7ffbff3d0421a76293331747caf4 /sql | |
parent | 477e0b1345db67e634f9f12f07b72b1df8dc79d2 (diff) | |
parent | 3e2dfa97050e5d0246c5e5aa2915272c61030ded (diff) | |
download | mariadb-git-8e12b66bd047719b0d36f9352747b43c05ca6206.tar.gz |
Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
mysql-test/mysql-test-run.pl:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_federated.cc | 50 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 |
2 files changed, 23 insertions, 29 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index ea1100938d7..7fb5bf12016 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -1775,7 +1775,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) it. Keep in mind that the server can do updates based on ordering if an ORDER BY - clause was used. Consecutive ordering is not guarenteed. + clause was used. Consecutive ordering is not guaranteed. Currently new_data will not have an updated auto_increament record, or and updated timestamp field. You can do these for federated by doing these: if (table->timestamp_on_update_now) @@ -1801,22 +1801,16 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) this. */ bool has_a_primary_key= test(table->s->primary_key != MAX_KEY); - /* + /* 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), @@ -1826,11 +1820,10 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) sizeof(where_buffer), &my_charset_bin); DBUG_ENTER("ha_federated::update_row"); - /* + /* 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); @@ -1844,8 +1837,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 */ @@ -1854,21 +1847,22 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) { if (bitmap_is_set(table->write_set, (*field)->field_index)) { + update_string.append((*field)->field_name); + update_string.append(FEDERATED_EQ); + if ((*field)->is_null()) - new_field_value.append(FEDERATED_NULL); + update_string.append(FEDERATED_NULL); else { my_bitmap_map *old_map= tmp_use_all_columns(table, table->read_set); /* otherwise = */ - (*field)->val_str(&new_field_value); - (*field)->quote_data(&new_field_value); + (*field)->val_str(&field_value); + (*field)->quote_data(&field_value); + update_string.append(field_value); + field_value.length(0); tmp_restore_column_map(table->read_set, old_map); } - update_string.append((*field)->field_name); - update_string.append(FEDERATED_EQ); - update_string.append(new_field_value); update_string.append(FEDERATED_COMMA); - new_field_value.length(0); } if (bitmap_is_set(table->read_set, (*field)->field_index)) @@ -1879,11 +1873,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); } where_string.append(FEDERATED_AND); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c9c12b154c4..9a3f43c7f05 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -3318,7 +3318,7 @@ longlong Item_func_regex::val_int() } } null_value=0; - return my_regexec(&preg,res->c_ptr(),0,(my_regmatch_t*) 0,0) ? 0 : 1; + return my_regexec(&preg,res->c_ptr_safe(),0,(my_regmatch_t*) 0,0) ? 0 : 1; } |