31 #define HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM 10000
33 #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
34 #define FEDERATED_RECORDS_IN_RANGE 2
35 #define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb
46 const char *share_key;
55 char *connection_string;
69 size_t table_name_length, server_name_length, connect_string_length, use_count;
90 int remote_error_number;
91 char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE];
92 bool ignore_duplicates, replace_duplicates;
93 bool insert_dup_update;
101 uint convert_row_to_internal_format(uchar *
buf, MYSQL_ROW row,
103 bool create_where_from_key(
String *
to,
KEY *key_info,
106 bool records_in_range,
bool eq_range);
107 int stash_remote_error();
111 int read_next(uchar *buf,
MYSQL_RES *result);
112 int index_read_idx_with_result_set(uchar *buf, uint
index,
115 ha_rkey_function find_flag,
117 int real_query(
const char *query,
size_t length);
133 const char *index_type(uint inx) {
return "REMOTE"; }
140 ulonglong table_flags()
const
143 return (HA_PRIMARY_KEY_IN_READ_INDEX |
144 HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_FILE_BASED |
145 HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS |
146 HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
147 HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE |
149 HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY |
163 ulong index_flags(uint inx, uint part,
bool all_parts)
const
165 return (HA_READ_NEXT | HA_READ_RANGE | HA_READ_AFTER_KEY);
167 uint max_supported_record_length()
const {
return HA_MAX_REC_LENGTH; }
168 uint max_supported_keys()
const {
return MAX_KEY; }
169 uint max_supported_key_parts()
const {
return MAX_REF_PARTS; }
170 uint max_supported_key_length()
const {
return FEDERATED_MAX_KEY_LENGTH; }
171 uint max_supported_key_part_length()
const {
return FEDERATED_MAX_KEY_LENGTH; }
185 DBUG_PRINT(
"info", (
"records %lu", (ulong)
stats.records));
186 return (
double)(
stats.records*1000);
197 return (
double) rows / 20.0+1;
200 const key_map *keys_to_use_for_scanning() {
return &key_map_full; }
207 int open(
const char *
name,
int mode, uint test_if_locked);
212 int write_row(uchar *buf);
213 int update_row(
const uchar *old_data, uchar *new_data);
214 int delete_row(
const uchar *buf);
215 int index_init(uint keynr,
bool sorted);
217 int index_read(uchar *buf,
const uchar *key,
218 uint key_len,
enum ha_rkey_function find_flag);
219 int index_read_idx(uchar *buf, uint idx,
const uchar *key,
220 uint key_len,
enum ha_rkey_function find_flag);
225 bool eq_range,
bool sorted);
238 int rnd_next_int(uchar *buf);
239 int rnd_pos(uchar *buf, uchar *pos);
242 int extra(ha_extra_function operation);
244 void update_auto_increment(
void);
252 ha_rows records_in_range(uint inx,
key_range *start_key,
257 enum thr_lock_type lock_type);
263 int external_lock(THD *thd,
int lock_type);
264 int connection_commit();
265 int connection_rollback();
266 int connection_autocommit(
bool state);
267 int execute_simple_query(
const char *query,
int len);