mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Update Spider to version 3.3.14. Add direct left outer join/right outer join/inner join feature
This commit is contained in:
parent
36be0a5aef
commit
6caf9ec425
67 changed files with 5242 additions and 697 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -64,6 +64,9 @@ extern HASH spider_open_tables;
|
|||
#endif
|
||||
extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex;
|
||||
|
||||
/* UTC time zone for timestamp columns */
|
||||
extern Time_zone *UTC;
|
||||
|
||||
ha_spider::ha_spider(
|
||||
) : handler(spider_hton_ptr, NULL)
|
||||
{
|
||||
|
@ -7963,7 +7966,7 @@ int ha_spider::cmp_ref(
|
|||
if ((ret = (*field)->cmp_binary_offset((uint) ptr_diff)))
|
||||
{
|
||||
DBUG_PRINT("info",("spider different at %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -9959,21 +9962,38 @@ int ha_spider::end_bulk_update(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int ha_spider::bulk_update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
) {
|
||||
)
|
||||
#else
|
||||
int ha_spider::bulk_update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
)
|
||||
#endif
|
||||
{
|
||||
DBUG_ENTER("ha_spider::bulk_update_row");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
*dup_key_found = 0;
|
||||
DBUG_RETURN(update_row(old_data, new_data));
|
||||
}
|
||||
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int ha_spider::update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data
|
||||
) {
|
||||
)
|
||||
#else
|
||||
int ha_spider::update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
THD *thd = ha_thd();
|
||||
backup_error_status();
|
||||
|
@ -10064,10 +10084,24 @@ int ha_spider::update_row(
|
|||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count, bool sorted,
|
||||
const uchar *new_data)
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int ha_spider::direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#else
|
||||
int ha_spider::direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
int error_num;
|
||||
|
@ -10095,8 +10129,13 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
|
|||
pre_direct_init_result));
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data));
|
||||
#else
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
direct_update_init(
|
||||
|
@ -10200,6 +10239,7 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
|
|||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
}
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
/**
|
||||
Perform initialization for a direct update request.
|
||||
|
||||
|
@ -10209,37 +10249,43 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields, uint mode,
|
|||
0 Success.
|
||||
*/
|
||||
|
||||
int ha_spider::direct_update_rows_init(List<Item> *update_fields)
|
||||
int ha_spider::direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
)
|
||||
#else
|
||||
int ha_spider::direct_update_rows_init()
|
||||
#endif
|
||||
{
|
||||
st_select_lex *select_lex;
|
||||
longlong select_limit;
|
||||
longlong offset_limit;
|
||||
List_iterator<Item> it(*update_fields);
|
||||
List_iterator<Item> it(*direct_update_fields);
|
||||
Item *item;
|
||||
Field *field;
|
||||
THD *thd = trx->thd;
|
||||
DBUG_ENTER("ha_spider::direct_update_rows_init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
|
||||
while ((item = it++))
|
||||
if (thd->variables.time_zone != UTC)
|
||||
{
|
||||
if (item->type() == Item::FIELD_ITEM)
|
||||
while ((item = it++))
|
||||
{
|
||||
field = ((Item_field *)item)->field;
|
||||
|
||||
if (field->type() == FIELD_TYPE_TIMESTAMP &&
|
||||
field->flags & UNIQUE_KEY_FLAG)
|
||||
if (item->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
/*
|
||||
Spider cannot perform direct update on unique timestamp fields.
|
||||
To avoid false duplicate key errors, the table needs to be
|
||||
updated one row at a time.
|
||||
*/
|
||||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
field = ((Item_field *)item)->field;
|
||||
|
||||
if (field->type() == FIELD_TYPE_TIMESTAMP &&
|
||||
field->flags & UNIQUE_KEY_FLAG)
|
||||
{
|
||||
/*
|
||||
Spider cannot perform direct update on unique timestamp fields.
|
||||
To avoid false duplicate key errors, the table needs to be
|
||||
updated one row at a time.
|
||||
*/
|
||||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (
|
||||
bulk_access_executing &&
|
||||
|
@ -10257,8 +10303,12 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields)
|
|||
pre_direct_init_result));
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->
|
||||
direct_update_rows_init(List<Item> *update_fields));
|
||||
direct_update_rows_init(update_fields));
|
||||
#else
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
direct_update_init(
|
||||
|
@ -10329,30 +10379,54 @@ int ha_spider::direct_update_rows_init(List<Item> *update_fields)
|
|||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields,
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count, bool sorted,
|
||||
const uchar *new_data)
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int ha_spider::pre_direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#else
|
||||
int ha_spider::pre_direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (bulk_access_started)
|
||||
{
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(update_fields, mode, ranges, range_count,
|
||||
sorted, new_data);
|
||||
pre_direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data);
|
||||
#else
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data);
|
||||
#endif
|
||||
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
|
||||
bulk_access_link_current->called = TRUE;
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
pre_direct_init_result = direct_update_rows_init(update_fields, mode,
|
||||
ranges, range_count,
|
||||
sorted, new_data);
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
pre_direct_init_result = direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data);
|
||||
#else
|
||||
pre_direct_init_result = direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data);
|
||||
#endif
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
/**
|
||||
Do initialization for performing parallel direct update
|
||||
for a handlersocket update request.
|
||||
|
@ -10363,20 +10437,34 @@ int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields,
|
|||
0 Success.
|
||||
*/
|
||||
|
||||
int ha_spider::pre_direct_update_rows_init(List<Item> *update_fields)
|
||||
int ha_spider::pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
)
|
||||
#else
|
||||
int ha_spider::pre_direct_update_rows_init()
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (bulk_access_started)
|
||||
{
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(update_fields);
|
||||
pre_direct_update_rows_init(update_fields);
|
||||
#else
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init();
|
||||
#endif
|
||||
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
|
||||
bulk_access_link_current->called = TRUE;
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
pre_direct_init_result = direct_update_rows_init(update_fields);
|
||||
#else
|
||||
pre_direct_init_result = direct_update_rows_init();
|
||||
#endif
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#endif
|
||||
|
@ -11305,7 +11393,7 @@ int ha_spider::create(
|
|||
|
||||
DBUG_PRINT("info",
|
||||
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
if ((thd->lex->alter_info.partition_flags &
|
||||
(
|
||||
SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP |
|
||||
|
@ -11501,7 +11589,7 @@ int ha_spider::rename_table(
|
|||
|
||||
DBUG_PRINT("info",
|
||||
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
if (
|
||||
(thd->lex->alter_info.partition_flags &
|
||||
(
|
||||
|
@ -11697,7 +11785,7 @@ int ha_spider::delete_table(
|
|||
|
||||
DBUG_PRINT("info",
|
||||
("spider alter_info.flags: %llu alter_info.partition_flags: %lu",
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags));
|
||||
if (
|
||||
sql_command == SQLCOM_ALTER_TABLE &&
|
||||
(thd->lex->alter_info.partition_flags &
|
||||
|
@ -13514,6 +13602,7 @@ void ha_spider::check_pre_call(
|
|||
bool use_parallel
|
||||
) {
|
||||
THD* thd = ha_thd();
|
||||
LEX *lex = thd->lex;
|
||||
st_select_lex *select_lex = spider_get_select_lex(this);
|
||||
int skip_parallel_search =
|
||||
spider_param_skip_parallel_search(thd, share->skip_parallel_search);
|
||||
|
@ -13522,11 +13611,15 @@ void ha_spider::check_pre_call(
|
|||
if (
|
||||
(
|
||||
(skip_parallel_search & 1) &&
|
||||
thd->lex && thd->lex->sql_command != SQLCOM_SELECT // such like insert .. select ..
|
||||
lex->sql_command != SQLCOM_SELECT // such like insert .. select ..
|
||||
) ||
|
||||
(
|
||||
(skip_parallel_search & 2) &&
|
||||
#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump
|
||||
#else
|
||||
select_lex && select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE // for mysqldump
|
||||
#endif
|
||||
)
|
||||
) {
|
||||
use_pre_call = FALSE;
|
||||
|
@ -15672,12 +15765,23 @@ int ha_spider::mk_bulk_tmp_table_and_bulk_start()
|
|||
dbton_hdl->first_link_idx >= 0 &&
|
||||
dbton_hdl->need_copy_for_update(roop_count)
|
||||
) {
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
|
||||
if (
|
||||
!tmp_table[roop_count] &&
|
||||
!(tmp_table[roop_count] = spider_mk_sys_tmp_table(
|
||||
trx->thd, table, &result_list.upd_tmp_tbl_prms[roop_count],
|
||||
&field_name, result_list.update_sqls[roop_count].charset()))
|
||||
)
|
||||
#else
|
||||
if (
|
||||
!tmp_table[roop_count] &&
|
||||
!(tmp_table[roop_count] = spider_mk_sys_tmp_table(
|
||||
trx->thd, table, &result_list.upd_tmp_tbl_prms[roop_count], "a",
|
||||
result_list.update_sqls[roop_count].charset()))
|
||||
) {
|
||||
)
|
||||
#endif
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error_2;
|
||||
}
|
||||
|
@ -15775,8 +15879,7 @@ int ha_spider::print_item_type(
|
|||
if (
|
||||
dbton_hdl->first_link_idx >= 0 &&
|
||||
(error_num = spider_db_print_item_type(item, NULL, this, str,
|
||||
alias, alias_length, dbton_id,
|
||||
FALSE, NULL))
|
||||
alias, alias_length, dbton_id, FALSE, NULL))
|
||||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -576,6 +576,7 @@ public:
|
|||
ha_rows *dup_key_found
|
||||
);
|
||||
int end_bulk_update();
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int bulk_update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data,
|
||||
|
@ -585,31 +586,92 @@ public:
|
|||
const uchar *old_data,
|
||||
const uchar *new_data
|
||||
);
|
||||
#else
|
||||
int bulk_update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
);
|
||||
int update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
inline int direct_update_rows_init(List<Item> *update_fields)
|
||||
{
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
inline int direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
) {
|
||||
return direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int direct_update_rows_init(List<Item> *update_fields, uint mode,
|
||||
KEY_MULTI_RANGE *ranges, uint range_count,
|
||||
bool sorted, const uchar *new_data);
|
||||
int direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#else
|
||||
int direct_update_rows_init(List<Item> *update_fields);
|
||||
inline int direct_update_rows_init()
|
||||
{
|
||||
return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
);
|
||||
#else
|
||||
int direct_update_rows_init();
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
inline int pre_direct_update_rows_init(List<Item> *update_fields)
|
||||
{
|
||||
return pre_direct_update_rows_init(update_fields,
|
||||
2, NULL, 0, FALSE, NULL);
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
inline int pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
) {
|
||||
return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int pre_direct_update_rows_init(List<Item> *update_fields,
|
||||
uint mode, KEY_MULTI_RANGE *ranges,
|
||||
uint range_count, bool sorted,
|
||||
uchar *new_data);
|
||||
int pre_direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#else
|
||||
int pre_direct_update_rows_init(List<Item> *update_fields);
|
||||
inline int pre_direct_update_rows_init()
|
||||
{
|
||||
return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int pre_direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
);
|
||||
#else
|
||||
int pre_direct_update_rows_init();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2013 Kentoku Shiba
|
||||
/* Copyright (C) 2013-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -0,0 +1,9 @@
|
|||
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
|
||||
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
|
@ -0,0 +1,13 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
let $CHILD2_1_SELECT_ARGUMENT1=
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
|
||||
--let $OUTPUT_CHILD_GROUP2= 1
|
||||
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
|
||||
--let $USE_GENERAL_LOG= 1
|
|
@ -103,10 +103,17 @@ if (!$VERSION_COMPILE_OS_WIN)
|
|||
);
|
||||
}
|
||||
|
||||
let $SERVER_NAME=
|
||||
`SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 2), '-', -1)`;
|
||||
let $SERVER_MAJOR_VERSION=
|
||||
`SELECT SUBSTRING_INDEX(version(), '.', 1)`;
|
||||
let $SERVER_MINOR_VERSION=
|
||||
`SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '.', 2), '.', -1)`;
|
||||
let $PLUGIN_VERSION=
|
||||
`SELECT SUBSTRING_INDEX(plugin_version, '.', 1)
|
||||
FROM information_schema.plugins
|
||||
WHERE plugin_name = 'SPIDER'`;
|
||||
|
||||
if (`SELECT IF($PLUGIN_VERSION = 1, 1, 0)`)
|
||||
{
|
||||
DROP TABLE IF EXISTS mysql.spider_xa;
|
||||
|
@ -245,7 +252,16 @@ if (`SELECT IF($PLUGIN_VERSION = 2, 1, 0)`)
|
|||
}
|
||||
if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
||||
{
|
||||
let $ENGINE_NAME=
|
||||
`SELECT IF (STRCMP('$SERVER_NAME', 'MariaDB') = 0,
|
||||
IF ($SERVER_MAJOR_VERSION = 10,
|
||||
IF ($SERVER_MINOR_VERSION < 4, 'MyISAM',
|
||||
'Aria transactional=1'),
|
||||
IF ($SERVER_MAJOR_VERSION < 10, 'MyISAM',
|
||||
'Aria transactional=1')),
|
||||
'MyISAM')`;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_xa(
|
||||
format_id int not null default 0,
|
||||
gtrid_length int not null default 0,
|
||||
|
@ -254,8 +270,9 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
status char(8) not null default '',
|
||||
PRIMARY KEY (data, format_id, gtrid_length),
|
||||
KEY idx1 (status)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa_member;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_xa_member(
|
||||
format_id int not null default 0,
|
||||
gtrid_length int not null default 0,
|
||||
|
@ -276,8 +293,9 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
default_file text default null,
|
||||
default_group char(64) default null,
|
||||
KEY idx1 (data, format_id, gtrid_length, host)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_xa_failed_log(
|
||||
format_id int not null default 0,
|
||||
gtrid_length int not null default 0,
|
||||
|
@ -301,8 +319,9 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
status char(8) not null default '',
|
||||
failed_time timestamp not null default current_timestamp,
|
||||
key idx1 (data, format_id, gtrid_length, host)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_tables;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_tables(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
|
@ -332,8 +351,9 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
PRIMARY KEY (db_name, table_name, link_id),
|
||||
KEY idx1 (priority),
|
||||
UNIQUE KEY uidx1 (db_name, table_name, static_link_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_link_mon_servers(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
|
@ -355,15 +375,17 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
default_file text default null,
|
||||
default_group char(64) default null,
|
||||
PRIMARY KEY (db_name, table_name, link_id, sid)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_link_failed_log(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
link_id char(64) not null default '',
|
||||
failed_time timestamp not null default current_timestamp
|
||||
) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_table_position_for_recovery(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
|
@ -373,8 +395,9 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
position text,
|
||||
gtid text,
|
||||
primary key (db_name, table_name, failed_link_id, source_link_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_sts;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_table_sts(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
|
@ -387,15 +410,16 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
|
|||
create_time datetime not null default '0000-00-00 00:00:00',
|
||||
update_time datetime not null default '0000-00-00 00:00:00',
|
||||
primary key (db_name, table_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_crd;
|
||||
eval
|
||||
CREATE TABLE mysql.spider_table_crd(
|
||||
db_name char(64) not null default '',
|
||||
table_name char(199) not null default '',
|
||||
key_seq int unsigned not null default 0,
|
||||
cardinality bigint not null default 0,
|
||||
primary key (db_name, table_name, key_seq)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
) ENGINE=$ENGINE_NAME DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
}
|
||||
|
||||
SET spider_internal_sql_log_off= 0;
|
||||
|
|
108
storage/spider/mysql-test/spider/r/direct_join_using.result
Normal file
108
storage/spider/mysql-test/spider/r/direct_join_using.result
Normal file
|
@ -0,0 +1,108 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES5
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES5
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
|
||||
a b c
|
||||
5 50 500
|
||||
4 40 400
|
||||
3 30 300
|
||||
2 20 200
|
||||
1 10 100
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
3 c 2000-01-03 00:00:00
|
||||
4 d 2000-01-04 00:00:00
|
||||
5 e 2000-01-05 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
108
storage/spider/mysql-test/spider/r/direct_left_join.result
Normal file
108
storage/spider/mysql-test/spider/r/direct_left_join.result
Normal file
|
@ -0,0 +1,108 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES5
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES5
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
|
||||
a b c
|
||||
5 50 500
|
||||
4 40 400
|
||||
3 30 300
|
||||
2 20 200
|
||||
1 10 100
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
3 c 2000-01-03 00:00:00
|
||||
4 d 2000-01-04 00:00:00
|
||||
5 e 2000-01-05 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,113 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
|
||||
a b c a
|
||||
5 NULL NULL NULL
|
||||
4 NULL NULL NULL
|
||||
3 c 2000-01-03 00:00:00 NULL
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on ((t1.`a` = t0.`a`) and (t0.`a` is not null)) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on ((t3.`b` = t2.`b`) and (t2.`b` is not null)) where 1 order by t0.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,113 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
a b c a
|
||||
NULL NULL NULL 5
|
||||
NULL NULL NULL 4
|
||||
NULL NULL NULL 3
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null) and (t3.`b` is not null)) where 1 order by t3.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,112 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
a b c a
|
||||
NULL d 2000-01-04 00:00:00 4
|
||||
NULL c 2000-01-03 00:00:00 3
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
108
storage/spider/mysql-test/spider/r/direct_right_join.result
Normal file
108
storage/spider/mysql-test/spider/r/direct_right_join.result
Normal file
|
@ -0,0 +1,108 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES5
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES5
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
|
||||
a b c
|
||||
5 50 500
|
||||
4 40 400
|
||||
3 30 300
|
||||
2 20 200
|
||||
1 10 100
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
3 c 2000-01-03 00:00:00
|
||||
4 d 2000-01-04 00:00:00
|
||||
5 e 2000-01-05 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,113 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
a b c a
|
||||
NULL NULL NULL 5
|
||||
NULL d 2000-01-04 00:00:00 4
|
||||
NULL c 2000-01-03 00:00:00 3
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on ((t2.`b` = t3.`b`) and (t3.`b` is not null)) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,112 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
a b c a
|
||||
NULL d 2000-01-04 00:00:00 4
|
||||
NULL c 2000-01-03 00:00:00 3
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
|
@ -0,0 +1,113 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
drop and create databases
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
connection child2_1;
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
|
||||
test select 1
|
||||
connection master_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
connection child2_1;
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
|
||||
create table and insert
|
||||
connection child2_1;
|
||||
CHILD2_1_DROP_TABLES
|
||||
CHILD2_1_DROP_TABLES6
|
||||
CHILD2_1_DROP_TABLES4
|
||||
CHILD2_1_DROP_TABLES3
|
||||
CHILD2_1_CREATE_TABLES
|
||||
CHILD2_1_CREATE_TABLES6
|
||||
CHILD2_1_CREATE_TABLES4
|
||||
CHILD2_1_CREATE_TABLES3
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
|
||||
CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
|
||||
CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
|
||||
CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
select test
|
||||
connection child2_1;
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
connection master_1;
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
a b c a
|
||||
NULL NULL NULL 5
|
||||
NULL NULL NULL 4
|
||||
NULL c 2000-01-03 00:00:00 3
|
||||
2 b 2000-01-02 00:00:00 2
|
||||
1 a 2000-01-01 00:00:00 1
|
||||
connection child2_1;
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
|
||||
argument
|
||||
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t3.`b` is not null)) where 1 order by t3.`a` desc
|
||||
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
|
||||
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
|
||||
a b date_format(c, '%Y-%m-%d %H:%i:%s')
|
||||
1 a 2000-01-01 00:00:00
|
||||
2 b 2000-01-02 00:00:00
|
||||
|
||||
deinit
|
||||
connection master_1;
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
37
storage/spider/mysql-test/spider/r/show_system_tables.result
Normal file
37
storage/spider/mysql-test/spider/r/show_system_tables.result
Normal file
|
@ -0,0 +1,37 @@
|
|||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
Show system tables on the Spider node
|
||||
connection master_1;
|
||||
SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_schema = 'mysql' AND table_name like '%spider_%';
|
||||
table_name engine
|
||||
spider_link_failed_log MyISAM
|
||||
spider_link_mon_servers MyISAM
|
||||
spider_table_crd MyISAM
|
||||
spider_table_position_for_recovery MyISAM
|
||||
spider_table_sts MyISAM
|
||||
spider_tables MyISAM
|
||||
spider_xa MyISAM
|
||||
spider_xa_failed_log MyISAM
|
||||
spider_xa_member MyISAM
|
||||
|
||||
deinit
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
child3_1
|
||||
child3_2
|
||||
child3_3
|
||||
|
||||
end of test
|
197
storage/spider/mysql-test/spider/t/direct_join_using.test
Normal file
197
storage/spider/mysql-test/spider/t/direct_join_using.test
Normal file
|
@ -0,0 +1,197 @@
|
|||
--source ../include/direct_join_using_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES5;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES5;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES5;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES5;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_join_using_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
197
storage/spider/mysql-test/spider/t/direct_left_join.test
Normal file
197
storage/spider/mysql-test/spider/t/direct_left_join.test
Normal file
|
@ -0,0 +1,197 @@
|
|||
--source ../include/direct_left_join_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES5;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES5;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES5;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES5;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_left_join_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_left_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_left_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_left_right_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_left_right_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_left_right_left_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_left_right_left_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
197
storage/spider/mysql-test/spider/t/direct_right_join.test
Normal file
197
storage/spider/mysql-test/spider/t/direct_right_join.test
Normal file
|
@ -0,0 +1,197 @@
|
|||
--source ../include/direct_right_join_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES5;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES5;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES5;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES5;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b INT DEFAULT 10,
|
||||
c INT DEFAULT 11,
|
||||
PRIMARY KEY(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_right_join_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_right_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_right_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_right_left_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_right_left_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
|
@ -0,0 +1,212 @@
|
|||
--source ../include/direct_right_left_right_join_nullable_init.inc
|
||||
|
||||
--echo
|
||||
--echo drop and create databases
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET @old_log_output = @@global.log_output;
|
||||
SET GLOBAL log_output = 'TABLE,FILE';
|
||||
}
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
}
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo test select 1
|
||||
--connection master_1
|
||||
SELECT 1;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
SELECT 1;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo create table and insert
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
echo CHILD2_1_DROP_TABLES;
|
||||
echo CHILD2_1_DROP_TABLES6;
|
||||
echo CHILD2_1_DROP_TABLES4;
|
||||
echo CHILD2_1_DROP_TABLES3;
|
||||
echo CHILD2_1_CREATE_TABLES;
|
||||
echo CHILD2_1_CREATE_TABLES6;
|
||||
echo CHILD2_1_CREATE_TABLES4;
|
||||
echo CHILD2_1_CREATE_TABLES3;
|
||||
}
|
||||
--disable_warnings
|
||||
eval $CHILD2_1_DROP_TABLES;
|
||||
eval $CHILD2_1_DROP_TABLES6;
|
||||
eval $CHILD2_1_DROP_TABLES4;
|
||||
eval $CHILD2_1_DROP_TABLES3;
|
||||
--enable_warnings
|
||||
eval $CHILD2_1_CREATE_TABLES;
|
||||
eval $CHILD2_1_CREATE_TABLES6;
|
||||
eval $CHILD2_1_CREATE_TABLES4;
|
||||
eval $CHILD2_1_CREATE_TABLES3;
|
||||
if ($OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
}
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
--connection master_1
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS tbl_a;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
echo CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
|
||||
eval CREATE TABLE tbl_a (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
|
||||
echo CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
|
||||
eval CREATE TABLE tbl_b (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
|
||||
echo CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
|
||||
eval CREATE TABLE tbl_c (
|
||||
a INT AUTO_INCREMENT,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10',
|
||||
KEY idx0(a),
|
||||
KEY idx1(b),
|
||||
KEY idx2(c)
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
|
||||
echo CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
|
||||
eval CREATE TABLE tbl_d (
|
||||
a INT DEFAULT 10,
|
||||
b CHAR(1) DEFAULT 'c',
|
||||
c DATETIME DEFAULT '1999-10-10 10:10:10'
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
|
||||
--enable_query_log
|
||||
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
|
||||
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
|
||||
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
|
||||
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
|
||||
|
||||
--echo
|
||||
--echo select test
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
TRUNCATE TABLE mysql.general_log;
|
||||
}
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--connection master_1
|
||||
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
|
||||
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
}
|
||||
--connection child2_1
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
eval $CHILD2_1_SELECT_ARGUMENT1;
|
||||
}
|
||||
eval $CHILD2_1_SELECT_TABLES;
|
||||
if (!$OUTPUT_CHILD_GROUP2)
|
||||
{
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
}
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--connection master_1
|
||||
DROP DATABASE IF EXISTS auto_test_local;
|
||||
if ($USE_CHILD_GROUP2)
|
||||
{
|
||||
--connection child2_1
|
||||
DROP DATABASE IF EXISTS auto_test_remote;
|
||||
if ($USE_GENERAL_LOG)
|
||||
{
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
}
|
||||
}
|
||||
--enable_warnings
|
||||
--source ../include/direct_right_left_right_join_nullable_deinit.inc
|
||||
--echo
|
||||
--echo end of test
|
26
storage/spider/mysql-test/spider/t/show_system_tables.test
Normal file
26
storage/spider/mysql-test/spider/t/show_system_tables.test
Normal file
|
@ -0,0 +1,26 @@
|
|||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
--echo Show system tables on the Spider node
|
||||
--connection master_1
|
||||
--sorted_result
|
||||
SELECT table_name, engine FROM information_schema.tables
|
||||
WHERE table_schema = 'mysql' AND table_name like '%spider_%';
|
||||
|
||||
--echo
|
||||
--echo deinit
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--enable_warnings
|
||||
--echo
|
||||
--echo end of test
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2010-2016 Kentoku Shiba
|
||||
# Copyright (C) 2010-2018 Kentoku Shiba
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -167,8 +167,8 @@ drop procedure if exists mysql.spider_fix_system_tables;
|
|||
delimiter //
|
||||
create procedure mysql.spider_fix_one_table
|
||||
(tab_name char(255) charset utf8 collate utf8_bin,
|
||||
test_col_name char(255) charset utf8 collate utf8_bin,
|
||||
_sql text charset utf8 collate utf8_bin)
|
||||
test_col_name char(255) charset utf8 collate utf8_bin,
|
||||
_sql text charset utf8 collate utf8_bin)
|
||||
begin
|
||||
set @col_exists := 0;
|
||||
select 1 into @col_exists from INFORMATION_SCHEMA.COLUMNS
|
||||
|
@ -184,6 +184,13 @@ end;//
|
|||
|
||||
create procedure mysql.spider_fix_system_tables()
|
||||
begin
|
||||
select substring_index(substring_index(version(), '-', 2), '-', -1)
|
||||
into @server_name;
|
||||
select substring_index(version(), '.', 1)
|
||||
into @server_major_version;
|
||||
select substring_index(substring_index(version(), '.', 2), '.', -1)
|
||||
into @server_minor_version;
|
||||
|
||||
-- Fix for 0.5
|
||||
call mysql.spider_fix_one_table('spider_tables', 'server',
|
||||
'alter table mysql.spider_tables
|
||||
|
@ -400,6 +407,81 @@ begin
|
|||
alter table mysql.spider_table_crd
|
||||
modify table_name char(199) not null default '';
|
||||
end if;
|
||||
|
||||
-- Fix for MariaDB 10.4: Crash-Safe system tables
|
||||
if @server_name = 'MariaDB' and
|
||||
(
|
||||
@server_major_version > 10 or
|
||||
(
|
||||
@server_major_version = 10 and
|
||||
@server_minor_version >= 4
|
||||
)
|
||||
)
|
||||
then
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_link_failed_log';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_link_failed_log
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_link_mon_servers';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_link_mon_servers
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_table_crd';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_table_crd
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_table_position_for_recovery';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_table_position_for_recovery
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_table_sts';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_table_sts
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_tables';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_tables
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_xa';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_xa
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_xa_failed_log';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_xa_failed_log
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
|
||||
where TABLE_SCHEMA = 'mysql'
|
||||
AND TABLE_NAME = 'spider_xa_member';
|
||||
if @engine_name != 'Aria' then
|
||||
alter table mysql.spider_xa_member
|
||||
engine=Aria transactional=1;
|
||||
end if;
|
||||
end if;
|
||||
end;//
|
||||
delimiter ;
|
||||
call mysql.spider_fix_system_tables;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1439,9 +1439,10 @@ void spider_conn_queue_time_zone(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
void spider_conn_queue_UTC_time_zone(SPIDER_CONN *conn)
|
||||
{
|
||||
DBUG_ENTER("spider_conn_queue_time_zone");
|
||||
void spider_conn_queue_UTC_time_zone(
|
||||
SPIDER_CONN *conn
|
||||
) {
|
||||
DBUG_ENTER("spider_conn_queue_UTC_time_zone");
|
||||
DBUG_PRINT("info", ("spider conn=%p", conn));
|
||||
spider_conn_queue_time_zone(conn, UTC);
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,8 +13,6 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "tztime.h"
|
||||
|
||||
#define SPIDER_LOCK_MODE_NO_LOCK 0
|
||||
#define SPIDER_LOCK_MODE_SHARED 1
|
||||
#define SPIDER_LOCK_MODE_EXCLUSIVE 2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -53,10 +53,10 @@ int spider_udf_set_copy_tables_param_default(
|
|||
if (!copy_tables->database)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default database"));
|
||||
copy_tables->database_length = copy_tables->trx->thd->db.length;
|
||||
copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd);
|
||||
if (
|
||||
!(copy_tables->database = spider_create_string(
|
||||
copy_tables->trx->thd->db.str,
|
||||
SPIDER_THD_db_str(copy_tables->trx->thd),
|
||||
copy_tables->database_length))
|
||||
) {
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
|
||||
|
@ -90,8 +90,7 @@ int spider_udf_set_copy_tables_param_default(
|
|||
start_ptr, TRUE, ¶m_string_parse))) \
|
||||
copy_tables->SPIDER_PARAM_STR_LEN(param_name) = \
|
||||
strlen(copy_tables->param_name); \
|
||||
else \
|
||||
{ \
|
||||
else { \
|
||||
error_num = param_string_parse.print_param_error(); \
|
||||
goto error; \
|
||||
} \
|
||||
|
@ -968,19 +967,25 @@ long long spider_copy_tables_body(
|
|||
goto error;
|
||||
|
||||
table_list = ©_tables->spider_table_list;
|
||||
table_list->db.str = copy_tables->spider_db_name;
|
||||
table_list->db.length = copy_tables->spider_db_name_length;
|
||||
table_list->alias.str = table_list->table_name.str =
|
||||
SPIDER_TABLE_LIST_db_str(table_list) = copy_tables->spider_db_name;
|
||||
SPIDER_TABLE_LIST_db_length(table_list) = copy_tables->spider_db_name_length;
|
||||
SPIDER_TABLE_LIST_alias_str(table_list) =
|
||||
SPIDER_TABLE_LIST_table_name_str(table_list) =
|
||||
copy_tables->spider_real_table_name;
|
||||
table_list->table_name.length = copy_tables->spider_real_table_name_length;
|
||||
table_list->alias.length= table_list->table_name.length;
|
||||
SPIDER_TABLE_LIST_table_name_length(table_list) =
|
||||
copy_tables->spider_real_table_name_length;
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
|
||||
SPIDER_TABLE_LIST_alias_length(table_list) =
|
||||
SPIDER_TABLE_LIST_table_name_length(table_list);
|
||||
#endif
|
||||
table_list->lock_type = TL_READ;
|
||||
|
||||
DBUG_PRINT("info",("spider db=%s", table_list->db.str));
|
||||
DBUG_PRINT("info",("spider db_length=%zd", table_list->db.length));
|
||||
DBUG_PRINT("info",("spider table_name=%s", table_list->table_name.str));
|
||||
DBUG_PRINT("info",("spider db=%s", SPIDER_TABLE_LIST_db_str(table_list)));
|
||||
DBUG_PRINT("info",("spider db_length=%zd", SPIDER_TABLE_LIST_db_length(table_list)));
|
||||
DBUG_PRINT("info",("spider table_name=%s",
|
||||
SPIDER_TABLE_LIST_table_name_str(table_list)));
|
||||
DBUG_PRINT("info",("spider table_name_length=%zd",
|
||||
table_list->table_name.length));
|
||||
SPIDER_TABLE_LIST_table_name_length(table_list)));
|
||||
reprepare_observer_backup = thd->m_reprepare_observer;
|
||||
thd->m_reprepare_observer = NULL;
|
||||
copy_tables->trx->trx_start = TRUE;
|
||||
|
@ -991,8 +996,8 @@ long long spider_copy_tables_body(
|
|||
#else
|
||||
table_list->mdl_request.init(
|
||||
MDL_key::TABLE,
|
||||
table_list->db.str,
|
||||
table_list->table_name.str,
|
||||
SPIDER_TABLE_LIST_db_str(table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(table_list),
|
||||
MDL_SHARED_READ,
|
||||
MDL_TRANSACTION
|
||||
);
|
||||
|
@ -1004,8 +1009,9 @@ long long spider_copy_tables_body(
|
|||
copy_tables->trx->updated_in_this_trx = FALSE;
|
||||
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
|
||||
my_printf_error(ER_SPIDER_UDF_CANT_OPEN_TABLE_NUM,
|
||||
ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0), table_list->db,
|
||||
table_list->table_name);
|
||||
ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0),
|
||||
SPIDER_TABLE_LIST_db_str(table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(table_list));
|
||||
goto error;
|
||||
}
|
||||
thd->m_reprepare_observer = reprepare_observer_backup;
|
||||
|
@ -1019,7 +1025,8 @@ long long spider_copy_tables_body(
|
|||
{
|
||||
my_printf_error(ER_SPIDER_UDF_COPY_TABLE_NEED_PK_NUM,
|
||||
ER_SPIDER_UDF_COPY_TABLE_NEED_PK_STR, MYF(0),
|
||||
table_list->db, table_list->table_name);
|
||||
SPIDER_TABLE_LIST_db_str(table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(table_list));
|
||||
goto error;
|
||||
}
|
||||
key_info = &table->key_info[table_share->primary_key];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -77,7 +77,7 @@ pthread_mutex_t spider_open_conn_mutex;
|
|||
const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/* UTC time zone for timestamp columns */
|
||||
extern Time_zone *UTC;
|
||||
Time_zone *UTC = 0;
|
||||
|
||||
int spider_db_connect(
|
||||
const SPIDER_SHARE *share,
|
||||
|
@ -1387,12 +1387,34 @@ int spider_db_unlock_tables(
|
|||
|
||||
int spider_db_append_name_with_quote_str(
|
||||
spider_string *str,
|
||||
char *name,
|
||||
const char *name,
|
||||
uint dbton_id
|
||||
) {
|
||||
int error_num, length = strlen(name);
|
||||
char *name_end, head_code;
|
||||
DBUG_ENTER("spider_db_append_name_with_quote_str");
|
||||
DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
|
||||
str, name, strlen(name), dbton_id));
|
||||
}
|
||||
|
||||
int spider_db_append_name_with_quote_str(
|
||||
spider_string *str,
|
||||
LEX_CSTRING &name,
|
||||
uint dbton_id
|
||||
) {
|
||||
DBUG_ENTER("spider_db_append_name_with_quote_str");
|
||||
DBUG_RETURN(spider_db_append_name_with_quote_str_internal(
|
||||
str, name.str, name.length, dbton_id));
|
||||
}
|
||||
|
||||
int spider_db_append_name_with_quote_str_internal(
|
||||
spider_string *str,
|
||||
const char *name,
|
||||
int length,
|
||||
uint dbton_id
|
||||
) {
|
||||
int error_num;
|
||||
const char *name_end;
|
||||
char head_code;
|
||||
DBUG_ENTER("spider_db_append_name_with_quote_str_internal");
|
||||
for (name_end = name + length; name < name_end; name += length)
|
||||
{
|
||||
head_code = *name;
|
||||
|
@ -1695,8 +1717,13 @@ int spider_db_append_key_where_internal(
|
|||
|
||||
if (sql_kind == SPIDER_SQL_KIND_HANDLER)
|
||||
{
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
const char *key_name = key_info->name.str;
|
||||
key_name_length = key_info->name.length;
|
||||
key_name_length = key_info->name.length;
|
||||
#else
|
||||
const char *key_name = key_info->name;
|
||||
key_name_length = strlen(key_name);
|
||||
#endif
|
||||
if (str->reserve(SPIDER_SQL_READ_LEN +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + key_name_length))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -2876,7 +2903,7 @@ int spider_db_fetch_row(
|
|||
THD *thd = field->table->in_use;
|
||||
Time_zone *saved_time_zone = thd->variables.time_zone;
|
||||
DBUG_ENTER("spider_db_fetch_row");
|
||||
DBUG_PRINT("info", ("spider field_name %s", field->field_name.str));
|
||||
DBUG_PRINT("info", ("spider field_name %s", SPIDER_field_name_str(field)));
|
||||
DBUG_PRINT("info", ("spider fieldcharset %s", field->charset()->csname));
|
||||
|
||||
thd->variables.time_zone = UTC;
|
||||
|
@ -3013,7 +3040,7 @@ int spider_db_fetch_table(
|
|||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
if ((error_num =
|
||||
spider_db_fetch_row(share, *field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -3184,7 +3211,8 @@ int spider_db_fetch_key(
|
|||
my_bitmap_map *tmp_map =
|
||||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name.str));
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
SPIDER_field_name_str(field)));
|
||||
if ((error_num =
|
||||
spider_db_fetch_row(share, field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -3303,7 +3331,7 @@ int spider_db_fetch_minimum_columns(
|
|||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
if ((error_num = spider_db_fetch_row(share, *field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
#ifndef DBUG_OFF
|
||||
|
@ -4011,9 +4039,18 @@ int spider_db_store_result(
|
|||
|
||||
DBUG_PRINT("info",("spider store result to temporary table"));
|
||||
DBUG_ASSERT(!current->result_tmp_tbl);
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
LEX_CSTRING field_name1 = {STRING_WITH_LEN("a")};
|
||||
LEX_CSTRING field_name2 = {STRING_WITH_LEN("b")};
|
||||
LEX_CSTRING field_name3 = {STRING_WITH_LEN("c")};
|
||||
if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result(
|
||||
thd, table, ¤t->result_tmp_tbl_prm, &field_name1, &field_name2,
|
||||
&field_name3, &my_charset_bin)))
|
||||
#else
|
||||
if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result(
|
||||
thd, table, ¤t->result_tmp_tbl_prm, "a", "b", "c",
|
||||
&my_charset_bin)))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -5324,7 +5361,7 @@ int spider_db_seek_tmp_table(
|
|||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
if ((error_num =
|
||||
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -5411,7 +5448,8 @@ int spider_db_seek_tmp_key(
|
|||
my_bitmap_map *tmp_map =
|
||||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s", field->field_name.str));
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
SPIDER_field_name_str(field)));
|
||||
if ((error_num =
|
||||
spider_db_fetch_row(spider->share, field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -5502,7 +5540,7 @@ int spider_db_seek_tmp_minimum_columns(
|
|||
dbug_tmp_use_all_columns(table, table->write_set);
|
||||
#endif
|
||||
DBUG_PRINT("info", ("spider bitmap is set %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
if ((error_num =
|
||||
spider_db_fetch_row(spider->share, *field, row, ptr_diff)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -5514,7 +5552,7 @@ int spider_db_seek_tmp_minimum_columns(
|
|||
else if (bitmap_is_set(table->read_set, (*field)->field_index))
|
||||
{
|
||||
DBUG_PRINT("info", ("spider bitmap is cleared %s",
|
||||
(*field)->field_name.str));
|
||||
SPIDER_field_name_str(*field)));
|
||||
bitmap_clear_bit(table->read_set, (*field)->field_index);
|
||||
}
|
||||
}
|
||||
|
@ -8478,11 +8516,14 @@ int spider_db_flush_logs(
|
|||
contains only one field; NULL otherwise.
|
||||
*/
|
||||
|
||||
Field *spider_db_find_field_in_item_list(Item **item_list, uint item_count,
|
||||
uint start_item, spider_string *str,
|
||||
const char *func_name,
|
||||
int func_name_length)
|
||||
{
|
||||
Field *spider_db_find_field_in_item_list(
|
||||
Item **item_list,
|
||||
uint item_count,
|
||||
uint start_item,
|
||||
spider_string *str,
|
||||
const char *func_name,
|
||||
int func_name_length
|
||||
) {
|
||||
uint item_num;
|
||||
Item *item;
|
||||
Field *field = NULL;
|
||||
|
@ -8530,11 +8571,17 @@ Field *spider_db_find_field_in_item_list(Item **item_list, uint item_count,
|
|||
@return Error code.
|
||||
*/
|
||||
|
||||
int spider_db_print_item_type(Item *item, Field *field, ha_spider *spider,
|
||||
spider_string *str, const char *alias,
|
||||
uint alias_length, uint dbton_id,
|
||||
bool use_fields, spider_fields *fields)
|
||||
{
|
||||
int spider_db_print_item_type(
|
||||
Item *item,
|
||||
Field *field,
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) {
|
||||
DBUG_ENTER("spider_db_print_item_type");
|
||||
DBUG_PRINT("info",("spider COND type=%d", item->type()));
|
||||
|
||||
|
@ -8560,26 +8607,40 @@ int spider_db_print_item_type(Item *item, Field *field, ha_spider *spider,
|
|||
case Item::ROW_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_row((Item_row *) item, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
|
||||
case Item::CONST_ITEM:
|
||||
{
|
||||
switch (item->cmp_type()) {
|
||||
case TIME_RESULT:
|
||||
case STRING_RESULT:
|
||||
DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case INT_RESULT:
|
||||
case REAL_RESULT:
|
||||
case DECIMAL_RESULT:
|
||||
DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
default:
|
||||
DBUG_ASSERT(FALSE);
|
||||
DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
|
||||
}
|
||||
}
|
||||
#else
|
||||
case Item::STRING_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields));
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item::INT_ITEM:
|
||||
case Item::REAL_ITEM:
|
||||
case Item::DECIMAL_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields));
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#endif
|
||||
case Item::CACHE_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field,
|
||||
spider, str, alias, alias_length,
|
||||
dbton_id, use_fields, fields));
|
||||
DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item::INSERT_VALUE_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_insert_value((Item_insert_value *) item,
|
||||
field, spider, str,
|
||||
alias, alias_length,
|
||||
dbton_id,
|
||||
use_fields, fields));
|
||||
field, spider, str, alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item::SUBSELECT_ITEM:
|
||||
case Item::TRIGGER_FIELD_ITEM:
|
||||
#ifdef SPIDER_HAS_EXPR_CACHE_ITEM
|
||||
|
@ -8587,31 +8648,40 @@ int spider_db_print_item_type(Item *item, Field *field, ha_spider *spider,
|
|||
#endif
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
default:
|
||||
THD *thd = spider->trx->thd;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
if (spider_param_skip_default_condition(thd,
|
||||
share->skip_default_condition))
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
if (str)
|
||||
{
|
||||
if (spider->share->access_charset->cset == system_charset_info->cset)
|
||||
{
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
item->print(str->get_str(), QT_IS);
|
||||
#else
|
||||
item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
|
||||
#endif
|
||||
} else {
|
||||
item->print(str->get_str(), QT_ORDINARY);
|
||||
}
|
||||
str->mem_calc();
|
||||
}
|
||||
break;
|
||||
DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_db_print_item_type_default(
|
||||
Item *item,
|
||||
ha_spider *spider,
|
||||
spider_string *str
|
||||
) {
|
||||
DBUG_ENTER("spider_db_print_item_type_default");
|
||||
THD *thd = spider->trx->thd;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
if (spider_param_skip_default_condition(thd,
|
||||
share->skip_default_condition))
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
if (str)
|
||||
{
|
||||
if (spider->share->access_charset->cset == system_charset_info->cset)
|
||||
{
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
item->print(str->get_str(), QT_IS);
|
||||
#else
|
||||
item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
|
||||
#endif
|
||||
} else {
|
||||
item->print(str->get_str(), QT_ORDINARY);
|
||||
}
|
||||
str->mem_calc();
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_db_open_item_cond(
|
||||
Item_cond *item_cond,
|
||||
ha_spider *spider,
|
||||
|
@ -8641,8 +8711,7 @@ restart_first:
|
|||
if (str)
|
||||
restart_pos = str->length();
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
{
|
||||
if (
|
||||
str &&
|
||||
|
@ -8676,8 +8745,7 @@ restart_first:
|
|||
}
|
||||
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
{
|
||||
if (
|
||||
str &&
|
||||
|
@ -8786,7 +8854,15 @@ int spider_db_open_item_ident(
|
|||
}
|
||||
if (str)
|
||||
{
|
||||
field_name_length = item_ident->field_name.length;
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if (item_ident->field_name.str)
|
||||
field_name_length = item_ident->field_name.length;
|
||||
#else
|
||||
if (item_ident->field_name)
|
||||
field_name_length = strlen(item_ident->field_name);
|
||||
#endif
|
||||
else
|
||||
field_name_length = 0;
|
||||
if (share->access_charset->cset == system_charset_info->cset)
|
||||
{
|
||||
if (str->reserve(alias_length +
|
||||
|
@ -8795,8 +8871,13 @@ int spider_db_open_item_ident(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
str->q_append(alias, alias_length);
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name(str, item_ident->field_name.str, field_name_length)))
|
||||
#else
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name(str, item_ident->field_name, field_name_length)))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -8804,9 +8885,15 @@ int spider_db_open_item_ident(
|
|||
if (str->reserve(alias_length))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(alias, alias_length);
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name_with_charset(str, item_ident->field_name.str,
|
||||
field_name_length, system_charset_info)))
|
||||
#else
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name_with_charset(str, item_ident->field_name,
|
||||
field_name_length, system_charset_info)))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -8891,31 +8978,50 @@ int spider_db_open_item_ref(
|
|||
DBUG_ENTER("spider_db_open_item_ref");
|
||||
if (item_ref->ref)
|
||||
{
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if (
|
||||
(*(item_ref->ref))->type() != Item::CACHE_ITEM &&
|
||||
item_ref->ref_type() != Item_ref::VIEW_REF &&
|
||||
!item_ref->table_name &&
|
||||
item_ref->name.str &&
|
||||
item_ref->alias_name_used
|
||||
) {
|
||||
)
|
||||
#else
|
||||
if (
|
||||
(*(item_ref->ref))->type() != Item::CACHE_ITEM &&
|
||||
item_ref->ref_type() != Item_ref::VIEW_REF &&
|
||||
!item_ref->table_name &&
|
||||
item_ref->name &&
|
||||
item_ref->alias_name_used
|
||||
)
|
||||
#endif
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
uint length = item_ref->name.length;
|
||||
#else
|
||||
uint length = strlen(item_ref->name);
|
||||
#endif
|
||||
if (str->reserve(length + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2))
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name(str, item_ref->name.str, length)))
|
||||
#else
|
||||
if ((error_num = spider_dbton[dbton_id].db_util->
|
||||
append_name(str, item_ref->name, length)))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_RETURN(spider_db_print_item_type(*(item_ref->ref), NULL, spider,
|
||||
str, alias, alias_length, dbton_id,
|
||||
use_fields, fields));
|
||||
DBUG_RETURN(spider_db_print_item_type(*(item_ref->ref), NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
}
|
||||
DBUG_RETURN(spider_db_open_item_ident((Item_ident *) item_ref, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
|
@ -8945,8 +9051,7 @@ int spider_db_open_item_row(
|
|||
{
|
||||
item = item_row->element_index(roop_count);
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -8957,8 +9062,7 @@ int spider_db_open_item_row(
|
|||
}
|
||||
item = item_row->element_index(roop_count);
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -8987,12 +9091,17 @@ int spider_db_open_item_row(
|
|||
@return Error code.
|
||||
*/
|
||||
|
||||
int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias, uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields, spider_fields *fields)
|
||||
{
|
||||
int spider_db_open_item_string(
|
||||
Item *item,
|
||||
Field *field,
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) {
|
||||
int error_num = 0;
|
||||
DBUG_ENTER("spider_db_open_item_string");
|
||||
|
||||
|
@ -9002,10 +9111,10 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
|
|||
TABLE *table;
|
||||
my_bitmap_map *saved_map;
|
||||
Time_zone *saved_time_zone;
|
||||
String str_value;
|
||||
char tmp_buf[MAX_FIELD_WIDTH];
|
||||
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
|
||||
String *tmp_str2;
|
||||
String str_value;
|
||||
tmp_str.init_calc_mem(126);
|
||||
|
||||
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
|
||||
|
@ -9013,16 +9122,17 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
|
|||
if (str->reserve(SPIDER_SQL_NULL_LEN))
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (field && field->type() == FIELD_TYPE_TIMESTAMP)
|
||||
{
|
||||
} else {
|
||||
if (
|
||||
field &&
|
||||
field->type() == FIELD_TYPE_TIMESTAMP &&
|
||||
field->table->in_use->variables.time_zone != UTC
|
||||
) {
|
||||
/*
|
||||
Store the string value in the field. This is necessary
|
||||
Store the string value in the field. This is necessary
|
||||
when the statement contains more than one value for the
|
||||
same field.
|
||||
*/
|
||||
|
@ -9039,15 +9149,14 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
|
|||
if (!tmp_str2)
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 +
|
||||
tmp_str2->length() * 2))
|
||||
tmp_str2->length() * 2))
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
if (!thd)
|
||||
tmp_str.mem_calc();
|
||||
|
@ -9056,12 +9165,12 @@ int spider_db_open_item_string(Item *item, Field *field, ha_spider *spider,
|
|||
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
}
|
||||
|
||||
error:
|
||||
end:
|
||||
if (thd)
|
||||
{
|
||||
thd->variables.time_zone = saved_time_zone;
|
||||
|
@ -9089,12 +9198,17 @@ error:
|
|||
@return Error code.
|
||||
*/
|
||||
|
||||
int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias, uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields, spider_fields *fields)
|
||||
{
|
||||
int spider_db_open_item_int(
|
||||
Item *item,
|
||||
Field *field,
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) {
|
||||
int error_num = 0;
|
||||
DBUG_ENTER("spider_db_open_item_int");
|
||||
|
||||
|
@ -9102,24 +9216,27 @@ int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
|
|||
{
|
||||
THD *thd = NULL;
|
||||
TABLE *table;
|
||||
bool print_quoted_string;
|
||||
my_bitmap_map *saved_map;
|
||||
Time_zone *saved_time_zone;
|
||||
String str_value;
|
||||
bool print_quoted_string;
|
||||
char tmp_buf[MAX_FIELD_WIDTH];
|
||||
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
|
||||
String str_value;
|
||||
String *tmp_str2;
|
||||
tmp_str.init_calc_mem(127);
|
||||
|
||||
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
tmp_str.mem_calc();
|
||||
|
||||
if (field && field->type() == FIELD_TYPE_TIMESTAMP)
|
||||
{
|
||||
if (
|
||||
field &&
|
||||
field->type() == FIELD_TYPE_TIMESTAMP &&
|
||||
field->table->in_use->variables.time_zone != UTC
|
||||
) {
|
||||
/*
|
||||
Store the int value in the field. This is necessary
|
||||
when the statement contains more than one value for the
|
||||
|
@ -9132,11 +9249,9 @@ int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
|
|||
saved_time_zone = thd->variables.time_zone;
|
||||
thd->variables.time_zone = UTC;
|
||||
print_quoted_string = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
#ifdef SPIDER_ITEM_HAS_CMP_TYPE
|
||||
DBUG_PRINT("info", ("spider cmp_type=%u", item->cmp_type()));
|
||||
DBUG_PRINT("info",("spider cmp_type=%u", item->cmp_type()));
|
||||
if (item->cmp_type() == TIME_RESULT)
|
||||
print_quoted_string = TRUE;
|
||||
else
|
||||
|
@ -9154,23 +9269,24 @@ int spider_db_open_item_int(Item *item, Field *field, ha_spider *spider,
|
|||
if (!tmp_str2)
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + tmp_str2->length()))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto end;
|
||||
}
|
||||
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
str->append(*tmp_str2);
|
||||
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (str->append(*tmp_str2))
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
}
|
||||
|
||||
error:
|
||||
end:
|
||||
if (thd)
|
||||
{
|
||||
thd->variables.time_zone = saved_time_zone;
|
||||
|
@ -9198,12 +9314,17 @@ error:
|
|||
@return Error code.
|
||||
*/
|
||||
|
||||
int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
||||
ha_spider *spider, spider_string *str,
|
||||
const char *alias, uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields, spider_fields *fields)
|
||||
{
|
||||
int spider_db_open_item_cache(
|
||||
Item_cache *item_cache,
|
||||
Field *field,
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) {
|
||||
DBUG_ENTER("spider_db_open_item_cache");
|
||||
if (!item_cache->const_item())
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
|
@ -9213,8 +9334,7 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
|||
{
|
||||
case STRING_RESULT:
|
||||
DBUG_RETURN(spider_db_open_item_string(item_cache, field, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields));
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case ROW_RESULT:
|
||||
{
|
||||
int error_num;
|
||||
|
@ -9229,11 +9349,9 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
|||
for (roop_count = 0; roop_count < item_count; ++roop_count)
|
||||
{
|
||||
if ((error_num = spider_db_open_item_cache(
|
||||
(Item_cache *)
|
||||
item_cache_row->element_index(roop_count),
|
||||
NULL, spider, str, alias, alias_length,
|
||||
dbton_id, use_fields, fields)))
|
||||
{
|
||||
(Item_cache *) item_cache_row->element_index(roop_count), NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields, fields
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (str)
|
||||
|
@ -9244,11 +9362,9 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
|||
}
|
||||
}
|
||||
if ((error_num = spider_db_open_item_cache(
|
||||
(Item_cache *)
|
||||
item_cache_row->element_index(roop_count),
|
||||
NULL, spider, str, alias, alias_length,
|
||||
dbton_id, use_fields, fields)))
|
||||
{
|
||||
(Item_cache *) item_cache_row->element_index(roop_count), NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields, fields
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (str)
|
||||
|
@ -9266,10 +9382,8 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DBUG_RETURN(spider_db_open_item_int(item_cache, field, spider, str,
|
||||
alias, alias_length, dbton_id,
|
||||
use_fields, fields));
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9288,13 +9402,17 @@ int spider_db_open_item_cache(Item_cache *item_cache, Field *field,
|
|||
@return Error code.
|
||||
*/
|
||||
|
||||
int spider_db_open_item_insert_value(Item_insert_value *item_insert_value,
|
||||
Field *field, ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias, uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields, spider_fields *fields)
|
||||
{
|
||||
int spider_db_open_item_insert_value(
|
||||
Item_insert_value *item_insert_value,
|
||||
Field *field,
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
uint dbton_id,
|
||||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_db_open_item_insert_value");
|
||||
|
||||
|
@ -9308,9 +9426,7 @@ int spider_db_open_item_insert_value(Item_insert_value *item_insert_value,
|
|||
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_insert_value->arg, field,
|
||||
spider, str, alias,
|
||||
alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
spider, str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -9375,10 +9491,9 @@ int spider_db_append_update_columns(
|
|||
while ((field = fi++))
|
||||
{
|
||||
value = vi++;
|
||||
if ((error_num = spider_db_print_item_type((Item *) field, NULL, spider,
|
||||
str, alias, alias_length,
|
||||
dbton_id,
|
||||
use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
(Item *) field, NULL, spider, str, alias, alias_length, dbton_id,
|
||||
use_fields, fields)))
|
||||
{
|
||||
if (
|
||||
error_num == ER_SPIDER_COND_SKIP_NUM &&
|
||||
|
@ -9396,12 +9511,9 @@ int spider_db_append_update_columns(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type((Item *) value,
|
||||
((Item_field *) field)->field,
|
||||
spider, str,
|
||||
alias, alias_length,
|
||||
dbton_id,
|
||||
use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
(Item *) value, ((Item_field *) field)->field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -10599,8 +10711,13 @@ int spider_db_udf_copy_key_row(
|
|||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_db_udf_copy_key_row");
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
if ((error_num = spider_db_append_name_with_quote_str(str,
|
||||
(char *) field->field_name.str, dbton_id)))
|
||||
#else
|
||||
if ((error_num = spider_db_append_name_with_quote_str(str,
|
||||
(char *) field->field_name, dbton_id)))
|
||||
#endif
|
||||
DBUG_RETURN(error_num);
|
||||
if (str->reserve(joint_length + *length + SPIDER_SQL_AND_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -412,7 +412,20 @@ int spider_db_unlock_tables(
|
|||
|
||||
int spider_db_append_name_with_quote_str(
|
||||
spider_string *str,
|
||||
char *name,
|
||||
const char *name,
|
||||
uint dbton_id
|
||||
);
|
||||
|
||||
int spider_db_append_name_with_quote_str(
|
||||
spider_string *str,
|
||||
LEX_CSTRING &name,
|
||||
uint dbton_id
|
||||
);
|
||||
|
||||
int spider_db_append_name_with_quote_str_internal(
|
||||
spider_string *str,
|
||||
const char *name,
|
||||
int length,
|
||||
uint dbton_id
|
||||
);
|
||||
|
||||
|
@ -859,6 +872,12 @@ int spider_db_print_item_type(
|
|||
spider_fields *fields
|
||||
);
|
||||
|
||||
int spider_db_print_item_type_default(
|
||||
Item *item,
|
||||
ha_spider *spider,
|
||||
spider_string *str
|
||||
);
|
||||
|
||||
int spider_db_open_item_cond(
|
||||
Item_cond *item_cond,
|
||||
ha_spider *spider,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -2755,10 +2755,10 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
Item *item, **item_list = item_func->arguments();
|
||||
uint roop_count, item_count = item_func->argument_count(), start_item = 0;
|
||||
const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*separete_str = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*separator_str = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*last_str = SPIDER_SQL_NULL_CHAR_STR;
|
||||
int func_name_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
separete_str_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
separator_str_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
last_str_length = SPIDER_SQL_NULL_CHAR_LEN;
|
||||
int use_pushdown_udf;
|
||||
bool merge_func = FALSE;
|
||||
|
@ -2824,7 +2824,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (
|
||||
!strncasecmp("case", func_name, func_name_length)
|
||||
|
@ -2840,7 +2840,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
if (item_func_case->first_expr_num != -1)
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[item_func_case->first_expr_num], spider, str,
|
||||
item_list[item_func_case->first_expr_num], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -2854,7 +2854,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[roop_count], spider, str,
|
||||
item_list[roop_count], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -2864,7 +2864,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[roop_count + 1], spider, str,
|
||||
item_list[roop_count + 1], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -2877,7 +2877,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[item_func_case->else_expr_num], spider, str,
|
||||
item_list[item_func_case->else_expr_num], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -2914,7 +2914,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (
|
||||
!strncasecmp("convert", func_name, func_name_length)
|
||||
|
@ -2939,7 +2939,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (func_name_length == 9 &&
|
||||
!strncasecmp("isnottrue", func_name, func_name_length)
|
||||
|
@ -2966,8 +2966,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
break;
|
||||
}
|
||||
} else if (func_name_length == 12)
|
||||
|
@ -3055,7 +3055,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
{
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (!strncasecmp("timestampdiff", func_name, func_name_length))
|
||||
{
|
||||
|
@ -3118,7 +3118,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(interval_str, interval_len);
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], spider,
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3127,7 +3127,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], spider,
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3381,8 +3381,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
func_name = spider_db_timefunc_interval_str[
|
||||
item_date_add_interval->int_type];
|
||||
func_name_length = strlen(func_name);
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3398,8 +3398,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_INTERVAL_STR, SPIDER_SQL_INTERVAL_LEN);
|
||||
}
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3421,15 +3421,15 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
case Item_func::NOW_FUNC:
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item_func::CHAR_TYPECAST_FUNC:
|
||||
DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
|
||||
|
@ -3555,15 +3555,15 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
{
|
||||
func_name = SPIDER_SQL_NOT_IN_STR;
|
||||
func_name_length = SPIDER_SQL_NOT_IN_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
} else {
|
||||
func_name = SPIDER_SQL_IN_STR;
|
||||
func_name_length = SPIDER_SQL_IN_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
}
|
||||
|
@ -3573,13 +3573,13 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
{
|
||||
func_name = SPIDER_SQL_NOT_BETWEEN_STR;
|
||||
func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN;
|
||||
separete_str = SPIDER_SQL_AND_STR;
|
||||
separete_str_length = SPIDER_SQL_AND_LEN;
|
||||
separator_str = SPIDER_SQL_AND_STR;
|
||||
separator_str_length = SPIDER_SQL_AND_LEN;
|
||||
} else {
|
||||
func_name = (char*) item_func->func_name();
|
||||
func_name_length = strlen(func_name);
|
||||
separete_str = SPIDER_SQL_AND_STR;
|
||||
separete_str_length = SPIDER_SQL_AND_LEN;
|
||||
separator_str = SPIDER_SQL_AND_STR;
|
||||
separator_str_length = SPIDER_SQL_AND_LEN;
|
||||
}
|
||||
break;
|
||||
case Item_func::UDF_FUNC:
|
||||
|
@ -3600,8 +3600,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3621,10 +3621,10 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
if (item_func->result_type() == STRING_RESULT)
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
else
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item_func::FT_FUNC:
|
||||
if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
|
||||
|
@ -3636,8 +3636,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
|
||||
}
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3654,8 +3654,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3686,8 +3686,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3720,8 +3720,8 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
DBUG_PRINT("info",("spider func_name = %s", func_name));
|
||||
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
|
||||
DBUG_PRINT("info",("spider separete_str = %s", separete_str));
|
||||
DBUG_PRINT("info",("spider separete_str_length = %d", separete_str_length));
|
||||
DBUG_PRINT("info",("spider separator_str = %s", separator_str));
|
||||
DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
|
||||
DBUG_PRINT("info",("spider last_str = %s", last_str));
|
||||
DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
|
||||
if (item_count)
|
||||
|
@ -3730,13 +3730,13 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
for (roop_count = start_item; roop_count < item_count; roop_count++)
|
||||
{
|
||||
item = item_list[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (roop_count == 1)
|
||||
{
|
||||
func_name = separete_str;
|
||||
func_name_length = separete_str_length;
|
||||
func_name = separator_str;
|
||||
func_name_length = separator_str_length;
|
||||
}
|
||||
if (str)
|
||||
{
|
||||
|
@ -3748,7 +3748,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
}
|
||||
}
|
||||
item = item_list[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -3762,7 +3762,7 @@ int spider_db_handlersocket_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
|
||||
}
|
||||
item = item_list[0];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3850,7 +3850,7 @@ int spider_db_handlersocket_util::open_item_sum_func(
|
|||
for (roop_count = 0; roop_count < item_count; roop_count++)
|
||||
{
|
||||
item = args[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3861,7 +3861,7 @@ int spider_db_handlersocket_util::open_item_sum_func(
|
|||
}
|
||||
}
|
||||
item = args[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -3902,8 +3902,11 @@ int spider_db_handlersocket_util::append_escaped_util(
|
|||
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int spider_db_handlersocket_util::append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
) {
|
||||
DBUG_ENTER("spider_db_handlersocket_util::append_from_and_tables");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
|
@ -4209,7 +4212,7 @@ int spider_handlersocket_share::create_column_name_str()
|
|||
str->init_calc_mem(202);
|
||||
str->set_charset(spider_share->access_charset);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(str,
|
||||
(char *) (*field)->field_name.str, dbton_id)))
|
||||
(*field)->field_name, dbton_id)))
|
||||
goto error;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -119,8 +119,11 @@ public:
|
|||
);
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
);
|
||||
int reappend_tables(
|
||||
spider_fields *fields,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,7 +17,6 @@
|
|||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
#include "hstcpcli.hpp"
|
||||
#endif
|
||||
#include "tztime.h"
|
||||
|
||||
#define SPIDER_DBTON_SIZE 15
|
||||
|
||||
|
@ -703,6 +702,8 @@ public:
|
|||
);
|
||||
void set_pos_to_first_table_holder();
|
||||
SPIDER_TABLE_HOLDER *get_next_table_holder();
|
||||
SPIDER_TABLE_HOLDER *get_table_holder(TABLE *table);
|
||||
uint get_table_count();
|
||||
int add_field(Field *field_arg);
|
||||
SPIDER_FIELD_HOLDER *create_field_holder();
|
||||
void set_pos_to_first_field_holder();
|
||||
|
@ -888,8 +889,11 @@ public:
|
|||
) = 0;
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
virtual int append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
) = 0;
|
||||
virtual int reappend_tables(
|
||||
spider_fields *fields,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,8 +13,6 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "tztime.h"
|
||||
|
||||
class spider_db_mysql_util: public spider_db_util
|
||||
{
|
||||
public:
|
||||
|
@ -121,9 +119,46 @@ public:
|
|||
String *from
|
||||
);
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int append_from_and_tables(
|
||||
int append_table(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
TABLE_LIST **used_table_list,
|
||||
uint *current_pos,
|
||||
TABLE_LIST **cond_table_list_ptr,
|
||||
bool top_down,
|
||||
bool first
|
||||
);
|
||||
int append_tables_top_down(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
TABLE_LIST **used_table_list,
|
||||
uint *current_pos,
|
||||
TABLE_LIST **cond_table_list_ptr
|
||||
);
|
||||
int append_tables_top_down_check(
|
||||
TABLE_LIST *table_list,
|
||||
TABLE_LIST **used_table_list,
|
||||
uint *current_pos
|
||||
);
|
||||
int append_embedding_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
TABLE_LIST **used_table_list,
|
||||
uint *current_pos,
|
||||
TABLE_LIST **cond_table_list_ptr
|
||||
);
|
||||
int append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
);
|
||||
int reappend_tables(
|
||||
spider_fields *fields,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -152,6 +152,9 @@ static const int spider_db_table_lock_len[] =
|
|||
sizeof(" in exclusive mode") - 1
|
||||
};
|
||||
|
||||
/* UTC time zone for timestamp columns */
|
||||
extern Time_zone *UTC;
|
||||
|
||||
int spider_db_oracle_get_error(
|
||||
sword res,
|
||||
dvoid *hndlp,
|
||||
|
@ -2410,8 +2413,13 @@ void spider_db_oracle::set_dup_key_idx(
|
|||
key_name = spider->share->tgt_pk_names[all_link_idx];
|
||||
key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx];
|
||||
} else {
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
key_name = (char *) table->s->key_info[roop_count].name.str;
|
||||
key_name_length = table->s->key_info[roop_count].name.length;
|
||||
#else
|
||||
key_name = table->s->key_info[roop_count].name;
|
||||
key_name_length = strlen(key_name);
|
||||
#endif
|
||||
}
|
||||
memcpy(tmp_pos, key_name, key_name_length + 1);
|
||||
DBUG_PRINT("info",("spider key_name=%s", key_name));
|
||||
|
@ -2529,9 +2537,12 @@ int spider_db_oracle_util::append_column_value(
|
|||
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
|
||||
String *ptr;
|
||||
uint length;
|
||||
Time_zone *saved_time_zone = thd->variables.time_zone;
|
||||
DBUG_ENTER("spider_db_oracle_util::append_column_value");
|
||||
tmp_str.init_calc_mem(181);
|
||||
|
||||
thd->variables.time_zone = UTC;
|
||||
|
||||
if (new_ptr)
|
||||
{
|
||||
if (
|
||||
|
@ -2625,6 +2636,9 @@ int spider_db_oracle_util::append_column_value(
|
|||
ptr = field->val_str(tmp_str.get_str());
|
||||
tmp_str.mem_calc();
|
||||
}
|
||||
|
||||
thd->variables.time_zone = saved_time_zone;
|
||||
|
||||
DBUG_PRINT("info", ("spider field->type() is %d", field->type()));
|
||||
DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length()));
|
||||
/*
|
||||
|
@ -2909,12 +2923,13 @@ int spider_db_oracle_util::open_item_func(
|
|||
uint dbton_id = spider_dbton_oracle.dbton_id;
|
||||
int error_num;
|
||||
Item *item, **item_list = item_func->arguments();
|
||||
Field *field;
|
||||
uint roop_count, item_count = item_func->argument_count(), start_item = 0;
|
||||
const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*separete_str = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*separator_str = SPIDER_SQL_NULL_CHAR_STR,
|
||||
*last_str = SPIDER_SQL_NULL_CHAR_STR;
|
||||
int func_name_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
separete_str_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
separator_str_length = SPIDER_SQL_NULL_CHAR_LEN,
|
||||
last_str_length = SPIDER_SQL_NULL_CHAR_LEN;
|
||||
int use_pushdown_udf;
|
||||
bool merge_func = FALSE;
|
||||
|
@ -2980,7 +2995,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (
|
||||
!strncasecmp("case", func_name, func_name_length)
|
||||
|
@ -2996,7 +3011,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
if (item_func_case->first_expr_num != -1)
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[item_func_case->first_expr_num], spider, str,
|
||||
item_list[item_func_case->first_expr_num], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -3010,7 +3025,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[roop_count], spider, str,
|
||||
item_list[roop_count], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3020,7 +3035,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[roop_count + 1], spider, str,
|
||||
item_list[roop_count + 1], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -3033,7 +3048,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
item_list[item_func_case->else_expr_num], spider, str,
|
||||
item_list[item_func_case->else_expr_num], NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -3070,7 +3085,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (
|
||||
!strncasecmp("convert", func_name, func_name_length)
|
||||
|
@ -3095,7 +3110,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (func_name_length == 9 &&
|
||||
!strncasecmp("isnottrue", func_name, func_name_length)
|
||||
|
@ -3122,8 +3137,8 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
break;
|
||||
}
|
||||
} else if (func_name_length == 12)
|
||||
|
@ -3211,7 +3226,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
{
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
} else if (!strncasecmp("timestampdiff", func_name, func_name_length))
|
||||
{
|
||||
|
@ -3274,7 +3289,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(interval_str, interval_len);
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], spider,
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3283,7 +3298,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], spider,
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -3549,8 +3564,9 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
|
||||
SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields,
|
||||
fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3567,8 +3583,9 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields,
|
||||
fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3613,8 +3630,9 @@ int spider_db_oracle_util::open_item_func(
|
|||
case INTERVAL_MINUTE:
|
||||
case INTERVAL_SECOND:
|
||||
case INTERVAL_MICROSECOND:
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[0], NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields,
|
||||
fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3629,8 +3647,9 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_PLUS_STR, SPIDER_SQL_PLUS_LEN);
|
||||
}
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type(item_list[1], NULL,
|
||||
spider, str, alias, alias_length, dbton_id, use_fields,
|
||||
fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -3709,15 +3728,15 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
case Item_func::NOW_FUNC:
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item_func::CHAR_TYPECAST_FUNC:
|
||||
DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
|
||||
|
@ -3843,15 +3862,15 @@ int spider_db_oracle_util::open_item_func(
|
|||
{
|
||||
func_name = SPIDER_SQL_NOT_IN_STR;
|
||||
func_name_length = SPIDER_SQL_NOT_IN_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
} else {
|
||||
func_name = SPIDER_SQL_IN_STR;
|
||||
func_name_length = SPIDER_SQL_IN_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
}
|
||||
|
@ -3861,13 +3880,13 @@ int spider_db_oracle_util::open_item_func(
|
|||
{
|
||||
func_name = SPIDER_SQL_NOT_BETWEEN_STR;
|
||||
func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN;
|
||||
separete_str = SPIDER_SQL_AND_STR;
|
||||
separete_str_length = SPIDER_SQL_AND_LEN;
|
||||
separator_str = SPIDER_SQL_AND_STR;
|
||||
separator_str_length = SPIDER_SQL_AND_LEN;
|
||||
} else {
|
||||
func_name = (char*) item_func->func_name();
|
||||
func_name_length = strlen(func_name);
|
||||
separete_str = SPIDER_SQL_AND_STR;
|
||||
separete_str_length = SPIDER_SQL_AND_LEN;
|
||||
separator_str = SPIDER_SQL_AND_STR;
|
||||
separator_str_length = SPIDER_SQL_AND_LEN;
|
||||
}
|
||||
break;
|
||||
case Item_func::UDF_FUNC:
|
||||
|
@ -3888,8 +3907,8 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3909,10 +3928,10 @@ int spider_db_oracle_util::open_item_func(
|
|||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
if (item_func->result_type() == STRING_RESULT)
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
else
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, spider, str,
|
||||
DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item_func::FT_FUNC:
|
||||
if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
|
||||
|
@ -3924,8 +3943,8 @@ int spider_db_oracle_util::open_item_func(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
|
||||
}
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3942,8 +3961,8 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -3974,8 +3993,8 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
func_name = SPIDER_SQL_COMMA_STR;
|
||||
func_name_length = SPIDER_SQL_COMMA_LEN;
|
||||
separete_str = SPIDER_SQL_COMMA_STR;
|
||||
separete_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
separator_str = SPIDER_SQL_COMMA_STR;
|
||||
separator_str_length = SPIDER_SQL_COMMA_LEN;
|
||||
last_str = SPIDER_SQL_CLOSE_PAREN_STR;
|
||||
last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
|
||||
break;
|
||||
|
@ -4008,23 +4027,28 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
DBUG_PRINT("info",("spider func_name = %s", func_name));
|
||||
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
|
||||
DBUG_PRINT("info",("spider separete_str = %s", separete_str));
|
||||
DBUG_PRINT("info",("spider separete_str_length = %d", separete_str_length));
|
||||
DBUG_PRINT("info",("spider separator_str = %s", separator_str));
|
||||
DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
|
||||
DBUG_PRINT("info",("spider last_str = %s", last_str));
|
||||
DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
|
||||
if (item_count)
|
||||
{
|
||||
/* Find the field in the list of items of the expression tree */
|
||||
field = spider_db_find_field_in_item_list(item_list,
|
||||
item_count, start_item,
|
||||
str,
|
||||
func_name, func_name_length);
|
||||
item_count--;
|
||||
for (roop_count = start_item; roop_count < item_count; roop_count++)
|
||||
{
|
||||
item = item_list[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (roop_count == 1)
|
||||
{
|
||||
func_name = separete_str;
|
||||
func_name_length = separete_str_length;
|
||||
func_name = separator_str;
|
||||
func_name_length = separator_str_length;
|
||||
}
|
||||
if (str)
|
||||
{
|
||||
|
@ -4036,7 +4060,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
}
|
||||
item = item_list[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -4050,7 +4074,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
|
||||
}
|
||||
item = item_list[0];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -4138,7 +4162,7 @@ int spider_db_oracle_util::open_item_sum_func(
|
|||
for (roop_count = 0; roop_count < item_count; roop_count++)
|
||||
{
|
||||
item = args[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
|
@ -4149,7 +4173,7 @@ int spider_db_oracle_util::open_item_sum_func(
|
|||
}
|
||||
}
|
||||
item = args[roop_count];
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -4209,8 +4233,11 @@ int spider_db_oracle_util::append_escaped_util(
|
|||
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int spider_db_oracle_util::append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
) {
|
||||
SPIDER_TABLE_HOLDER *table_holder;
|
||||
int error_num;
|
||||
|
@ -4745,7 +4772,7 @@ int spider_oracle_share::create_column_name_str()
|
|||
str->init_calc_mem(196);
|
||||
str->set_charset(spider_share->access_charset);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(str,
|
||||
(char *) (*field)->field_name.str, dbton_id)))
|
||||
(*field)->field_name, dbton_id)))
|
||||
goto error;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
@ -5188,6 +5215,10 @@ int spider_oracle_share::append_table_select()
|
|||
spider_string *str = table_select;
|
||||
TABLE_SHARE *table_share = spider_share->table_share;
|
||||
DBUG_ENTER("spider_oracle_share::append_table_select");
|
||||
|
||||
if (!*table_share->field)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
for (field = table_share->field; *field; field++)
|
||||
{
|
||||
field_length = column_name_str[(*field)->field_index].length();
|
||||
|
@ -5212,6 +5243,10 @@ int spider_oracle_share::append_key_select(
|
|||
TABLE_SHARE *table_share = spider_share->table_share;
|
||||
const KEY *key_info = &table_share->key_info[idx];
|
||||
DBUG_ENTER("spider_oracle_share::append_key_select");
|
||||
|
||||
if (!spider_user_defined_key_parts(key_info))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
for (key_part = key_info->key_part, part_num = 0;
|
||||
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
|
||||
{
|
||||
|
@ -6414,7 +6449,7 @@ int spider_oracle_handler::append_update_columns(
|
|||
{
|
||||
value = vi++;
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
(Item *) field, spider, str, alias, alias_length,
|
||||
(Item *) field, NULL, spider, str, alias, alias_length,
|
||||
spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
{
|
||||
if (
|
||||
|
@ -6432,8 +6467,8 @@ int spider_oracle_handler::append_update_columns(
|
|||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
(Item *) value, spider, str, alias, alias_length,
|
||||
spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
(Item *) value, ((Item_field *) field)->field, spider, str,
|
||||
alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (str)
|
||||
{
|
||||
|
@ -6834,7 +6869,7 @@ int spider_oracle_handler::check_item_type(
|
|||
int error_num;
|
||||
DBUG_ENTER("spider_oracle_handler::check_item_type");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
error_num = spider_db_print_item_type(item, spider, NULL, NULL, 0,
|
||||
error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
|
||||
spider_dbton_oracle.dbton_id, FALSE, NULL);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -7437,17 +7472,64 @@ int spider_oracle_handler::append_update_where(
|
|||
) {
|
||||
uint field_name_length;
|
||||
Field **field;
|
||||
THD *thd = spider->trx->thd;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
bool no_pk = (table->s->primary_key == MAX_KEY);
|
||||
DBUG_ENTER("spider_oracle_handler::append_update_where");
|
||||
uint str_len_bakup = str->length();
|
||||
if (str->reserve(SPIDER_SQL_WHERE_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
|
||||
for (field = table->field; *field; field++)
|
||||
{
|
||||
if (
|
||||
table->s->primary_key == MAX_KEY ||
|
||||
bitmap_is_set(table->read_set, (*field)->field_index)
|
||||
if (
|
||||
no_pk ||
|
||||
spider_param_use_cond_other_than_pk_for_update(thd)
|
||||
) {
|
||||
for (field = table->field; *field; field++)
|
||||
{
|
||||
if (
|
||||
no_pk ||
|
||||
bitmap_is_set(table->read_set, (*field)->field_index)
|
||||
) {
|
||||
field_name_length =
|
||||
oracle_share->column_name_str[(*field)->field_index].length();
|
||||
if ((*field)->is_null(ptr_diff))
|
||||
{
|
||||
if (str->reserve(field_name_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
|
||||
SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
oracle_share->append_column_name(str, (*field)->field_index);
|
||||
str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
|
||||
} else {
|
||||
if (str->reserve(field_name_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
|
||||
SPIDER_SQL_EQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
oracle_share->append_column_name(str, (*field)->field_index);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
(*field)->move_field_offset(ptr_diff);
|
||||
if (
|
||||
spider_db_oracle_utility.
|
||||
append_column_value(spider, str, *field, NULL,
|
||||
share->access_charset) ||
|
||||
str->reserve(SPIDER_SQL_AND_LEN)
|
||||
)
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
(*field)->move_field_offset(-ptr_diff);
|
||||
}
|
||||
str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
KEY *key_info = &table->key_info[table->s->primary_key];
|
||||
KEY_PART_INFO *key_part;
|
||||
uint part_num;
|
||||
for (
|
||||
key_part = key_info->key_part, part_num = 0;
|
||||
part_num < spider_user_defined_key_parts(key_info);
|
||||
key_part++, part_num++
|
||||
) {
|
||||
field = &key_part->field;
|
||||
field_name_length =
|
||||
oracle_share->column_name_str[(*field)->field_index].length();
|
||||
if ((*field)->is_null(ptr_diff))
|
||||
|
@ -7478,9 +7560,13 @@ int spider_oracle_handler::append_update_where(
|
|||
str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
|
||||
}
|
||||
}
|
||||
/*
|
||||
str->length(str->length() - SPIDER_SQL_AND_LEN);
|
||||
*/
|
||||
if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN)
|
||||
{
|
||||
/* no condition */
|
||||
str->length(str_len_bakup);
|
||||
} else {
|
||||
str->length(str->length() - SPIDER_SQL_AND_LEN);
|
||||
}
|
||||
if (str->reserve(SPIDER_SQL_LIMIT1_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LIMIT1_STR, SPIDER_SQL_LIMIT1_LEN);
|
||||
|
@ -7615,7 +7701,7 @@ int spider_oracle_handler::append_condition(
|
|||
}
|
||||
}
|
||||
if ((error_num = spider_db_print_item_type(
|
||||
(Item *) tmp_cond->cond, spider, str, alias, alias_length,
|
||||
(Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length,
|
||||
spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
{
|
||||
if (str && error_num == ER_SPIDER_COND_SKIP_NUM)
|
||||
|
@ -7937,8 +8023,8 @@ int spider_oracle_handler::append_group_by(
|
|||
str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
|
||||
for (; group; group = group->next)
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type((*group->item), spider, str,
|
||||
alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
if ((error_num = spider_db_print_item_type((*group->item), NULL, spider,
|
||||
str, alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -8276,8 +8362,8 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
|
|||
order = order->next)
|
||||
{
|
||||
if ((error_num =
|
||||
spider_db_print_item_type((*order->item), spider, &sql_part, alias,
|
||||
alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
spider_db_print_item_type((*order->item), NULL, spider, &sql_part,
|
||||
alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
{
|
||||
DBUG_PRINT("info",("spider error=%d", error_num));
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -8367,7 +8453,7 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
|
|||
order = order->next)
|
||||
{
|
||||
if ((error_num =
|
||||
spider_db_print_item_type((*order->item), spider, str, alias,
|
||||
spider_db_print_item_type((*order->item), NULL, spider, str, alias,
|
||||
alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
|
||||
{
|
||||
DBUG_PRINT("info",("spider error=%d", error_num));
|
||||
|
@ -10199,8 +10285,14 @@ int spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start()
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (!upd_tmp_tbl)
|
||||
{
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
|
||||
if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
|
||||
thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset())))
|
||||
#else
|
||||
if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
|
||||
thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset())))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -12454,6 +12546,8 @@ int spider_oracle_handler::append_from_and_tables_part(
|
|||
) {
|
||||
int error_num;
|
||||
spider_string *str;
|
||||
SPIDER_TABLE_HOLDER *table_holder;
|
||||
TABLE_LIST *table_list;
|
||||
DBUG_ENTER("spider_oracle_handler::append_from_and_tables_part");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
switch (sql_type)
|
||||
|
@ -12464,7 +12558,11 @@ int spider_oracle_handler::append_from_and_tables_part(
|
|||
default:
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
error_num = spider_db_oracle_utility.append_from_and_tables(fields, str);
|
||||
fields->set_pos_to_first_table_holder();
|
||||
table_holder = fields->get_next_table_holder();
|
||||
table_list = table_holder->table->pos_in_table_list;
|
||||
error_num = spider_db_oracle_utility.append_from_and_tables(fields, str,
|
||||
table_list);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
|
@ -12547,8 +12645,8 @@ int spider_oracle_handler::append_item_type_part(
|
|||
default:
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
error_num = spider_db_print_item_type(item, spider, str, alias, alias_length,
|
||||
spider_dbton_oracle.dbton_id, use_fields, fields);
|
||||
error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, spider_dbton_oracle.dbton_id, use_fields, fields);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
|
@ -12589,18 +12687,26 @@ int spider_oracle_handler::append_list_item_select(
|
|||
uint dbton_id = spider_dbton_oracle.dbton_id, length;
|
||||
List_iterator_fast<Item> it(*select);
|
||||
Item *item;
|
||||
Field **field_ptr;
|
||||
Field *field;
|
||||
const char *item_name;
|
||||
DBUG_ENTER("spider_oracle_handler::append_list_item_select");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
while ((item = it++))
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type(item, spider, str,
|
||||
if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
field_ptr = fields->get_next_field_ptr();
|
||||
length = strlen((*field_ptr)->field_name);
|
||||
field = *(fields->get_next_field_ptr());
|
||||
if (field)
|
||||
{
|
||||
item_name = SPIDER_field_name_str(field);
|
||||
length = SPIDER_field_name_length(field);
|
||||
} else {
|
||||
item_name = SPIDER_item_name_str(item);
|
||||
length = SPIDER_item_name_length(item);
|
||||
}
|
||||
if (str->reserve(
|
||||
SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
|
||||
SPIDER_SQL_SPACE_LEN + length
|
||||
|
@ -12608,7 +12714,7 @@ int spider_oracle_handler::append_list_item_select(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
|
||||
if ((error_num = spider_db_oracle_utility.append_name(str,
|
||||
(*field_ptr)->field_name, length)))
|
||||
item_name, length)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -12662,8 +12768,8 @@ int spider_oracle_handler::append_group_by(
|
|||
str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
|
||||
for (; order; order = order->next)
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type((*order->item), spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -12720,8 +12826,8 @@ int spider_oracle_handler::append_order_by(
|
|||
str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
|
||||
for (; order; order = order->next)
|
||||
{
|
||||
if ((error_num = spider_db_print_item_type((*order->item), spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields)))
|
||||
if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
@ -12831,7 +12937,7 @@ int spider_oracle_copy_table::append_table_columns(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql,
|
||||
(char *) (*field)->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
(*field)->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -12977,7 +13083,7 @@ int spider_oracle_copy_table::append_key_order_str(
|
|||
sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
|
||||
SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
|
||||
(char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
field->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (key_part->key_part_flag & HA_REVERSE_SORT)
|
||||
{
|
||||
|
@ -13011,7 +13117,7 @@ int spider_oracle_copy_table::append_key_order_str(
|
|||
sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
|
||||
SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
|
||||
(char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
field->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (key_part->key_part_flag & HA_REVERSE_SORT)
|
||||
{
|
||||
|
@ -13075,7 +13181,7 @@ int spider_oracle_copy_table::append_key_order_str(
|
|||
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
|
||||
SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql,
|
||||
(char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
field->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (key_part->key_part_flag & HA_REVERSE_SORT)
|
||||
{
|
||||
|
@ -13108,7 +13214,7 @@ int spider_oracle_copy_table::append_key_order_str(
|
|||
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
|
||||
SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql,
|
||||
(char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
field->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (key_part->key_part_flag & HA_REVERSE_SORT)
|
||||
{
|
||||
|
@ -13316,7 +13422,7 @@ int spider_oracle_copy_table::copy_key_row(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
|
||||
if ((error_num = spider_db_append_name_with_quote_str(&sql,
|
||||
(char *) field->field_name.str, spider_dbton_oracle.dbton_id)))
|
||||
field->field_name, spider_dbton_oracle.dbton_id)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length +
|
||||
SPIDER_SQL_AND_LEN))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,8 +13,6 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "tztime.h"
|
||||
|
||||
class spider_db_oracle;
|
||||
class spider_db_oracle_result;
|
||||
|
||||
|
@ -131,8 +129,11 @@ public:
|
|||
);
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int append_from_and_tables(
|
||||
ha_spider *spider,
|
||||
spider_fields *fields,
|
||||
spider_string *str
|
||||
spider_string *str,
|
||||
TABLE_LIST *table_list,
|
||||
uint table_count
|
||||
);
|
||||
int reappend_tables(
|
||||
spider_fields *fields,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "sql_partition.h"
|
||||
#include "sql_base.h"
|
||||
#include "sql_servers.h"
|
||||
#include "tztime.h"
|
||||
#endif
|
||||
#include "spd_err.h"
|
||||
#include "spd_param.h"
|
||||
|
@ -65,6 +66,9 @@ extern pthread_mutex_t spider_conn_id_mutex;
|
|||
extern pthread_mutex_t spider_ipport_conn_mutex;
|
||||
extern ulonglong spider_conn_id;
|
||||
|
||||
/* UTC time zone for timestamp columns */
|
||||
extern Time_zone *UTC;
|
||||
|
||||
uint spider_udf_calc_hash(
|
||||
char *key,
|
||||
uint mod
|
||||
|
@ -132,7 +136,7 @@ int spider_udf_direct_sql_create_table_list(
|
|||
&direct_sql->tables, sizeof(TABLE*) * table_count,
|
||||
&tmp_name_ptr, sizeof(char) * (
|
||||
table_name_list_length +
|
||||
thd->db.length * table_count +
|
||||
SPIDER_THD_db_length(thd) * table_count +
|
||||
2 * table_count
|
||||
),
|
||||
&direct_sql->iop, sizeof(int) * table_count,
|
||||
|
@ -163,11 +167,11 @@ int spider_udf_direct_sql_create_table_list(
|
|||
tmp_name_ptr += length + 1;
|
||||
tmp_ptr = tmp_ptr3 + 1;
|
||||
} else {
|
||||
if (thd->db.str)
|
||||
if (SPIDER_THD_db_str(thd))
|
||||
{
|
||||
memcpy(tmp_name_ptr, thd->db.str,
|
||||
thd->db.length + 1);
|
||||
tmp_name_ptr += thd->db.length + 1;
|
||||
memcpy(tmp_name_ptr, SPIDER_THD_db_str(thd),
|
||||
SPIDER_THD_db_length(thd) + 1);
|
||||
tmp_name_ptr += SPIDER_THD_db_length(thd) + 1;
|
||||
} else {
|
||||
direct_sql->db_names[roop_count] = (char *) "";
|
||||
}
|
||||
|
@ -395,6 +399,13 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
|
|||
int *need_mon;
|
||||
DBUG_ENTER("spider_udf_direct_sql_create_conn");
|
||||
|
||||
if (unlikely(!UTC))
|
||||
{
|
||||
/* UTC time zone for timestamp columns */
|
||||
String tz_00_name(STRING_WITH_LEN("+00:00"), &my_charset_bin);
|
||||
UTC = my_tz_find(current_thd, &tz_00_name);
|
||||
}
|
||||
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (direct_sql->access_mode == 0)
|
||||
{
|
||||
|
@ -976,8 +987,7 @@ error:
|
|||
start_ptr, TRUE, ¶m_string_parse))) \
|
||||
direct_sql->SPIDER_PARAM_STR_LEN(param_name) = \
|
||||
strlen(direct_sql->param_name); \
|
||||
else \
|
||||
{ \
|
||||
else { \
|
||||
error_num = param_string_parse.print_param_error(); \
|
||||
goto error; \
|
||||
} \
|
||||
|
@ -1330,10 +1340,10 @@ int spider_udf_set_direct_sql_param_default(
|
|||
if (!direct_sql->tgt_default_db_name)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default tgt_default_db_name"));
|
||||
direct_sql->tgt_default_db_name_length = trx->thd->db.length;
|
||||
direct_sql->tgt_default_db_name_length = SPIDER_THD_db_length(trx->thd);
|
||||
if (
|
||||
!(direct_sql->tgt_default_db_name = spider_create_string(
|
||||
trx->thd->db.str,
|
||||
SPIDER_THD_db_str(trx->thd),
|
||||
direct_sql->tgt_default_db_name_length))
|
||||
) {
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
|
||||
|
@ -1686,14 +1696,29 @@ long long spider_direct_sql_body(
|
|||
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
|
||||
{
|
||||
#ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
|
||||
LEX_CSTRING db_name= { direct_sql->db_names[roop_count],
|
||||
strlen(direct_sql->db_names[roop_count]) };
|
||||
LEX_CSTRING tbl_name= { direct_sql->table_names[roop_count],
|
||||
strlen(direct_sql->table_names[roop_count]) };
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
|
||||
LEX_CSTRING db_name =
|
||||
{
|
||||
direct_sql->db_names[roop_count],
|
||||
strlen(direct_sql->db_names[roop_count])
|
||||
};
|
||||
LEX_CSTRING tbl_name =
|
||||
{
|
||||
direct_sql->table_names[roop_count],
|
||||
strlen(direct_sql->table_names[roop_count])
|
||||
};
|
||||
table_list.init_one_table(&db_name, &tbl_name, 0, TL_WRITE);
|
||||
#else
|
||||
table_list.db = direct_sql->db_names[roop_count];
|
||||
table_list.table_name = direct_sql->table_names[roop_count];
|
||||
table_list.init_one_table(direct_sql->db_names[roop_count],
|
||||
strlen(direct_sql->db_names[roop_count]),
|
||||
direct_sql->table_names[roop_count],
|
||||
strlen(direct_sql->table_names[roop_count]),
|
||||
direct_sql->table_names[roop_count], TL_WRITE);
|
||||
#endif
|
||||
#else
|
||||
SPIDER_TABLE_LIST_db_str(&table_list) = direct_sql->db_names[roop_count];
|
||||
SPIDER_TABLE_LIST_table_name_str(&table_list) =
|
||||
direct_sql->table_names[roop_count];
|
||||
#endif
|
||||
if (!(direct_sql->tables[roop_count] =
|
||||
SPIDER_find_temporary_table(thd, &table_list)))
|
||||
|
@ -1706,16 +1731,28 @@ long long spider_direct_sql_body(
|
|||
error_num = ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM;
|
||||
my_printf_error(ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM,
|
||||
ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_STR,
|
||||
MYF(0), table_list.db.str, table_list.table_name.str);
|
||||
MYF(0), SPIDER_TABLE_LIST_db_str(&table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(&table_list));
|
||||
goto error;
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#else
|
||||
}
|
||||
TABLE_LIST *tables = &direct_sql->table_list[roop_count];
|
||||
|
||||
table_list.init_one_table(&table_list.db, &table_list.table_name, 0, TL_WRITE);
|
||||
tables->mdl_request.init(MDL_key::TABLE, table_list.db.str,
|
||||
table_list.table_name.str, MDL_SHARED_WRITE, MDL_TRANSACTION);
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
|
||||
table_list.init_one_table(
|
||||
&table_list.db, &table_list.table_name, 0, TL_WRITE);
|
||||
#else
|
||||
tables->init_one_table(
|
||||
SPIDER_TABLE_LIST_db_str(&table_list),
|
||||
SPIDER_TABLE_LIST_db_length(&table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(&table_list),
|
||||
SPIDER_TABLE_LIST_table_name_length(&table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(&table_list), TL_WRITE);
|
||||
#endif
|
||||
tables->mdl_request.init(MDL_key::TABLE,
|
||||
SPIDER_TABLE_LIST_db_str(&table_list),
|
||||
SPIDER_TABLE_LIST_table_name_str(&table_list),
|
||||
MDL_SHARED_WRITE, MDL_TRANSACTION);
|
||||
if (!direct_sql->table_list_first)
|
||||
{
|
||||
direct_sql->table_list_first = tables;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba & 2017 MariaDB corp
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba & 2017 MariaDB corp
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -37,4 +37,17 @@
|
|||
#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100300
|
||||
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100309
|
||||
#define SPIDER_MDEV_16246
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
|
||||
#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
|
||||
#define SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
#endif
|
||||
#endif /* SPD_ENVIRON_INCLUDED */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -172,6 +172,7 @@ int spider_fields::make_link_idx_chain(
|
|||
add_link_idx_holder->table_link_idx_holder =
|
||||
dup_link_idx_holder->table_link_idx_holder;
|
||||
add_link_idx_holder->link_idx = dup_link_idx_holder->link_idx;
|
||||
add_link_idx_holder->link_status = dup_link_idx_holder->link_status;
|
||||
link_idx_holder->next = add_link_idx_holder;
|
||||
}
|
||||
link_idx_holder = link_idx_holder->next;
|
||||
|
@ -446,6 +447,8 @@ bool spider_fields::check_link_ok_chain(
|
|||
for (current_link_idx_chain = first_link_idx_chain; current_link_idx_chain;
|
||||
current_link_idx_chain = current_link_idx_chain->next)
|
||||
{
|
||||
DBUG_PRINT("info",("spider current_link_idx_chain=%p", current_link_idx_chain));
|
||||
DBUG_PRINT("info",("spider current_link_idx_chain->link_status=%d", current_link_idx_chain->link_status));
|
||||
if (current_link_idx_chain->link_status == SPIDER_LINK_STATUS_OK)
|
||||
{
|
||||
first_ok_link_idx_chain = current_link_idx_chain;
|
||||
|
@ -924,8 +927,8 @@ SPIDER_TABLE_HOLDER *spider_fields::add_table(
|
|||
bool spider_fields::all_query_fields_are_query_table_members()
|
||||
{
|
||||
SPIDER_FIELD_HOLDER *field_holder;
|
||||
DBUG_ENTER("spider_fields::all_fields_are_query_table_fields");
|
||||
DBUG_PRINT("info", ("spider this=%p", this));
|
||||
DBUG_ENTER("spider_fields::all_query_fields_are_query_table_members");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
|
||||
set_pos_to_first_field_holder();
|
||||
while ((field_holder = get_next_field_holder()))
|
||||
|
@ -977,6 +980,25 @@ SPIDER_TABLE_HOLDER *spider_fields::get_next_table_holder(
|
|||
DBUG_RETURN(return_table_holder);
|
||||
}
|
||||
|
||||
SPIDER_TABLE_HOLDER *spider_fields::get_table_holder(TABLE *table)
|
||||
{
|
||||
uint table_num;
|
||||
DBUG_ENTER("spider_fields::get_table_holder");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
for (table_num = 0; table_num < table_count; ++table_num)
|
||||
{
|
||||
if (table_holder[table_num].table == table)
|
||||
DBUG_RETURN(&table_holder[table_num]);
|
||||
}
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
|
||||
uint spider_fields::get_table_count()
|
||||
{
|
||||
DBUG_ENTER("spider_fields::get_table_count");
|
||||
DBUG_RETURN(table_count);
|
||||
}
|
||||
|
||||
int spider_fields::add_field(
|
||||
Field *field_arg
|
||||
) {
|
||||
|
@ -1191,7 +1213,8 @@ int spider_group_by_handler::init_scan()
|
|||
*field;
|
||||
field++
|
||||
) {
|
||||
DBUG_PRINT("info",("spider field_name=%s", (*field)->field_name.str));
|
||||
DBUG_PRINT("info",("spider field_name=%s",
|
||||
SPIDER_field_name_str(*field)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1757,7 +1780,7 @@ group_by_handler *spider_create_group_by_handler(
|
|||
{
|
||||
DBUG_PRINT("info",("spider select item=%p", item));
|
||||
if (spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
|
||||
roop_count, TRUE, fields_arg))
|
||||
roop_count, TRUE, fields_arg))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create select", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
|
@ -1766,13 +1789,22 @@ group_by_handler *spider_create_group_by_handler(
|
|||
}
|
||||
}
|
||||
if (keep_going)
|
||||
{
|
||||
if (spider_dbton[roop_count].db_util->append_from_and_tables(
|
||||
spider, fields_arg, NULL, query->from, table_idx))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create from", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
keep_going = FALSE;
|
||||
}
|
||||
}
|
||||
if (keep_going)
|
||||
{
|
||||
DBUG_PRINT("info",("spider query->where=%p", query->where));
|
||||
if (query->where)
|
||||
{
|
||||
if (spider_db_print_item_type(query->where, NULL, spider, NULL,
|
||||
NULL, 0, roop_count,
|
||||
TRUE, fields_arg))
|
||||
if (spider_db_print_item_type(query->where, NULL, spider, NULL, NULL, 0,
|
||||
roop_count, TRUE, fields_arg))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create where", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
|
@ -1787,9 +1819,8 @@ group_by_handler *spider_create_group_by_handler(
|
|||
{
|
||||
for (order = query->group_by; order; order = order->next)
|
||||
{
|
||||
if (spider_db_print_item_type((*order->item), NULL, spider, NULL,
|
||||
NULL, 0, roop_count,
|
||||
TRUE, fields_arg))
|
||||
if (spider_db_print_item_type((*order->item), NULL, spider, NULL, NULL, 0,
|
||||
roop_count, TRUE, fields_arg))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create group by", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
|
@ -1806,9 +1837,8 @@ group_by_handler *spider_create_group_by_handler(
|
|||
{
|
||||
for (order = query->order_by; order; order = order->next)
|
||||
{
|
||||
if (spider_db_print_item_type((*order->item), NULL, spider, NULL,
|
||||
NULL, 0, roop_count,
|
||||
TRUE, fields_arg))
|
||||
if (spider_db_print_item_type((*order->item), NULL, spider, NULL, NULL, 0,
|
||||
roop_count, TRUE, fields_arg))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create order by", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
|
@ -1823,9 +1853,8 @@ group_by_handler *spider_create_group_by_handler(
|
|||
DBUG_PRINT("info",("spider query->having=%p", query->having));
|
||||
if (query->having)
|
||||
{
|
||||
if (spider_db_print_item_type(query->having, NULL, spider, NULL,
|
||||
NULL, 0, roop_count,
|
||||
TRUE, fields_arg))
|
||||
if (spider_db_print_item_type(query->having, NULL, spider, NULL, NULL, 0,
|
||||
roop_count, TRUE, fields_arg))
|
||||
{
|
||||
DBUG_PRINT("info",("spider dbton_id=%d can't create having", roop_count));
|
||||
spider_clear_bit(dbton_bitmap, roop_count);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -164,6 +164,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria =
|
|||
NULL,
|
||||
NULL,
|
||||
"1.0",
|
||||
MariaDB_PLUGIN_MATURITY_STABLE
|
||||
MariaDB_PLUGIN_MATURITY_STABLE,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,9 +13,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "tztime.h"
|
||||
|
||||
#define SPIDER_DETAIL_VERSION "3.3.13"
|
||||
#define SPIDER_DETAIL_VERSION "3.3.14"
|
||||
#define SPIDER_HEX_VERSION 0x0303
|
||||
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
|
@ -76,12 +74,21 @@
|
|||
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
|
||||
#define spider_join_table_count(A) (A)->table_count
|
||||
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
|
||||
#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
|
||||
#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
|
||||
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
|
||||
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
|
||||
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
|
||||
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
|
||||
#if MYSQL_VERSION_ID >= 100304
|
||||
#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
|
||||
#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
|
||||
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
|
||||
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
|
||||
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
|
||||
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
|
||||
#else
|
||||
#define SPIDER_ALTER_PARTITION_ADD Alter_info::ALTER_ADD_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_DROP Alter_info::ALTER_DROP_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_COALESCE Alter_info::ALTER_COALESCE_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_REORGANIZE Alter_info::ALTER_REORGANIZE_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_TABLE_REORG Alter_info::ALTER_TABLE_REORG
|
||||
#define SPIDER_ALTER_PARTITION_REBUILD Alter_info::ALTER_REBUILD_PARTITION
|
||||
#endif
|
||||
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
|
||||
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
|
||||
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
|
||||
|
@ -100,12 +107,12 @@
|
|||
#endif
|
||||
#define spider_user_defined_key_parts(A) (A)->key_parts
|
||||
#define spider_join_table_count(A) (A)->tables
|
||||
#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
|
||||
#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
|
||||
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
|
||||
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
|
||||
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
|
||||
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
|
||||
#define SPIDER_ALTER_PARTITION_ADD ALTER_ADD_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_DROP ALTER_DROP_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_COALESCE_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_REORGANIZE_PARTITION
|
||||
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_TABLE_REORG
|
||||
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_REBUILD_PARTITION
|
||||
#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
|
||||
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
|
||||
#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
|
||||
|
@ -182,10 +189,56 @@
|
|||
#define SPIDER_free_part_syntax(A,B) spider_my_free(A,B)
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100306
|
||||
#define SPIDER_read_record_read_record(A) read_record()
|
||||
#define SPIDER_has_Item_with_subquery
|
||||
#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name
|
||||
#define SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
#define SPIDER_use_LEX_CSTRING_for_database_tablename_alias
|
||||
#define SPIDER_THD_db_str(A) (A)->db.str
|
||||
#define SPIDER_THD_db_length(A) (A)->db.length
|
||||
#define SPIDER_TABLE_LIST_db_str(A) (A)->db.str
|
||||
#define SPIDER_TABLE_LIST_db_length(A) (A)->db.length
|
||||
#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name.str
|
||||
#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name.length
|
||||
#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias.str
|
||||
#define SPIDER_TABLE_LIST_alias_length(A) (A)->alias.length
|
||||
#define SPIDER_field_name_str(A) (A)->field_name.str
|
||||
#define SPIDER_field_name_length(A) (A)->field_name.length
|
||||
#define SPIDER_item_name_str(A) (A)->name.str
|
||||
#define SPIDER_item_name_length(A) (A)->name.length
|
||||
const LEX_CSTRING SPIDER_empty_string = {"", 0};
|
||||
#else
|
||||
#define SPIDER_read_record_read_record(A) read_record(A)
|
||||
#define SPIDER_THD_db_str(A) (A)->db
|
||||
#define SPIDER_THD_db_length(A) (A)->db_length
|
||||
#define SPIDER_TABLE_LIST_db_str(A) (A)->db
|
||||
#define SPIDER_TABLE_LIST_db_length(A) (A)->db_length
|
||||
#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name
|
||||
#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name_length
|
||||
#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias
|
||||
#define SPIDER_TABLE_LIST_alias_length(A) strlen((A)->alias)
|
||||
#define SPIDER_field_name_str(A) (A)->field_name
|
||||
#define SPIDER_field_name_length(A) strlen((A)->field_name)
|
||||
#define SPIDER_item_name_str(A) (A)->name
|
||||
#define SPIDER_item_name_length(A) strlen((A)->name)
|
||||
const char SPIDER_empty_string = "";
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID >= 50500
|
||||
#define SPIDER_HAS_HASH_VALUE_TYPE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
|
||||
#define SPIDER_date_mode_t(A) date_mode_t(A)
|
||||
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
|
||||
#define SPIDER_get_linkage(A) A->get_linkage()
|
||||
#else
|
||||
#define SPIDER_date_mode_t(A) A
|
||||
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime(A,B,C,D,E)
|
||||
#define SPIDER_get_linkage(A) A->linkage
|
||||
#endif
|
||||
|
||||
#define spider_bitmap_size(A) ((A + 7) / 8)
|
||||
#define spider_set_bit(BITMAP, BIT) \
|
||||
((BITMAP)[(BIT) / 8] |= (1 << ((BIT) & 7)))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -3123,6 +3123,30 @@ int spider_param_bka_table_name_type(
|
|||
bka_table_name_type : THDVAR(thd, bka_table_name_type));
|
||||
}
|
||||
|
||||
/*
|
||||
-1 :use table parameter
|
||||
0 :off
|
||||
1 :on
|
||||
*/
|
||||
static MYSQL_THDVAR_INT(
|
||||
use_cond_other_than_pk_for_update, /* name */
|
||||
PLUGIN_VAR_RQCMDARG, /* opt */
|
||||
"Use all conditions even if condition has pk", /* comment */
|
||||
NULL, /* check */
|
||||
NULL, /* update */
|
||||
1, /* def */
|
||||
0, /* min */
|
||||
1, /* max */
|
||||
0 /* blk */
|
||||
);
|
||||
|
||||
int spider_param_use_cond_other_than_pk_for_update(
|
||||
THD *thd
|
||||
) {
|
||||
DBUG_ENTER("spider_param_reset_sql_alloc");
|
||||
DBUG_RETURN(THDVAR(thd, use_cond_other_than_pk_for_update));
|
||||
}
|
||||
|
||||
static int spider_store_last_sts;
|
||||
/*
|
||||
-1 : use table parameter
|
||||
|
@ -3421,6 +3445,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
|
|||
MYSQL_SYSVAR(dry_access),
|
||||
MYSQL_SYSVAR(delete_all_rows_type),
|
||||
MYSQL_SYSVAR(bka_table_name_type),
|
||||
MYSQL_SYSVAR(use_cond_other_than_pk_for_update),
|
||||
MYSQL_SYSVAR(connect_error_interval),
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
MYSQL_SYSVAR(table_sts_thread_count),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software); you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -397,6 +397,9 @@ int spider_param_bka_table_name_type(
|
|||
THD *thd,
|
||||
int bka_table_name_type
|
||||
);
|
||||
int spider_param_use_cond_other_than_pk_for_update(
|
||||
THD *thd
|
||||
);
|
||||
int spider_param_store_last_sts(
|
||||
int store_last_sts
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -38,7 +38,6 @@
|
|||
|
||||
extern handlerton *spider_hton_ptr;
|
||||
extern Time_zone *spd_tz_system;
|
||||
static const LEX_CSTRING empty_clex_string= {"", 0};
|
||||
|
||||
/**
|
||||
Insert a Spider system table row.
|
||||
|
@ -155,15 +154,30 @@ TABLE *spider_open_sys_table(
|
|||
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
memset(&tables, 0, sizeof(TABLE_LIST));
|
||||
tables.db = (char*)"mysql";
|
||||
tables.db_length = sizeof("mysql") - 1;
|
||||
tables.alias = tables.table_name = (char *) table_name;
|
||||
tables.table_name_length = table_name_length;
|
||||
SPIDER_TABLE_LIST_db_str(&tables) = (char*)"mysql";
|
||||
SPIDER_TABLE_LIST_db_length(&tables) = sizeof("mysql") - 1;
|
||||
SPIDER_TABLE_LIST_alias_str(&tables) =
|
||||
SPIDER_TABLE_LIST_table_name_str(&tables) = (char *) table_name;
|
||||
SPIDER_TABLE_LIST_table_name_length(&tables) = table_name_length;
|
||||
tables.lock_type = (write ? TL_WRITE : TL_READ);
|
||||
#else
|
||||
LEX_CSTRING db_name= { "mysql", sizeof("mysql") - 1 };
|
||||
LEX_CSTRING tbl_name= { table_name, (size_t) table_name_length };
|
||||
tables.init_one_table( &db_name, &tbl_name, 0, (write ? TL_WRITE : TL_READ));
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
|
||||
LEX_CSTRING db_name =
|
||||
{
|
||||
"mysql",
|
||||
sizeof("mysql") - 1
|
||||
};
|
||||
LEX_CSTRING tbl_name =
|
||||
{
|
||||
table_name,
|
||||
(size_t) table_name_length
|
||||
};
|
||||
tables.init_one_table(&db_name, &tbl_name, 0, (write ? TL_WRITE : TL_READ));
|
||||
#else
|
||||
tables.init_one_table(
|
||||
"mysql", sizeof("mysql") - 1, table_name, table_name_length, table_name,
|
||||
(write ? TL_WRITE : TL_READ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
|
@ -371,14 +385,15 @@ TABLE *spider_sys_open_table(
|
|||
TABLE *table;
|
||||
ulonglong utime_after_lock_backup = thd->utime_after_lock;
|
||||
DBUG_ENTER("spider_sys_open_table");
|
||||
thd->reset_n_backup_open_tables_state(open_tables_backup);
|
||||
if (open_tables_backup)
|
||||
thd->reset_n_backup_open_tables_state(open_tables_backup);
|
||||
if ((table = open_ltable(thd, tables, tables->lock_type,
|
||||
MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK | MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
|
||||
MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_LOCK_LOG_TABLE
|
||||
))) {
|
||||
table->use_all_columns();
|
||||
table->s->no_replicate = 1;
|
||||
} else
|
||||
} else if (open_tables_backup)
|
||||
thd->restore_backup_open_tables_state(open_tables_backup);
|
||||
thd->utime_after_lock = utime_after_lock_backup;
|
||||
DBUG_RETURN(table);
|
||||
|
@ -504,7 +519,7 @@ int spider_get_sys_table_by_idx(
|
|||
) {
|
||||
int error_num;
|
||||
uint key_length;
|
||||
KEY *key_info = table->key_info;
|
||||
KEY *key_info = table->key_info + idx;
|
||||
DBUG_ENTER("spider_get_sys_table_by_idx");
|
||||
if ((error_num = spider_sys_index_init(table, idx, FALSE)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -595,6 +610,28 @@ int spider_sys_index_first(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_sys_index_last(
|
||||
TABLE *table,
|
||||
const int idx
|
||||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_sys_index_last");
|
||||
if ((error_num = spider_sys_index_init(table, idx, FALSE)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
||||
if (
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
|
||||
(error_num = table->file->ha_index_last(table->record[0]))
|
||||
#else
|
||||
(error_num = table->file->index_last(table->record[0]))
|
||||
#endif
|
||||
) {
|
||||
spider_sys_index_end(table);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_sys_index_next(
|
||||
TABLE *table
|
||||
) {
|
||||
|
@ -1262,7 +1299,9 @@ int spider_insert_xa(
|
|||
spider_store_xa_bqual_length(table, xid);
|
||||
spider_store_xa_status(table, status);
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
} else {
|
||||
my_message(ER_SPIDER_XA_EXISTS_NUM, ER_SPIDER_XA_EXISTS_STR, MYF(0));
|
||||
DBUG_RETURN(ER_SPIDER_XA_EXISTS_NUM);
|
||||
|
@ -1293,7 +1332,9 @@ int spider_insert_xa_member(
|
|||
table->use_all_columns();
|
||||
spider_store_xa_member_info(table, xid, conn);
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
} else {
|
||||
my_message(ER_SPIDER_XA_MEMBER_EXISTS_NUM, ER_SPIDER_XA_MEMBER_EXISTS_STR,
|
||||
MYF(0));
|
||||
|
@ -1324,7 +1365,9 @@ int spider_insert_tables(
|
|||
share->alter_table.tmp_link_statuses[roop_count] :
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
@ -1335,9 +1378,8 @@ int spider_insert_sys_table(
|
|||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_insert_sys_table");
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
DBUG_RETURN(error_num);
|
||||
DBUG_RETURN(0);
|
||||
error_num = spider_write_sys_table_row(table);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
int spider_insert_or_update_table_sts(
|
||||
|
@ -1378,7 +1420,9 @@ int spider_insert_or_update_table_sts(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
} else {
|
||||
if ((error_num = spider_update_sys_table_row(table, FALSE)))
|
||||
{
|
||||
|
@ -1415,7 +1459,9 @@ int spider_insert_or_update_table_crd(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
} else {
|
||||
if ((error_num = spider_update_sys_table_row(table, FALSE)))
|
||||
{
|
||||
|
@ -1444,7 +1490,9 @@ int spider_log_tables_link_failed(
|
|||
table->timestamp_field->set_time();
|
||||
#endif
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1479,7 +1527,9 @@ int spider_log_xa_failed(
|
|||
table->timestamp_field->set_time();
|
||||
#endif
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1509,7 +1559,9 @@ int spider_update_xa(
|
|||
table->use_all_columns();
|
||||
spider_store_xa_status(table, status);
|
||||
if ((error_num = spider_update_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
@ -1543,7 +1595,9 @@ int spider_update_tables_name(
|
|||
table->use_all_columns();
|
||||
spider_store_tables_name(table, to, strlen(to));
|
||||
if ((error_num = spider_update_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
roop_count++;
|
||||
}
|
||||
|
@ -1588,7 +1642,9 @@ int spider_update_tables_priority(
|
|||
alter_table->tmp_link_statuses[roop_count] :
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
if ((error_num = spider_write_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
roop_count++;
|
||||
} while (roop_count < (int) alter_table->all_link_count);
|
||||
DBUG_RETURN(0);
|
||||
|
@ -1605,7 +1661,9 @@ int spider_update_tables_priority(
|
|||
spider_store_tables_link_status(table,
|
||||
alter_table->tmp_link_statuses[roop_count]);
|
||||
if ((error_num = spider_update_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (TRUE)
|
||||
|
@ -1624,7 +1682,9 @@ int spider_update_tables_priority(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if ((error_num = spider_delete_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
roop_count++;
|
||||
}
|
||||
|
@ -1661,12 +1721,23 @@ int spider_update_tables_link_status(
|
|||
table->use_all_columns();
|
||||
spider_store_tables_link_status(table, link_status);
|
||||
if ((error_num = spider_update_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_update_sys_table(
|
||||
TABLE *table
|
||||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_update_sys_table");
|
||||
error_num = spider_update_sys_table_row(table);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
int spider_delete_xa(
|
||||
TABLE *table,
|
||||
XID *xid
|
||||
|
@ -1689,7 +1760,9 @@ int spider_delete_xa(
|
|||
DBUG_RETURN(ER_SPIDER_XA_NOT_EXISTS_NUM);
|
||||
} else {
|
||||
if ((error_num = spider_delete_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
@ -1752,7 +1825,9 @@ int spider_delete_tables(
|
|||
break;
|
||||
else {
|
||||
if ((error_num = spider_delete_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
roop_count++;
|
||||
}
|
||||
|
@ -1783,7 +1858,9 @@ int spider_delete_table_sts(
|
|||
DBUG_RETURN(0);
|
||||
} else {
|
||||
if ((error_num = spider_delete_sys_table_row(table)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
@ -2386,7 +2463,7 @@ void spider_get_sys_table_sts_info(
|
|||
*index_file_length = (ulonglong) table->field[4]->val_int();
|
||||
*records = (ha_rows) table->field[5]->val_int();
|
||||
*mean_rec_length = (ulong) table->field[6]->val_int();
|
||||
table->field[7]->get_date(&mysql_time, 0);
|
||||
table->field[7]->get_date(&mysql_time, SPIDER_date_mode_t(0));
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
*check_time = (time_t) my_system_gmt_sec(&mysql_time,
|
||||
¬_used_long, ¬_used_uint);
|
||||
|
@ -2394,7 +2471,7 @@ void spider_get_sys_table_sts_info(
|
|||
*check_time = (time_t) my_system_gmt_sec(&mysql_time,
|
||||
¬_used_long, ¬_used_my_bool);
|
||||
#endif
|
||||
table->field[8]->get_date(&mysql_time, 0);
|
||||
table->field[8]->get_date(&mysql_time, SPIDER_date_mode_t(0));
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
*create_time = (time_t) my_system_gmt_sec(&mysql_time,
|
||||
¬_used_long, ¬_used_uint);
|
||||
|
@ -2402,7 +2479,7 @@ void spider_get_sys_table_sts_info(
|
|||
*create_time = (time_t) my_system_gmt_sec(&mysql_time,
|
||||
¬_used_long, ¬_used_my_bool);
|
||||
#endif
|
||||
table->field[9]->get_date(&mysql_time, 0);
|
||||
table->field[9]->get_date(&mysql_time, SPIDER_date_mode_t(0));
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
*update_time = (time_t) my_system_gmt_sec(&mysql_time,
|
||||
¬_used_long, ¬_used_uint);
|
||||
|
@ -3207,27 +3284,37 @@ error:
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
TABLE *spider_mk_sys_tmp_table(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
TMP_TABLE_PARAM *tmp_tbl_prm,
|
||||
const LEX_CSTRING *field_name,
|
||||
CHARSET_INFO *cs
|
||||
)
|
||||
#else
|
||||
TABLE *spider_mk_sys_tmp_table(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
TMP_TABLE_PARAM *tmp_tbl_prm,
|
||||
const char *field_name,
|
||||
CHARSET_INFO *cs
|
||||
) {
|
||||
)
|
||||
#endif
|
||||
{
|
||||
Field_blob *field;
|
||||
Item_field *i_field;
|
||||
List<Item> i_list;
|
||||
TABLE *tmp_table;
|
||||
LEX_CSTRING name= { field_name, strlen(field_name) };
|
||||
DBUG_ENTER("spider_mk_sys_tmp_table");
|
||||
|
||||
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
||||
if (!(field = new (thd->mem_root) Field_blob(
|
||||
(uint32) 4294967295U, FALSE, &name, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name, cs, TRUE)))
|
||||
goto error_alloc_field;
|
||||
#else
|
||||
if (!(field = new Field_blob(
|
||||
4294967295U, FALSE, &name, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name, cs, TRUE)))
|
||||
goto error_alloc_field;
|
||||
#endif
|
||||
field->init(table);
|
||||
|
@ -3245,7 +3332,7 @@ TABLE *spider_mk_sys_tmp_table(
|
|||
|
||||
if (!(tmp_table = create_tmp_table(thd, tmp_tbl_prm,
|
||||
i_list, (ORDER*) NULL, FALSE, FALSE, TMP_TABLE_FORCE_MYISAM,
|
||||
HA_POS_ERROR, &empty_clex_string)))
|
||||
HA_POS_ERROR, &SPIDER_empty_string)))
|
||||
goto error_create_tmp_table;
|
||||
DBUG_RETURN(tmp_table);
|
||||
|
||||
|
@ -3270,6 +3357,17 @@ void spider_rm_sys_tmp_table(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
TMP_TABLE_PARAM *tmp_tbl_prm,
|
||||
const LEX_CSTRING *field_name1,
|
||||
const LEX_CSTRING *field_name2,
|
||||
const LEX_CSTRING *field_name3,
|
||||
CHARSET_INFO *cs
|
||||
)
|
||||
#else
|
||||
TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
|
@ -3278,23 +3376,22 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
|||
const char *field_name2,
|
||||
const char *field_name3,
|
||||
CHARSET_INFO *cs
|
||||
) {
|
||||
)
|
||||
#endif
|
||||
{
|
||||
Field_blob *field1, *field2, *field3;
|
||||
Item_field *i_field1, *i_field2, *i_field3;
|
||||
List<Item> i_list;
|
||||
TABLE *tmp_table;
|
||||
LEX_CSTRING name1= { field_name1, strlen(field_name1) };
|
||||
LEX_CSTRING name2= { field_name2, strlen(field_name2) };
|
||||
LEX_CSTRING name3= { field_name3, strlen(field_name3) };
|
||||
DBUG_ENTER("spider_mk_sys_tmp_table_for_result");
|
||||
|
||||
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
||||
if (!(field1 = new (thd->mem_root) Field_blob(
|
||||
(uint32) 4294967295U, FALSE, &name1, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name1, cs, TRUE)))
|
||||
goto error_alloc_field1;
|
||||
#else
|
||||
if (!(field1 = new Field_blob(
|
||||
4294967295U, FALSE, &name1, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name1, cs, TRUE)))
|
||||
goto error_alloc_field1;
|
||||
#endif
|
||||
field1->init(table);
|
||||
|
@ -3312,11 +3409,11 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
|||
|
||||
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
||||
if (!(field2 = new (thd->mem_root) Field_blob(
|
||||
4294967295U, FALSE, &name2, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name2, cs, TRUE)))
|
||||
goto error_alloc_field2;
|
||||
#else
|
||||
if (!(field2 = new Field_blob(
|
||||
4294967295U, FALSE, &name2, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name2, cs, TRUE)))
|
||||
goto error_alloc_field2;
|
||||
#endif
|
||||
field2->init(table);
|
||||
|
@ -3334,7 +3431,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
|||
|
||||
#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
|
||||
if (!(field3 = new (thd->mem_root) Field_blob(
|
||||
4294967295U, FALSE, &name3, cs, TRUE)))
|
||||
4294967295U, FALSE, field_name3, cs, TRUE)))
|
||||
goto error_alloc_field3;
|
||||
#else
|
||||
if (!(field3 = new Field_blob(
|
||||
|
@ -3356,7 +3453,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
|||
|
||||
if (!(tmp_table = create_tmp_table(thd, tmp_tbl_prm,
|
||||
i_list, (ORDER*) NULL, FALSE, FALSE, TMP_TABLE_FORCE_MYISAM,
|
||||
HA_POS_ERROR, &empty_clex_string)))
|
||||
HA_POS_ERROR, &SPIDER_empty_string)))
|
||||
goto error_create_tmp_table;
|
||||
DBUG_RETURN(tmp_table);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2016 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -173,6 +173,11 @@ int spider_sys_index_first(
|
|||
const int idx
|
||||
);
|
||||
|
||||
int spider_sys_index_last(
|
||||
TABLE *table,
|
||||
const int idx
|
||||
);
|
||||
|
||||
int spider_sys_index_next(
|
||||
TABLE *table
|
||||
);
|
||||
|
@ -386,6 +391,10 @@ int spider_update_tables_link_status(
|
|||
long link_status
|
||||
);
|
||||
|
||||
int spider_update_sys_table(
|
||||
TABLE *table
|
||||
);
|
||||
|
||||
int spider_delete_xa(
|
||||
TABLE *table,
|
||||
XID *xid
|
||||
|
@ -618,6 +627,15 @@ int spider_sys_replace(
|
|||
bool *modified_non_trans_table
|
||||
);
|
||||
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
TABLE *spider_mk_sys_tmp_table(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
TMP_TABLE_PARAM *tmp_tbl_prm,
|
||||
const LEX_CSTRING *field_name,
|
||||
CHARSET_INFO *cs
|
||||
);
|
||||
#else
|
||||
TABLE *spider_mk_sys_tmp_table(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
|
@ -625,6 +643,7 @@ TABLE *spider_mk_sys_tmp_table(
|
|||
const char *field_name,
|
||||
CHARSET_INFO *cs
|
||||
);
|
||||
#endif
|
||||
|
||||
void spider_rm_sys_tmp_table(
|
||||
THD *thd,
|
||||
|
@ -632,6 +651,17 @@ void spider_rm_sys_tmp_table(
|
|||
TMP_TABLE_PARAM *tmp_tbl_prm
|
||||
);
|
||||
|
||||
#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
|
||||
TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
TMP_TABLE_PARAM *tmp_tbl_prm,
|
||||
const LEX_CSTRING *field_name1,
|
||||
const LEX_CSTRING *field_name2,
|
||||
const LEX_CSTRING *field_name3,
|
||||
CHARSET_INFO *cs
|
||||
);
|
||||
#else
|
||||
TABLE *spider_mk_sys_tmp_table_for_result(
|
||||
THD *thd,
|
||||
TABLE *table,
|
||||
|
@ -641,6 +671,7 @@ TABLE *spider_mk_sys_tmp_table_for_result(
|
|||
const char *field_name3,
|
||||
CHARSET_INFO *cs
|
||||
);
|
||||
#endif
|
||||
|
||||
void spider_rm_sys_tmp_table_for_result(
|
||||
THD *thd,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1721,8 +1721,7 @@ int st_spider_param_string_parse::print_param_error()
|
|||
if ((share->param_name = spider_get_string_between_quote( \
|
||||
start_ptr, TRUE, &connect_string_parse))) \
|
||||
share->SPIDER_PARAM_STR_LEN(param_name) = strlen(share->param_name); \
|
||||
else \
|
||||
{ \
|
||||
else { \
|
||||
error_num = connect_string_parse.print_param_error(); \
|
||||
goto error; \
|
||||
} \
|
||||
|
@ -5219,15 +5218,20 @@ SPIDER_SHARE *spider_get_share(
|
|||
}
|
||||
if (!share->link_status_init)
|
||||
{
|
||||
if (
|
||||
(
|
||||
table_share->tmp_table == NO_TMP_TABLE &&
|
||||
sql_command != SQLCOM_DROP_TABLE &&
|
||||
sql_command != SQLCOM_SHOW_CREATE
|
||||
) ||
|
||||
/* for alter change link status */
|
||||
sql_command == SQLCOM_ALTER_TABLE
|
||||
) {
|
||||
/*
|
||||
The link statuses need to be refreshed from the spider_tables table
|
||||
if the operation:
|
||||
- Is not a DROP TABLE on a permanent table; or
|
||||
- Is an ALTER TABLE.
|
||||
|
||||
Note that SHOW CREATE TABLE is not excluded, because the commands
|
||||
that follow it require up-to-date link statuses.
|
||||
*/
|
||||
if ((table_share->tmp_table == NO_TMP_TABLE &&
|
||||
sql_command != SQLCOM_DROP_TABLE) ||
|
||||
/* for alter change link status */
|
||||
sql_command == SQLCOM_ALTER_TABLE)
|
||||
{
|
||||
SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME));
|
||||
init_mem_root = TRUE;
|
||||
if (
|
||||
|
@ -8965,7 +8969,9 @@ bool spider_check_direct_order_limit(
|
|||
int spider_set_direct_limit_offset(
|
||||
ha_spider *spider
|
||||
) {
|
||||
#ifndef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
|
||||
THD *thd = spider->trx->thd;
|
||||
#endif
|
||||
st_select_lex *select_lex;
|
||||
longlong select_limit;
|
||||
longlong offset_limit;
|
||||
|
@ -9037,7 +9043,11 @@ int spider_set_direct_limit_offset(
|
|||
DBUG_RETURN(FALSE);
|
||||
|
||||
// ignore condition like 1=1
|
||||
#ifdef SPIDER_has_Item_with_subquery
|
||||
if (select_lex->where && select_lex->where->with_subquery())
|
||||
#else
|
||||
if (select_lex->where && select_lex->where->with_subselect)
|
||||
#endif
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
if (
|
||||
|
@ -9049,7 +9059,7 @@ int spider_set_direct_limit_offset(
|
|||
DBUG_RETURN(FALSE);
|
||||
|
||||
// must not be derived table
|
||||
if (&thd->lex->select_lex != select_lex)
|
||||
if (SPIDER_get_linkage(select_lex) == DERIVED_TABLE_TYPE)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
spider->direct_select_offset = offset_limit;
|
||||
|
@ -9491,7 +9501,8 @@ int spider_discover_table_structure(
|
|||
uint collatelen = strlen(table_charset->name);
|
||||
if (str.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_DEFAULT_CHARSET_LEN +
|
||||
csnamelen + SPIDER_SQL_COLLATE_LEN + collatelen +
|
||||
SPIDER_SQL_CONNECTION_LEN + SPIDER_SQL_VALUE_QUOTE_LEN
|
||||
SPIDER_SQL_CONNECTION_LEN + SPIDER_SQL_VALUE_QUOTE_LEN +
|
||||
(share->comment.length * 2)
|
||||
)) {
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -9504,7 +9515,8 @@ int spider_discover_table_structure(
|
|||
str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
str.append_escape_string(share->comment.str, share->comment.length);
|
||||
if (str.reserve(SPIDER_SQL_CONNECTION_LEN +
|
||||
(SPIDER_SQL_VALUE_QUOTE_LEN * 2)))
|
||||
(SPIDER_SQL_VALUE_QUOTE_LEN * 2) +
|
||||
(share->connect_string.length * 2)))
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2017 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2018 Kentoku Shiba
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +26,6 @@
|
|||
#include "sql_class.h"
|
||||
#include "sql_partition.h"
|
||||
#include "records.h"
|
||||
#include "tztime.h"
|
||||
#endif
|
||||
#include "spd_err.h"
|
||||
#include "spd_param.h"
|
||||
|
@ -1648,9 +1647,7 @@ int spider_check_and_set_sql_log_off(
|
|||
if (internal_sql_log_off)
|
||||
{
|
||||
spider_conn_queue_sql_log_off(conn, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
spider_conn_queue_sql_log_off(conn, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -2764,7 +2761,8 @@ int spider_initinal_xa_recover(
|
|||
FALSE, FALSE);
|
||||
}
|
||||
SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME));
|
||||
while ((!(read_record->read_record())) && cnt < (int) len)
|
||||
while ((!(read_record->SPIDER_read_record_read_record(read_record))) &&
|
||||
cnt < (int) len)
|
||||
{
|
||||
spider_get_sys_xid(table_xa, &xid_list[cnt], &mem_root);
|
||||
cnt++;
|
||||
|
@ -2813,7 +2811,7 @@ int spider_internal_xa_commit_by_xid(
|
|||
SPIDER_TRX *trx,
|
||||
XID* xid
|
||||
) {
|
||||
TABLE *table_xa, *table_xa_member= 0;
|
||||
TABLE *table_xa, *table_xa_member = 0;
|
||||
int error_num;
|
||||
char xa_key[MAX_KEY_LENGTH];
|
||||
char xa_member_key[MAX_KEY_LENGTH];
|
||||
|
@ -3048,7 +3046,7 @@ int spider_internal_xa_rollback_by_xid(
|
|||
SPIDER_TRX *trx,
|
||||
XID* xid
|
||||
) {
|
||||
TABLE *table_xa, *table_xa_member= 0;
|
||||
TABLE *table_xa, *table_xa_member = 0;
|
||||
int error_num;
|
||||
char xa_key[MAX_KEY_LENGTH];
|
||||
char xa_member_key[MAX_KEY_LENGTH];
|
||||
|
|
Loading…
Reference in a new issue