Commit 38c94765 authored by Kentoku SHIBA's avatar Kentoku SHIBA

Change for mearging MariaDB 10.0.4.

parent 48ed7f10
...@@ -7833,13 +7833,8 @@ int ha_spider::info( ...@@ -7833,13 +7833,8 @@ int ha_spider::info(
*/ */
if ((spider_init_error_table->init_error_with_message = if ((spider_init_error_table->init_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(spider_init_error_table->init_error_msg,
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg, strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
spider_init_error_table->init_error_time = spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0); (time_t) time((time_t*) 0);
} }
...@@ -8059,13 +8054,8 @@ ha_rows ha_spider::records_in_range( ...@@ -8059,13 +8054,8 @@ ha_rows ha_spider::records_in_range(
*/ */
if ((spider_init_error_table->init_error_with_message = if ((spider_init_error_table->init_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(spider_init_error_table->init_error_msg,
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg, strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
spider_init_error_table->init_error_time = spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0); (time_t) time((time_t*) 0);
} }
...@@ -8108,7 +8098,7 @@ ha_rows ha_spider::records_in_range( ...@@ -8108,7 +8098,7 @@ ha_rows ha_spider::records_in_range(
KEY *key_info = &table->key_info[inx]; KEY *key_info = &table->key_info[inx];
key_part_map full_key_part_map = key_part_map full_key_part_map =
make_prev_keypart_map(key_info->key_parts); make_prev_keypart_map(spider_user_defined_key_parts(key_info));
key_part_map start_key_part_map; key_part_map start_key_part_map;
key_part_map end_key_part_map; key_part_map end_key_part_map;
key_part_map tgt_key_part_map; key_part_map tgt_key_part_map;
...@@ -8301,13 +8291,8 @@ int ha_spider::check_crd() ...@@ -8301,13 +8291,8 @@ int ha_spider::check_crd()
spider_init_error_table->init_error = error_num; spider_init_error_table->init_error = error_num;
if ((spider_init_error_table->init_error_with_message = if ((spider_init_error_table->init_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(spider_init_error_table->init_error_msg,
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg, strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
spider_init_error_table->init_error_time = spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0); (time_t) time((time_t*) 0);
} }
...@@ -9736,9 +9721,9 @@ int ha_spider::create( ...@@ -9736,9 +9721,9 @@ int ha_spider::create(
if ( if (
(thd->lex->alter_info.flags & (thd->lex->alter_info.flags &
( (
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION | SPIDER_ALTER_ADD_PARTITION | SPIDER_ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION | SPIDER_ALTER_COALESCE_PARTITION | SPIDER_ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION SPIDER_ALTER_TABLE_REORG | SPIDER_ALTER_REBUILD_PARTITION
) )
) && ) &&
memcmp(name + strlen(name) - 5, "#TMP#", 5) memcmp(name + strlen(name) - 5, "#TMP#", 5)
...@@ -9883,9 +9868,9 @@ int ha_spider::rename_table( ...@@ -9883,9 +9868,9 @@ int ha_spider::rename_table(
if ( if (
(thd->lex->alter_info.flags & (thd->lex->alter_info.flags &
( (
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION | SPIDER_ALTER_ADD_PARTITION | SPIDER_ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION | SPIDER_ALTER_COALESCE_PARTITION | SPIDER_ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION SPIDER_ALTER_TABLE_REORG | SPIDER_ALTER_REBUILD_PARTITION
) )
) )
) )
...@@ -10010,9 +9995,9 @@ int ha_spider::delete_table( ...@@ -10010,9 +9995,9 @@ int ha_spider::delete_table(
sql_command == SQLCOM_ALTER_TABLE && sql_command == SQLCOM_ALTER_TABLE &&
(thd->lex->alter_info.flags & (thd->lex->alter_info.flags &
( (
ALTER_ADD_PARTITION | ALTER_DROP_PARTITION | SPIDER_ALTER_ADD_PARTITION | SPIDER_ALTER_DROP_PARTITION |
ALTER_COALESCE_PARTITION | ALTER_REORGANIZE_PARTITION | SPIDER_ALTER_COALESCE_PARTITION | SPIDER_ALTER_REORGANIZE_PARTITION |
ALTER_TABLE_REORG | ALTER_REBUILD_PARTITION SPIDER_ALTER_TABLE_REORG | SPIDER_ALTER_REBUILD_PARTITION
) )
) )
) )
...@@ -10711,7 +10696,8 @@ void ha_spider::set_select_column_mode() ...@@ -10711,7 +10696,8 @@ void ha_spider::set_select_column_mode()
/* need primary key columns */ /* need primary key columns */
key_info = &table_share->key_info[table_share->primary_key]; key_info = &table_share->key_info[table_share->primary_key];
key_part = key_info->key_part; key_part = key_info->key_part;
for (roop_count = 0; roop_count < (int) key_info->key_parts; for (roop_count = 0;
roop_count < (int) spider_user_defined_key_parts(key_info);
roop_count++) roop_count++)
{ {
field = key_part[roop_count].field; field = key_part[roop_count].field;
......
...@@ -2264,11 +2264,7 @@ void *spider_bg_conn_action( ...@@ -2264,11 +2264,7 @@ void *spider_bg_conn_action(
{ {
result_list->bgs_error = error_num; result_list->bgs_error = error_num;
if ((result_list->bgs_error_with_message = thd->is_error())) if ((result_list->bgs_error_with_message = thd->is_error()))
#if MYSQL_VERSION_ID < 50500 strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
strmov(result_list->bgs_error_msg, thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
#endif
} }
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{ {
...@@ -2316,13 +2312,8 @@ void *spider_bg_conn_action( ...@@ -2316,13 +2312,8 @@ void *spider_bg_conn_action(
) { ) {
result_list->bgs_error = spider_db_errorno(conn); result_list->bgs_error = spider_db_errorno(conn);
if ((result_list->bgs_error_with_message = thd->is_error())) if ((result_list->bgs_error_with_message = thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg, strmov(result_list->bgs_error_msg,
thd->main_da.message()); spider_stmt_da_message(thd));
#else
strmov(result_list->bgs_error_msg,
thd->stmt_da->message());
#endif
} else } else
spider_db_discard_multiple_result(spider, conn->link_idx, spider_db_discard_multiple_result(spider, conn->link_idx,
conn); conn);
...@@ -2339,13 +2330,8 @@ void *spider_bg_conn_action( ...@@ -2339,13 +2330,8 @@ void *spider_bg_conn_action(
) { ) {
result_list->bgs_error = spider_db_errorno(conn); result_list->bgs_error = spider_db_errorno(conn);
if ((result_list->bgs_error_with_message = thd->is_error())) if ((result_list->bgs_error_with_message = thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg,
thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, strmov(result_list->bgs_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
} else { } else {
spider->connection_ids[conn->link_idx] = conn->connection_id; spider->connection_ids[conn->link_idx] = conn->connection_id;
if (!conn->bg_discard_result) if (!conn->bg_discard_result)
...@@ -2357,13 +2343,8 @@ void *spider_bg_conn_action( ...@@ -2357,13 +2343,8 @@ void *spider_bg_conn_action(
else { else {
if ((result_list->bgs_error_with_message = if ((result_list->bgs_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(result_list->bgs_error_msg,
thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, strmov(result_list->bgs_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
} }
} else { } else {
result_list->bgs_error = 0; result_list->bgs_error = 0;
...@@ -2373,11 +2354,8 @@ void *spider_bg_conn_action( ...@@ -2373,11 +2354,8 @@ void *spider_bg_conn_action(
} }
} else { } else {
if ((result_list->bgs_error_with_message = thd->is_error())) if ((result_list->bgs_error_with_message = thd->is_error()))
#if MYSQL_VERSION_ID < 50500 strmov(result_list->bgs_error_msg,
strmov(result_list->bgs_error_msg, thd->main_da.message()); spider_stmt_da_message(thd));
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
#endif
} }
#ifdef HA_CAN_BULK_ACCESS #ifdef HA_CAN_BULK_ACCESS
} }
...@@ -2396,11 +2374,7 @@ void *spider_bg_conn_action( ...@@ -2396,11 +2374,7 @@ void *spider_bg_conn_action(
result_list->bgs_error = result_list->bgs_error =
spider_db_store_result(spider, conn->link_idx, result_list->table); spider_db_store_result(spider, conn->link_idx, result_list->table);
if ((result_list->bgs_error_with_message = thd->is_error())) if ((result_list->bgs_error_with_message = thd->is_error()))
#if MYSQL_VERSION_ID < 50500 strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
strmov(result_list->bgs_error_msg, thd->main_da.message());
#else
strmov(result_list->bgs_error_msg, thd->stmt_da->message());
#endif
conn->mta_conn_mutex_unlock_later = FALSE; conn->mta_conn_mutex_unlock_later = FALSE;
} }
conn->bg_search = FALSE; conn->bg_search = FALSE;
...@@ -2427,15 +2401,9 @@ void *spider_bg_conn_action( ...@@ -2427,15 +2401,9 @@ void *spider_bg_conn_action(
SPIDER_BG_DIRECT_SQL *bg_direct_sql = SPIDER_BG_DIRECT_SQL *bg_direct_sql =
(SPIDER_BG_DIRECT_SQL *) direct_sql->parent; (SPIDER_BG_DIRECT_SQL *) direct_sql->parent;
pthread_mutex_lock(direct_sql->bg_mutex); pthread_mutex_lock(direct_sql->bg_mutex);
#if MYSQL_VERSION_ID < 50500 bg_direct_sql->bg_error = spider_stmt_da_sql_errno(thd);
bg_direct_sql->bg_error = thd->main_da.sql_errno();
strmov((char *) bg_direct_sql->bg_error_msg, strmov((char *) bg_direct_sql->bg_error_msg,
thd->main_da.message()); spider_stmt_da_message(thd));
#else
bg_direct_sql->bg_error = thd->stmt_da->sql_errno();
strmov((char *) bg_direct_sql->bg_error_msg,
thd->stmt_da->message());
#endif
pthread_mutex_unlock(direct_sql->bg_mutex); pthread_mutex_unlock(direct_sql->bg_mutex);
is_error = TRUE; is_error = TRUE;
} }
......
...@@ -680,7 +680,7 @@ int spider_db_errorno( ...@@ -680,7 +680,7 @@ int spider_db_errorno(
current_thd && current_thd &&
spider_param_force_commit(current_thd) == 1 spider_param_force_commit(current_thd) == 1
) { ) {
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning(current_thd, SPIDER_WARN_LEVEL_WARN,
error_num, conn->db_conn->get_error()); error_num, conn->db_conn->get_error());
if (spider_param_log_result_errors() >= 3) if (spider_param_log_result_errors() >= 3)
{ {
...@@ -1421,13 +1421,15 @@ int spider_db_append_key_columns( ...@@ -1421,13 +1421,15 @@ int spider_db_append_key_columns(
SPIDER_RESULT_LIST *result_list = &spider->result_list; SPIDER_RESULT_LIST *result_list = &spider->result_list;
KEY *key_info = result_list->key_info; KEY *key_info = result_list->key_info;
uint key_name_length, key_count; uint key_name_length, key_count;
key_part_map full_key_part_map = make_prev_keypart_map(key_info->key_parts); key_part_map full_key_part_map =
make_prev_keypart_map(spider_user_defined_key_parts(key_info));
key_part_map start_key_part_map; key_part_map start_key_part_map;
char tmp_buf[MAX_FIELD_WIDTH]; char tmp_buf[MAX_FIELD_WIDTH];
DBUG_ENTER("spider_db_append_key_columns"); DBUG_ENTER("spider_db_append_key_columns");
start_key_part_map = start_key->keypart_map & full_key_part_map; start_key_part_map = start_key->keypart_map & full_key_part_map;
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info->key_parts)); DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
spider_user_defined_key_parts(key_info)));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
...@@ -1567,7 +1569,8 @@ int spider_db_append_key_where_internal( ...@@ -1567,7 +1569,8 @@ int spider_db_append_key_where_internal(
} }
if (key_info) if (key_info)
full_key_part_map = make_prev_keypart_map(key_info->key_parts); full_key_part_map =
make_prev_keypart_map(spider_user_defined_key_parts(key_info));
else else
full_key_part_map = 0; full_key_part_map = 0;
...@@ -1583,8 +1586,8 @@ int spider_db_append_key_where_internal( ...@@ -1583,8 +1586,8 @@ int spider_db_append_key_where_internal(
end_key_part_map = 0; end_key_part_map = 0;
use_both = FALSE; use_both = FALSE;
} }
DBUG_PRINT("info", ("spider key_info->key_parts=%u", key_info ? DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u", key_info ?
key_info->key_parts : 0)); spider_user_defined_key_parts(key_info) : 0));
DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map)); DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map)); DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
DBUG_PRINT("info", ("spider end_key_part_map=%lu", end_key_part_map)); DBUG_PRINT("info", ("spider end_key_part_map=%lu", end_key_part_map));
...@@ -2731,7 +2734,7 @@ int spider_db_fetch_key( ...@@ -2731,7 +2734,7 @@ int spider_db_fetch_key(
for ( for (
key_part = key_info->key_part, key_part = key_info->key_part,
part_num = 0; part_num = 0;
part_num < key_info->key_parts; part_num < spider_user_defined_key_parts(key_info);
key_part++, key_part++,
part_num++ part_num++
) { ) {
...@@ -4666,7 +4669,7 @@ int spider_db_seek_tmp_key( ...@@ -4666,7 +4669,7 @@ int spider_db_seek_tmp_key(
for ( for (
key_part = key_info->key_part, key_part = key_info->key_part,
part_num = 0; part_num = 0;
part_num < key_info->key_parts; part_num < spider_user_defined_key_parts(key_info);
key_part++, key_part++,
part_num++ part_num++
) { ) {
...@@ -4813,7 +4816,8 @@ void spider_db_set_cardinarity( ...@@ -4813,7 +4816,8 @@ void spider_db_set_cardinarity(
for (roop_count = 0; roop_count < (int) table->s->keys; roop_count++) for (roop_count = 0; roop_count < (int) table->s->keys; roop_count++)
{ {
key_info = &table->key_info[roop_count]; key_info = &table->key_info[roop_count];
for (roop_count2 = 0; roop_count2 < (int) key_info->key_parts; for (roop_count2 = 0;
roop_count2 < (int) spider_user_defined_key_parts(key_info);
roop_count2++) roop_count2++)
{ {
key_part = &key_info->key_part[roop_count2]; key_part = &key_info->key_part[roop_count2];
...@@ -5469,7 +5473,7 @@ int spider_db_update_auto_increment( ...@@ -5469,7 +5473,7 @@ int spider_db_update_auto_increment(
for (roop_count = first_set ? 1 : 0; for (roop_count = first_set ? 1 : 0;
roop_count < (int) affected_rows; roop_count < (int) affected_rows;
roop_count++) roop_count++)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning_printf(thd, SPIDER_WARN_LEVEL_NOTE,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM, ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR); ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR);
} }
...@@ -5485,7 +5489,7 @@ int spider_db_update_auto_increment( ...@@ -5485,7 +5489,7 @@ int spider_db_update_auto_increment(
#endif #endif
) { ) {
for (roop_count = 0; roop_count < (int) affected_rows; roop_count++) for (roop_count = 0; roop_count < (int) affected_rows; roop_count++)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning_printf(thd, SPIDER_WARN_LEVEL_NOTE,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM, ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_NUM,
ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR); ER_SPIDER_AUTOINC_VAL_IS_DIFFERENT_STR);
} }
...@@ -7790,7 +7794,7 @@ uint spider_db_check_ft_idx( ...@@ -7790,7 +7794,7 @@ uint spider_db_check_ft_idx(
key_info = &table->key_info[roop_count]; key_info = &table->key_info[roop_count];
if ( if (
key_info->algorithm == HA_KEY_ALG_FULLTEXT && key_info->algorithm == HA_KEY_ALG_FULLTEXT &&
item_count - 1 == key_info->key_parts item_count - 1 == spider_user_defined_key_parts(key_info)
) { ) {
match1 = TRUE; match1 = TRUE;
for (roop_count2 = 1; roop_count2 < item_count; roop_count2++) for (roop_count2 = 1; roop_count2 < item_count; roop_count2++)
...@@ -7801,7 +7805,8 @@ uint spider_db_check_ft_idx( ...@@ -7801,7 +7805,8 @@ uint spider_db_check_ft_idx(
DBUG_RETURN(MAX_KEY); DBUG_RETURN(MAX_KEY);
match2 = FALSE; match2 = FALSE;
for (key_part = key_info->key_part, part_num = 0; for (key_part = key_info->key_part, part_num = 0;
part_num < key_info->key_parts; key_part++, part_num++) part_num < spider_user_defined_key_parts(key_info);
key_part++, part_num++)
{ {
if (key_part->field == field) if (key_part->field == field)
{ {
......
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE #define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
#define SPIDER_HAS_SHOW_SIMPLE_FUNC #define SPIDER_HAS_SHOW_SIMPLE_FUNC
#endif #endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100003
#define SPIDER_GENERATE_PARTITION_SYNTAX_HAS_CURRENT_COMMENT_START #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define SPIDER_HAS_TIME_STATUS
#endif #endif
class spider_db_conn; class spider_db_conn;
......
This diff is collapsed.
This diff is collapsed.
...@@ -59,6 +59,38 @@ ...@@ -59,6 +59,38 @@
#define my_sprintf(A,B) sprintf B #define my_sprintf(A,B) sprintf B
#endif #endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define spider_stmt_da_message(A) (A)->get_stmt_da()->message()
#define spider_stmt_da_sql_errno(A) (A)->get_stmt_da()->sql_errno()
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
#define SPIDER_ALTER_ADD_PARTITION Alter_info::ALTER_ADD_PARTITION
#define SPIDER_ALTER_DROP_PARTITION Alter_info::ALTER_DROP_PARTITION
#define SPIDER_ALTER_COALESCE_PARTITION Alter_info::ALTER_COALESCE_PARTITION
#define SPIDER_ALTER_REORGANIZE_PARTITION Alter_info::ALTER_REORGANIZE_PARTITION
#define SPIDER_ALTER_TABLE_REORG Alter_info::ALTER_TABLE_REORG
#define SPIDER_ALTER_REBUILD_PARTITION Alter_info::ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#else
#if MYSQL_VERSION_ID < 50500
#define spider_stmt_da_message(A) (A)->main_da.message()
#define spider_stmt_da_sql_errno(A) (A)->main_da.sql_errno()
#else
#define spider_stmt_da_message(A) (A)->stmt_da->message()
#define spider_stmt_da_sql_errno(A) (A)->stmt_da->sql_errno()
#endif
#define spider_user_defined_key_parts(A) (A)->key_parts
#define SPIDER_ALTER_ADD_PARTITION ALTER_ADD_PARTITION
#define SPIDER_ALTER_DROP_PARTITION ALTER_DROP_PARTITION
#define SPIDER_ALTER_COALESCE_PARTITION ALTER_COALESCE_PARTITION
#define SPIDER_ALTER_REORGANIZE_PARTITION ALTER_REORGANIZE_PARTITION
#define SPIDER_ALTER_TABLE_REORG ALTER_TABLE_REORG
#define SPIDER_ALTER_REBUILD_PARTITION ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
#endif
#if MYSQL_VERSION_ID >= 50500 #if MYSQL_VERSION_ID >= 50500
#define SPIDER_HAS_HASH_VALUE_TYPE #define SPIDER_HAS_HASH_VALUE_TYPE
#endif #endif
......
...@@ -1156,11 +1156,7 @@ my_bool spider_ping_table_init_body( ...@@ -1156,11 +1156,7 @@ my_bool spider_ping_table_init_body(
if (!(trx = spider_get_trx(thd, TRUE, &error_num))) if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
{ {
my_error(error_num, MYF(0)); my_error(error_num, MYF(0));
#if MYSQL_VERSION_ID < 50500 strcpy(message, spider_stmt_da_message(thd));
strcpy(message, thd->main_da.message());
#else
strcpy(message, thd->stmt_da->message());
#endif
goto error; goto error;
} }
......
...@@ -377,7 +377,7 @@ int spider_get_sys_table_by_idx( ...@@ -377,7 +377,7 @@ int spider_get_sys_table_by_idx(
if ((error_num = spider_sys_index_init(table, idx, FALSE))) if ((error_num = spider_sys_index_init(table, idx, FALSE)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
if ((int) key_info->key_parts == col_count) if ((int) spider_user_defined_key_parts(key_info) == col_count)
{ {
key_length = key_info->key_length; key_length = key_info->key_length;
} else { } else {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#else #else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "my_getopt.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "sql_servers.h" #include "sql_servers.h"
...@@ -4562,13 +4563,8 @@ SPIDER_SHARE *spider_get_share( ...@@ -4562,13 +4563,8 @@ SPIDER_SHARE *spider_get_share(
spider_init_error_table->init_error = *error_num; spider_init_error_table->init_error = *error_num;
if ((spider_init_error_table->init_error_with_message = if ((spider_init_error_table->init_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(spider_init_error_table->init_error_msg,
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg, strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
spider_init_error_table->init_error_time = spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0); (time_t) time((time_t*) 0);
} }
...@@ -4990,13 +4986,8 @@ SPIDER_SHARE *spider_get_share( ...@@ -4990,13 +4986,8 @@ SPIDER_SHARE *spider_get_share(
spider_init_error_table->init_error = *error_num; spider_init_error_table->init_error = *error_num;
if ((spider_init_error_table->init_error_with_message = if ((spider_init_error_table->init_error_with_message =
thd->is_error())) thd->is_error()))
#if MYSQL_VERSION_ID < 50500
strmov(spider_init_error_table->init_error_msg,
thd->main_da.message());
#else
strmov(spider_init_error_table->init_error_msg, strmov(spider_init_error_table->init_error_msg,
thd->stmt_da->message()); spider_stmt_da_message(thd));
#endif
spider_init_error_table->init_error_time = spider_init_error_table->init_error_time =
(time_t) time((time_t*) 0); (time_t) time((time_t*) 0);
} }
...@@ -6985,7 +6976,8 @@ bool spider_check_pk_update( ...@@ -6985,7 +6976,8 @@ bool spider_check_pk_update(
key_info = &table_share->key_info[table_share->primary_key]; key_info = &table_share->key_info[table_share->primary_key];
key_part = key_info->key_part; key_part = key_info->key_part;
for (roop_count = 0; roop_count < (int) key_info->key_parts; roop_count++) for (roop_count = 0;
roop_count < (int) spider_user_defined_key_parts(key_info); roop_count++)
{ {
if (bitmap_is_set(table->write_set, if (bitmap_is_set(table->write_set,
key_part[roop_count].field->field_index)) key_part[roop_count].field->field_index))
...@@ -7018,7 +7010,8 @@ bool spider_check_hs_pk_update( ...@@ -7018,7 +7010,8 @@ bool spider_check_hs_pk_update(
memset(spider->tmp_column_bitmap, 0, sizeof(uchar) * share->bitmap_size); memset(spider->tmp_column_bitmap, 0, sizeof(uchar) * share->bitmap_size);
key_info = &table->key_info[table_share->primary_key]; key_info = &table->key_info[table_share->primary_key];
key_part = key_info->key_part; key_part = key_info->key_part;
for (roop_count = 0; roop_count < key_info->key_parts; roop_count++) for (roop_count = 0; roop_count < spider_user_defined_key_parts(key_info);
roop_count++)
{ {
field_index = key_part[roop_count].field->field_index; field_index = key_part[roop_count].field->field_index;
if (bitmap_is_set(table->write_set, field_index)) if (bitmap_is_set(table->write_set, field_index))
...@@ -7829,13 +7822,8 @@ int spider_discover_table_structure( ...@@ -7829,13 +7822,8 @@ int spider_discover_table_structure(
{ {
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM); DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
} }
#ifdef SPIDER_GENERATE_PARTITION_SYNTAX_HAS_CURRENT_COMMENT_START
if (!(part_syntax = generate_partition_syntax(part_info, &part_syntax_len,
FALSE, TRUE, info, NULL, NULL)))
#else
if (!(part_syntax = generate_partition_syntax(part_info, &part_syntax_len, if (!(part_syntax = generate_partition_syntax(part_info, &part_syntax_len,
FALSE, TRUE, info, NULL))) FALSE, TRUE, info, NULL)))
#endif
{ {
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
} }
......
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