summaryrefslogtreecommitdiff
path: root/sql/ha_federated.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_federated.cc')
-rw-r--r--sql/ha_federated.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 3cf9c2a8b99..b669be78ebb 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -1811,8 +1811,13 @@ int ha_federated::write_row(byte *buf)
field, then store the last_insert_id() value from the foreign server
*/
if (auto_increment_update_required)
+ {
update_auto_increment();
+ /* mysql_insert() uses this for protocol return value */
+ table->next_number_field->store(auto_increment_value, 1);
+ }
+
DBUG_RETURN(0);
}
@@ -1896,7 +1901,8 @@ void ha_federated::update_auto_increment(void)
THD *thd= current_thd;
DBUG_ENTER("ha_federated::update_auto_increment");
- thd->insert_id(mysql->last_used_con->insert_id);
+ ha_federated::info(HA_STATUS_AUTO);
+ thd->insert_id(auto_increment_value);
DBUG_PRINT("info",("last_insert_id: %ld", (long) auto_increment_value));
DBUG_VOID_RETURN;
@@ -2688,8 +2694,10 @@ int ha_federated::info(uint flag)
block_size= 4096;
}
- if (result)
- mysql_free_result(result);
+ if (flag & HA_STATUS_AUTO)
+ auto_increment_value= mysql->last_used_con->insert_id;
+
+ mysql_free_result(result);
DBUG_RETURN(0);