diff --git a/dbcon/mysql/ha_mcs.cpp b/dbcon/mysql/ha_mcs.cpp index 86c556733..2cdabd2ec 100644 --- a/dbcon/mysql/ha_mcs.cpp +++ b/dbcon/mysql/ha_mcs.cpp @@ -1219,6 +1219,8 @@ my_bool get_status_and_flush_cache(void *param, int error; enum_sql_command sql_command= cache->table->in_use->lex->sql_command; + cache->sql_command= sql_command; + cache->insert_command= (sql_command == SQLCOM_INSERT || sql_command == SQLCOM_LOAD); /* @@ -1781,7 +1783,16 @@ void ha_mcs_cache::start_bulk_insert(ha_rows rows, uint flags) bzero(&cache_handler->copy_info, sizeof(cache_handler->copy_info)); return cache_handler->start_bulk_insert(rows, flags); } - return parent::start_bulk_insert(rows, flags); + else if (sql_command == SQLCOM_INSERT_SELECT) + { + return parent::start_bulk_insert_from_cache(rows, flags); + } + // sql_command == SQLCOM_END: + // See the comment in get_status_and_flush_cache + else + { + return parent::start_bulk_insert(rows, flags); + } } else { diff --git a/dbcon/mysql/ha_mcs.h b/dbcon/mysql/ha_mcs.h index 949bda4b9..e3e7a779c 100644 --- a/dbcon/mysql/ha_mcs.h +++ b/dbcon/mysql/ha_mcs.h @@ -285,6 +285,7 @@ class ha_mcs_cache :public ha_mcs typedef ha_mcs parent; int original_lock_type; bool insert_command, cache_locked; + enum_sql_command sql_command; // True if this handler belongs to either calpontsys.systable or // calpontsys.syscolumn system catalog tables