Commit aaa182b1 authored by Will DeVries's avatar Will DeVries Committed by Sergei Petrunia

Fix crash with update.

parent 04ca407d
......@@ -712,7 +712,7 @@ int clustrix_connection::update_query(String &stmt, LEX_CSTRING &dbname,
int error_code;
command_length = 0;
if ((error_code = add_command_operand_uchar(CLUSTRIX_UPDATE_QUERY)))
if ((error_code = begin_command(CLUSTRIX_UPDATE_QUERY)))
return error_code;
if ((error_code = add_command_operand_str((uchar*)dbname.str, dbname.length)))
......
......@@ -483,6 +483,9 @@ int ha_clustrixdb::direct_update_rows(ha_rows *update_rows)
String update_stmt;
update_stmt.append(thd->query_string.str());
if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
trx->auto_commit_next();
trx->update_query(update_stmt, table->s->db, update_rows);
thd->get_stmt_da()->set_overwrite_status(true);
......@@ -926,10 +929,12 @@ int ha_clustrixdb::external_lock(THD *thd, int lock_type)
int error_code;
clustrix_connection *trx = get_trx(thd, &error_code);
if (lock_type != F_UNLCK) {
if (!trx->has_open_transaction())
trx->begin_transaction();
trans_register_ha(thd, FALSE, clustrixdb_hton);
if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
if (!trx->has_open_anonymous_savepoint())
trx->set_anonymous_savepoint();
trans_register_ha(thd, TRUE, clustrixdb_hton);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment