mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
[Spider] Add add checking default_value for default_file, host, port
This commit is contained in:
@@ -141,21 +141,42 @@ bool spider_db_util::tables_on_different_db_are_joinable()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::tables_on_different_db_are_joinable");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::socket_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::socket_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::database_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::database_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::default_file_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::default_file_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::host_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::host_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::port_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_util::port_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
bool spider_db_util::append_charset_name_before_string()
|
||||
|
@@ -961,6 +961,9 @@ public:
|
||||
virtual bool tables_on_different_db_are_joinable();
|
||||
virtual bool socket_has_default_value();
|
||||
virtual bool database_has_default_value();
|
||||
virtual bool default_file_has_default_value();
|
||||
virtual bool host_has_default_value();
|
||||
virtual bool port_has_default_value();
|
||||
virtual bool append_charset_name_before_string();
|
||||
virtual uint limit_mode();
|
||||
};
|
||||
|
@@ -7280,6 +7280,48 @@ int spider_db_mbase_util::append_having(
|
||||
}
|
||||
#endif
|
||||
|
||||
bool spider_db_mbase_util::tables_on_different_db_are_joinable()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::tables_on_different_db_are_joinable");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::socket_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::socket_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::database_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::database_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::default_file_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::default_file_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::host_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::host_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::port_has_default_value()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::port_has_default_value");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
bool spider_db_mbase_util::append_charset_name_before_string()
|
||||
{
|
||||
DBUG_ENTER("spider_db_mbase_util::append_charset_name_before_string");
|
||||
|
@@ -199,6 +199,12 @@ public:
|
||||
spider_string *str
|
||||
);
|
||||
#endif
|
||||
bool tables_on_different_db_are_joinable();
|
||||
bool socket_has_default_value();
|
||||
bool database_has_default_value();
|
||||
bool default_file_has_default_value();
|
||||
bool host_has_default_value();
|
||||
bool port_has_default_value();
|
||||
bool append_charset_name_before_string();
|
||||
};
|
||||
|
||||
|
@@ -313,8 +313,14 @@ int spider_udf_direct_sql_create_conn_key(
|
||||
*direct_sql->conn_key = '0' + direct_sql->connection_channel;
|
||||
DBUG_PRINT("info",("spider tgt_wrapper=%s", direct_sql->tgt_wrapper));
|
||||
tmp_name = strmov(direct_sql->conn_key + 1, direct_sql->tgt_wrapper);
|
||||
DBUG_PRINT("info",("spider tgt_host=%s", direct_sql->tgt_host));
|
||||
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_host);
|
||||
if (direct_sql->tgt_host)
|
||||
{
|
||||
DBUG_PRINT("info",("spider tgt_host=%s", direct_sql->tgt_host));
|
||||
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_host);
|
||||
} else {
|
||||
DBUG_PRINT("info",("spider tgt_host=NULL"));
|
||||
tmp_name++;
|
||||
}
|
||||
my_sprintf(port_str, (port_str, "%05ld", direct_sql->tgt_port));
|
||||
DBUG_PRINT("info",("spider port_str=%s", port_str));
|
||||
tmp_name = strmov(tmp_name + 1, port_str);
|
||||
@@ -1429,8 +1435,14 @@ int spider_udf_set_direct_sql_param_default(
|
||||
) {
|
||||
bool check_socket;
|
||||
bool check_database;
|
||||
bool check_default_file;
|
||||
bool check_host;
|
||||
bool check_port;
|
||||
bool socket_has_default_value;
|
||||
bool database_has_default_value;
|
||||
bool default_file_has_default_value;
|
||||
bool host_has_default_value;
|
||||
bool port_has_default_value;
|
||||
int error_num, roop_count;
|
||||
DBUG_ENTER("spider_udf_set_direct_sql_param_default");
|
||||
if (direct_sql->server_name)
|
||||
@@ -1456,10 +1468,35 @@ int spider_udf_set_direct_sql_param_default(
|
||||
} else {
|
||||
check_database = FALSE;
|
||||
}
|
||||
if (check_socket || check_database)
|
||||
if (
|
||||
!direct_sql->tgt_default_file &&
|
||||
direct_sql->tgt_default_group &&
|
||||
(*spd_defaults_file || *spd_defaults_extra_file)
|
||||
) {
|
||||
check_default_file = TRUE;
|
||||
} else {
|
||||
check_default_file = FALSE;
|
||||
}
|
||||
if (!direct_sql->tgt_host)
|
||||
{
|
||||
check_host = TRUE;
|
||||
} else {
|
||||
check_host = FALSE;
|
||||
}
|
||||
if (direct_sql->tgt_port == -1)
|
||||
{
|
||||
check_port = TRUE;
|
||||
} else {
|
||||
check_port = FALSE;
|
||||
}
|
||||
if (check_socket || check_database || check_default_file || check_host ||
|
||||
check_port)
|
||||
{
|
||||
socket_has_default_value = check_socket;
|
||||
database_has_default_value = check_database;
|
||||
default_file_has_default_value = check_default_file;
|
||||
host_has_default_value = check_host;
|
||||
port_has_default_value = check_port;
|
||||
if (direct_sql->tgt_wrapper)
|
||||
{
|
||||
for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; roop_count++)
|
||||
@@ -1487,6 +1524,21 @@ int spider_udf_set_direct_sql_param_default(
|
||||
database_has_default_value = spider_dbton[roop_count].
|
||||
db_util->database_has_default_value();
|
||||
}
|
||||
if (check_default_file)
|
||||
{
|
||||
default_file_has_default_value = spider_dbton[roop_count].
|
||||
db_util->default_file_has_default_value();
|
||||
}
|
||||
if (check_host)
|
||||
{
|
||||
host_has_default_value = spider_dbton[roop_count].
|
||||
db_util->host_has_default_value();
|
||||
}
|
||||
if (check_port)
|
||||
{
|
||||
port_has_default_value = spider_dbton[roop_count].
|
||||
db_util->port_has_default_value();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1495,6 +1547,9 @@ int spider_udf_set_direct_sql_param_default(
|
||||
} else {
|
||||
socket_has_default_value = FALSE;
|
||||
database_has_default_value = FALSE;
|
||||
default_file_has_default_value = FALSE;
|
||||
host_has_default_value = FALSE;
|
||||
port_has_default_value = FALSE;
|
||||
}
|
||||
|
||||
if (database_has_default_value)
|
||||
@@ -1525,7 +1580,7 @@ int spider_udf_set_direct_sql_param_default(
|
||||
}
|
||||
}
|
||||
|
||||
if (!direct_sql->tgt_host)
|
||||
if (host_has_default_value)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default tgt_host"));
|
||||
direct_sql->tgt_host_length = strlen(my_localhost);
|
||||
@@ -1539,11 +1594,8 @@ int spider_udf_set_direct_sql_param_default(
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!direct_sql->tgt_default_file &&
|
||||
direct_sql->tgt_default_group &&
|
||||
(*spd_defaults_file || *spd_defaults_extra_file)
|
||||
) {
|
||||
if (default_file_has_default_value)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default tgt_default_file"));
|
||||
if (*spd_defaults_extra_file)
|
||||
{
|
||||
@@ -1574,7 +1626,7 @@ int spider_udf_set_direct_sql_param_default(
|
||||
direct_sql->access_mode = 0;
|
||||
#endif
|
||||
|
||||
if (direct_sql->tgt_port == -1)
|
||||
if (port_has_default_value)
|
||||
{
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (direct_sql->access_mode == 1)
|
||||
|
@@ -3730,8 +3730,14 @@ int spider_set_connect_info_default(
|
||||
) {
|
||||
bool check_socket;
|
||||
bool check_database;
|
||||
bool check_default_file;
|
||||
bool check_host;
|
||||
bool check_port;
|
||||
bool socket_has_default_value;
|
||||
bool database_has_default_value;
|
||||
bool default_file_has_default_value;
|
||||
bool host_has_default_value;
|
||||
bool port_has_default_value;
|
||||
int error_num, roop_count, roop_count2;
|
||||
DBUG_ENTER("spider_set_connect_info_default");
|
||||
for (roop_count = 0; roop_count < (int) share->all_link_count; roop_count++)
|
||||
@@ -3759,10 +3765,35 @@ int spider_set_connect_info_default(
|
||||
} else {
|
||||
check_database = FALSE;
|
||||
}
|
||||
if (check_socket || check_database)
|
||||
if (
|
||||
!share->tgt_default_files[roop_count] &&
|
||||
share->tgt_default_groups[roop_count] &&
|
||||
(*spd_defaults_file || *spd_defaults_extra_file)
|
||||
) {
|
||||
check_default_file = TRUE;
|
||||
} else {
|
||||
check_default_file = FALSE;
|
||||
}
|
||||
if (!share->tgt_hosts[roop_count])
|
||||
{
|
||||
check_host = TRUE;
|
||||
} else {
|
||||
check_host = FALSE;
|
||||
}
|
||||
if (share->tgt_ports[roop_count] == -1)
|
||||
{
|
||||
check_port = TRUE;
|
||||
} else {
|
||||
check_port = FALSE;
|
||||
}
|
||||
if (check_socket || check_database || check_default_file || check_host ||
|
||||
check_port)
|
||||
{
|
||||
socket_has_default_value = check_socket;
|
||||
database_has_default_value = check_database;
|
||||
default_file_has_default_value = check_default_file;
|
||||
host_has_default_value = check_host;
|
||||
port_has_default_value = check_port;
|
||||
if (share->tgt_wrappers[roop_count])
|
||||
{
|
||||
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; roop_count2++)
|
||||
@@ -3790,6 +3821,21 @@ int spider_set_connect_info_default(
|
||||
database_has_default_value = spider_dbton[roop_count2].
|
||||
db_util->database_has_default_value();
|
||||
}
|
||||
if (check_default_file)
|
||||
{
|
||||
default_file_has_default_value = spider_dbton[roop_count2].
|
||||
db_util->default_file_has_default_value();
|
||||
}
|
||||
if (check_host)
|
||||
{
|
||||
host_has_default_value = spider_dbton[roop_count2].
|
||||
db_util->host_has_default_value();
|
||||
}
|
||||
if (check_port)
|
||||
{
|
||||
port_has_default_value = spider_dbton[roop_count2].
|
||||
db_util->port_has_default_value();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3798,6 +3844,9 @@ int spider_set_connect_info_default(
|
||||
} else {
|
||||
socket_has_default_value = FALSE;
|
||||
database_has_default_value = FALSE;
|
||||
default_file_has_default_value = FALSE;
|
||||
host_has_default_value = FALSE;
|
||||
port_has_default_value = FALSE;
|
||||
}
|
||||
|
||||
if (!share->tgt_wrappers[roop_count])
|
||||
@@ -3813,7 +3862,7 @@ int spider_set_connect_info_default(
|
||||
}
|
||||
}
|
||||
|
||||
if (!share->tgt_hosts[roop_count])
|
||||
if (host_has_default_value)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default tgt_hosts"));
|
||||
share->tgt_hosts_lengths[roop_count] = strlen(my_localhost);
|
||||
@@ -3859,11 +3908,8 @@ int spider_set_connect_info_default(
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!share->tgt_default_files[roop_count] &&
|
||||
share->tgt_default_groups[roop_count] &&
|
||||
(*spd_defaults_file || *spd_defaults_extra_file)
|
||||
) {
|
||||
if (default_file_has_default_value)
|
||||
{
|
||||
DBUG_PRINT("info",("spider create default tgt_default_files"));
|
||||
if (*spd_defaults_extra_file)
|
||||
{
|
||||
@@ -3934,7 +3980,7 @@ int spider_set_connect_info_default(
|
||||
}
|
||||
*/
|
||||
|
||||
if (share->tgt_ports[roop_count] == -1)
|
||||
if (port_has_default_value)
|
||||
{
|
||||
share->tgt_ports[roop_count] = MYSQL_PORT;
|
||||
} else if (share->tgt_ports[roop_count] < 0)
|
||||
@@ -4562,9 +4608,14 @@ int spider_create_conn_keys(
|
||||
DBUG_PRINT("info",("spider tgt_wrappers[%d]=%s", roop_count,
|
||||
share->tgt_wrappers[roop_count]));
|
||||
tmp_name = strmov(tmp_name + 1, share->tgt_wrappers[roop_count]);
|
||||
DBUG_PRINT("info",("spider tgt_hosts[%d]=%s", roop_count,
|
||||
share->tgt_hosts[roop_count]));
|
||||
tmp_name = strmov(tmp_name + 1, share->tgt_hosts[roop_count]);
|
||||
if (share->tgt_hosts[roop_count])
|
||||
{
|
||||
DBUG_PRINT("info",("spider tgt_hosts[%d]=%s", roop_count,
|
||||
share->tgt_hosts[roop_count]));
|
||||
tmp_name = strmov(tmp_name + 1, share->tgt_hosts[roop_count]);
|
||||
} else {
|
||||
tmp_name++;
|
||||
}
|
||||
my_sprintf(port_str, (port_str, "%05ld", share->tgt_ports[roop_count]));
|
||||
DBUG_PRINT("info",("spider port_str=%s", port_str));
|
||||
tmp_name = strmov(tmp_name + 1, port_str);
|
||||
|
Reference in New Issue
Block a user