summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorunknown <gluh@eagle.(none)>2007-11-14 17:30:16 +0400
committerunknown <gluh@eagle.(none)>2007-11-14 17:30:16 +0400
commit711cf7503dcb4bf5290a0d71c83dc6ff9fd3b4fe (patch)
tree4676d6947f9f56056b0b29957c90cba5cdad5eba /sql/ha_partition.cc
parentb3a71e34487b69846553111448fa2b32c86176a9 (diff)
parentc670190e8606f84a71f347184b2cf3df2fa9b925 (diff)
downloadmariadb-git-711cf7503dcb4bf5290a0d71c83dc6ff9fd3b4fe.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union mysql-test/r/events_bugs.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/partition.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged sql/field.cc: Auto merged sql/ha_partition.cc: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/share/errmsg.txt: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/select.result: manual merge mysql-test/t/select.test: manual merge
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc28
1 files changed, 22 insertions, 6 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index b53a5e3da97..1400d9da753 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2794,16 +2794,28 @@ exit:
int ha_partition::update_row(const uchar *old_data, uchar *new_data)
{
uint32 new_part_id, old_part_id;
- int error;
+ int error= 0;
longlong func_value;
+ timestamp_auto_set_type orig_timestamp_type= table->timestamp_field_type;
DBUG_ENTER("ha_partition::update_row");
+ /*
+ We need to set timestamp field once before we calculate
+ the partition. Then we disable timestamp calculations
+ inside m_file[*]->update_row() methods
+ */
+ if (orig_timestamp_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
+ {
+ table->timestamp_field->set_time();
+ table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
+ }
+
if ((error= get_parts_for_update(old_data, new_data, table->record[0],
m_part_info, &old_part_id, &new_part_id,
&func_value)))
{
m_part_info->err_value= func_value;
- DBUG_RETURN(error);
+ goto exit;
}
/*
@@ -2815,23 +2827,27 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
if (new_part_id == old_part_id)
{
DBUG_PRINT("info", ("Update in partition %d", new_part_id));
- DBUG_RETURN(m_file[new_part_id]->update_row(old_data, new_data));
+ error= m_file[new_part_id]->update_row(old_data, new_data);
+ goto exit;
}
else
{
DBUG_PRINT("info", ("Update from partition %d to partition %d",
old_part_id, new_part_id));
if ((error= m_file[new_part_id]->write_row(new_data)))
- DBUG_RETURN(error);
+ goto exit;
if ((error= m_file[old_part_id]->delete_row(old_data)))
{
#ifdef IN_THE_FUTURE
(void) m_file[new_part_id]->delete_last_inserted_row(new_data);
#endif
- DBUG_RETURN(error);
+ goto exit;
}
}
- DBUG_RETURN(0);
+
+exit:
+ table->timestamp_field_type= orig_timestamp_type;
+ DBUG_RETURN(error);
}