diff options
author | Mikael Ronstrom <mikael@mysql.com> | 2009-06-11 12:07:59 +0200 |
---|---|---|
committer | Mikael Ronstrom <mikael@mysql.com> | 2009-06-11 12:07:59 +0200 |
commit | a22c8c5be5ceadd23eed707ae2f1308ced2de977 (patch) | |
tree | 796cc97d1d103e18e0672d9b57dee4c54857073c /sql/sql_insert.cc | |
parent | 510835a0727fc1ebe98e2808cae91c8ab014d27e (diff) | |
parent | 585cf08fe6a8d6e237732daa94a969f93e5c84ec (diff) | |
download | mariadb-git-a22c8c5be5ceadd23eed707ae2f1308ced2de977.tar.gz |
Merge MySQL 5.1.35 into MySQL 5.4
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 322391b63e8..9eef9d224e6 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -904,20 +904,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, } DBUG_ASSERT(transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table); - - if (thd->lock) - { - /* - Invalidate the table in the query cache if something changed - after unlocking when changes become fisible. - TODO: this is workaround. right way will be move invalidating in - the unlock procedure. - */ - if (lock_type == TL_WRITE_CONCURRENT_INSERT && changed) - { - query_cache_invalidate3(thd, table_list, 1); - } - } } thd_proc_info(thd, "end"); /* @@ -1668,11 +1654,12 @@ public: ulong auto_increment_offset; timestamp_auto_set_type timestamp_field_type; LEX_STRING query; + Time_zone *time_zone; delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg, bool ignore_arg, bool log_query_arg) : record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg), - forced_insert_id(0), query(query_arg) + forced_insert_id(0), query(query_arg), time_zone(0) {} ~delayed_row() { @@ -1893,7 +1880,7 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) pthread_mutex_lock(&LOCK_thread_count); thread_count++; pthread_mutex_unlock(&LOCK_thread_count); - di->thd.set_db(table_list->db, strlen(table_list->db)); + di->thd.set_db(table_list->db, (uint) strlen(table_list->db)); di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME)); if (di->thd.db == NULL || di->thd.query == NULL) { @@ -2161,6 +2148,19 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, thd->first_successful_insert_id_in_prev_stmt; row->timestamp_field_type= table->timestamp_field_type; + /* Add session variable timezone + Time_zone object will not be freed even the thread is ended. + So we can get time_zone object from thread which handling delayed statement. + See the comment of my_tz_find() for detail. + */ + if (thd->time_zone_used) + { + row->time_zone = thd->variables.time_zone; + } + else + { + row->time_zone = NULL; + } /* Copy session variables. */ row->auto_increment_increment= thd->variables.auto_increment_increment; row->auto_increment_offset= thd->variables.auto_increment_offset; @@ -2659,6 +2659,14 @@ bool Delayed_insert::handle_inserts(void) if (log_query && mysql_bin_log.is_open()) { + bool backup_time_zone_used = thd.time_zone_used; + Time_zone *backup_time_zone = thd.variables.time_zone; + if (row->time_zone != NULL) + { + thd.time_zone_used = true; + thd.variables.time_zone = row->time_zone; + } + /* If the query has several rows to insert, only the first row will come here. In row-based binlogging, this means that the first row will be @@ -2670,6 +2678,9 @@ bool Delayed_insert::handle_inserts(void) thd.binlog_query(THD::ROW_QUERY_TYPE, row->query.str, row->query.length, FALSE, FALSE); + + thd.time_zone_used = backup_time_zone_used; + thd.variables.time_zone = backup_time_zone; } if (table->s->blob_fields) |