#include "binding.hpp"
#include "rust_callbacks.hpp"
enum_alter_inplace_result RustHandlerBase::check_if_supported_inplace_alter(
TABLE *altered_table, Alter_inplace_info *ha_alter_info) {
if (rust_ctx_) {
int32_t v = 0;
if (rust__handler__check_if_supported_inplace_alter(
rust_ctx_, static_cast<const void *>(altered_table),
static_cast<const void *>(ha_alter_info), &v))
return static_cast<enum_alter_inplace_result>(v);
}
return handler::check_if_supported_inplace_alter(altered_table, ha_alter_info);
}
bool RustHandlerBase::prepare_inplace_alter_table(
TABLE *altered_table, Alter_inplace_info *ha_alter_info,
const dd::Table *old_table_def, dd::Table *new_table_def) {
if (rust_ctx_) {
bool v = false;
if (rust__handler__prepare_inplace_alter_table(
rust_ctx_, static_cast<const void *>(altered_table),
static_cast<const void *>(ha_alter_info),
static_cast<const void *>(old_table_def),
static_cast<const void *>(new_table_def), &v))
return v;
}
return handler::prepare_inplace_alter_table(altered_table, ha_alter_info,
old_table_def, new_table_def);
}
bool RustHandlerBase::inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
const dd::Table *old_table_def,
dd::Table *new_table_def) {
if (rust_ctx_) {
bool v = false;
if (rust__handler__inplace_alter_table(
rust_ctx_, static_cast<const void *>(altered_table),
static_cast<const void *>(ha_alter_info),
static_cast<const void *>(old_table_def),
static_cast<const void *>(new_table_def), &v))
return v;
}
return handler::inplace_alter_table(altered_table, ha_alter_info,
old_table_def, new_table_def);
}
bool RustHandlerBase::commit_inplace_alter_table(
TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit,
const dd::Table *old_table_def, dd::Table *new_table_def) {
if (rust_ctx_) {
bool v = false;
if (rust__handler__commit_inplace_alter_table(
rust_ctx_, static_cast<const void *>(altered_table),
static_cast<const void *>(ha_alter_info), commit,
static_cast<const void *>(old_table_def),
static_cast<const void *>(new_table_def), &v))
return v;
}
return handler::commit_inplace_alter_table(
altered_table, ha_alter_info, commit, old_table_def, new_table_def);
}
void RustHandlerBase::notify_table_changed(Alter_inplace_info *ha_alter_info) {
if (rust_ctx_) {
rust__handler__notify_table_changed(
rust_ctx_, static_cast<const void *>(ha_alter_info));
return;
}
handler::notify_table_changed(ha_alter_info);
}
bool RustHandlerBase::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes) {
if (rust_ctx_) {
bool v = false;
if (rust__handler__check_if_incompatible_data(
rust_ctx_, static_cast<const void *>(create_info), table_changes,
&v))
return v;
}
return handler::check_if_incompatible_data(create_info, table_changes);
}