summaryrefslogtreecommitdiffstats
path: root/storage/spider/spd_db_conn.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/spider/spd_db_conn.cc')
-rw-r--r--storage/spider/spd_db_conn.cc80
1 files changed, 40 insertions, 40 deletions
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index a541a5db..16d5b836 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -250,7 +250,7 @@ int spider_db_conn_queue_action(
spider_string sql_str(sql_buf, sizeof(sql_buf), system_charset_info);
DBUG_ENTER("spider_db_conn_queue_action");
DBUG_PRINT("info", ("spider conn=%p", conn));
- sql_str.init_calc_mem(106);
+ sql_str.init_calc_mem(SPD_MID_DB_CONN_QUEUE_ACTION_1);
sql_str.length(0);
if (conn->queued_connect)
{
@@ -651,7 +651,7 @@ int spider_db_query(
DBUG_RETURN(error_num);
#ifndef DBUG_OFF
spider_string tmp_query_str(sizeof(char) * (length + 1));
- tmp_query_str.init_calc_mem(107);
+ tmp_query_str.init_calc_mem(SPD_MID_DB_QUERY_1);
char *tmp_query = (char *) tmp_query_str.c_ptr_safe();
memcpy(tmp_query, query, length);
tmp_query[length] = '\0';
@@ -2174,7 +2174,7 @@ int spider_db_fetch_for_item_sum_func(
{
if (!spider->direct_aggregate_item_first)
{
- if (!spider_bulk_malloc(spider_current_trx, 240, MYF(MY_WME),
+ if (!spider_bulk_malloc(spider_current_trx, SPD_MID_DB_FETCH_FOR_ITEM_SUM_FUNC_1, MYF(MY_WME),
&spider->direct_aggregate_item_first,
(uint) (sizeof(SPIDER_ITEM_HLD)),
NullS)
@@ -2191,7 +2191,7 @@ int spider_db_fetch_for_item_sum_func(
} else {
if (!spider->direct_aggregate_item_current->next)
{
- if (!spider_bulk_malloc(spider_current_trx, 241, MYF(MY_WME),
+ if (!spider_bulk_malloc(spider_current_trx, SPD_MID_DB_FETCH_FOR_ITEM_SUM_FUNC_2, MYF(MY_WME),
&spider->direct_aggregate_item_current->next,
(uint) (sizeof(SPIDER_ITEM_HLD)), NullS)
) {
@@ -2235,7 +2235,7 @@ int spider_db_fetch_for_item_sum_func(
} else {
char buf[MAX_FIELD_WIDTH];
spider_string tmp_str(buf, MAX_FIELD_WIDTH, share->access_charset);
- tmp_str.init_calc_mem(242);
+ tmp_str.init_calc_mem(SPD_MID_DB_FETCH_FOR_ITEM_SUM_FUNC_3);
tmp_str.length(0);
if ((error_num = row->append_to_str(&tmp_str)))
DBUG_RETURN(error_num);
@@ -3089,7 +3089,7 @@ int spider_db_store_result(
if (!result_list->first)
{
if (!(result_list->first = (SPIDER_RESULT *)
- spider_malloc(spider_current_trx, 4, sizeof(*result_list->first),
+ spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_1, sizeof(*result_list->first),
MYF(MY_WME | MY_ZEROFILL)))
) {
if (!conn->mta_conn_mutex_unlock_later)
@@ -3119,7 +3119,7 @@ int spider_db_store_result(
if (result_list->bgs_current == result_list->last)
{
if (!(result_list->last = (SPIDER_RESULT *)
- spider_malloc(spider_current_trx, 5, sizeof(*result_list->last),
+ spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_2, sizeof(*result_list->last),
MYF(MY_WME | MY_ZEROFILL)))
) {
if (!conn->mta_conn_mutex_unlock_later)
@@ -3162,7 +3162,7 @@ int spider_db_store_result(
if (result_list->current == result_list->last)
{
if (!(result_list->last = (SPIDER_RESULT *)
- spider_malloc(spider_current_trx, 6, sizeof(*result_list->last),
+ spider_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_3, sizeof(*result_list->last),
MYF(MY_WME | MY_ZEROFILL)))
) {
if (!conn->mta_conn_mutex_unlock_later)
@@ -3373,7 +3373,7 @@ int spider_db_store_result(
}
current->field_count = field_count;
if (!(position = (SPIDER_POSITION *)
- spider_bulk_malloc(spider_current_trx, 7, MYF(MY_WME | MY_ZEROFILL),
+ spider_bulk_malloc(spider_current_trx, SPD_MID_DB_STORE_RESULT_4, MYF(MY_WME | MY_ZEROFILL),
&position, (uint) (sizeof(SPIDER_POSITION) * page_size),
&tmp_row, (uint) (sizeof(SPIDER_DB_ROW) * field_count),
NullS))
@@ -3436,7 +3436,7 @@ int spider_db_store_result(
THD *thd = current_thd;
char buf[MAX_FIELD_WIDTH];
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
- tmp_str.init_calc_mem(120);
+ tmp_str.init_calc_mem(SPD_MID_DB_STORE_RESULT_5);
DBUG_PRINT("info",("spider store result to temporary table"));
DBUG_ASSERT(!current->result_tmp_tbl);
@@ -3797,7 +3797,7 @@ int spider_db_store_result_for_reuse_cursor(
THD *thd = current_thd;
char buf[MAX_FIELD_WIDTH];
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
- tmp_str.init_calc_mem(120);
+ tmp_str.init_calc_mem(SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_1);
DBUG_PRINT("info",("spider store result to temporary table"));
DBUG_ASSERT(!current->result_tmp_tbl);
@@ -6537,7 +6537,7 @@ int spider_db_delete_all_rows(
spider->conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
- uint dbton_id = share->use_sql_dbton_ids[roop_count];
+ uint dbton_id = share->sql_dbton_ids[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id];
conn = spider->conns[roop_count];
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
@@ -7468,19 +7468,20 @@ int spider_db_open_item_ident(
} else {
if (str)
{
- SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain();
- SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder;
- spider = field_holder->spider;
+ SPIDER_TABLE_HOLDER *table= fields->find_table(field);
+ /* If table or table->spider is NULL the GBH creation
+ would have been skipped the first pass (see below). */
+ spider = table->spider;
share = spider->share;
if ((error_num = share->dbton_share[dbton_id]->
append_column_name_with_alias(str, field->field_index,
- field_holder->alias->ptr(), field_holder->alias->length())))
+ table->alias->ptr(), table->alias->length())))
DBUG_RETURN(error_num);
- } else {
- if ((error_num = fields->add_field(field)))
- {
- DBUG_RETURN(error_num);
- }
+ } else
+ {
+ SPIDER_TABLE_HOLDER *table= fields->find_table(field);
+ if (!table || !table->spider)
+ DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
}
}
}
@@ -7583,21 +7584,20 @@ int spider_db_open_item_field(
} else {
if (str)
{
- SPIDER_FIELD_CHAIN *field_chain = fields->get_next_field_chain();
- SPIDER_FIELD_HOLDER *field_holder = field_chain->field_holder;
- spider = field_holder->spider;
+ SPIDER_TABLE_HOLDER *table= fields->find_table(field);
+ /* If table or table->spider is NULL the GBH creation
+ would have been skipped the first pass (see below). */
+ spider = table->spider;
share = spider->share;
- field = spider->field_exchange(field);
- DBUG_ASSERT(field);
if ((error_num = share->dbton_share[dbton_id]->
append_column_name_with_alias(str, field->field_index,
- field_holder->alias->ptr(), field_holder->alias->length())))
+ table->alias->ptr(), table->alias->length())))
DBUG_RETURN(error_num);
- } else {
- if ((error_num = fields->add_field(field)))
- {
- DBUG_RETURN(error_num);
- }
+ } else
+ {
+ SPIDER_TABLE_HOLDER *table= fields->find_table(field);
+ if (!table || !table->spider)
+ DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
}
DBUG_RETURN(0);
}
@@ -7740,7 +7740,7 @@ int spider_db_open_item_string(
char tmp_buf[MAX_FIELD_WIDTH];
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
String *tmp_str2;
- tmp_str.init_calc_mem(126);
+ tmp_str.init_calc_mem(SPD_MID_DB_OPEN_ITEM_STRING_1);
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
{
@@ -7859,7 +7859,7 @@ int spider_db_open_item_int(
char tmp_buf[MAX_FIELD_WIDTH];
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
String *tmp_str2;
- tmp_str.init_calc_mem(127);
+ tmp_str.init_calc_mem(SPD_MID_DB_OPEN_ITEM_INT_1);
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
{
@@ -8909,8 +8909,8 @@ int spider_db_udf_ping_table(
system_charset_info);
spider_string where_str(where_buf, sizeof(where_buf),
system_charset_info);
- sql_str.init_calc_mem(128);
- where_str.init_calc_mem(129);
+ sql_str.init_calc_mem(SPD_MID_DB_UDF_PING_TABLE_1);
+ where_str.init_calc_mem(SPD_MID_DB_UDF_PING_TABLE_2);
sql_str.length(0);
where_str.length(0);
if (
@@ -9020,8 +9020,8 @@ int spider_db_udf_ping_table_append_mon_next(
spider_string where_clause_str(where_clause ? where_clause : "",
where_clause_length + 1, str->charset());
DBUG_ENTER("spider_db_udf_ping_table_append_mon_next");
- child_table_name_str.init_calc_mem(130);
- where_clause_str.init_calc_mem(131);
+ child_table_name_str.init_calc_mem(SPD_MID_DB_UDF_PING_TABLE_APPEND_MON_NEXT_1);
+ where_clause_str.init_calc_mem(SPD_MID_DB_UDF_PING_TABLE_APPEND_MON_NEXT_2);
child_table_name_str.length(child_table_name_length);
where_clause_str.length(where_clause_length);
limit_str_length = my_sprintf(limit_str, (limit_str, "%lld", limit));
@@ -9174,7 +9174,7 @@ int spider_db_udf_ping_table_mon_next(
}
spider_string sql_str(sql_buf, sizeof(sql_buf),
thd->variables.character_set_client);
- sql_str.init_calc_mem(132);
+ sql_str.init_calc_mem(SPD_MID_DB_UDF_PING_TABLE_MON_NEXT_1);
sql_str.length(0);
trx.thd = thd;
spider.share = share;
@@ -9328,7 +9328,7 @@ int spider_db_udf_copy_tables(
KEY *key_info = &table->key_info[table->s->primary_key];
DBUG_ENTER("spider_db_udf_copy_tables");
if (!(last_row_pos = (ulong *)
- spider_bulk_malloc(spider_current_trx, 30, MYF(MY_WME),
+ spider_bulk_malloc(spider_current_trx, SPD_MID_DB_UDF_COPY_TABLES_1, MYF(MY_WME),
&last_row_pos, (uint) (sizeof(ulong) * table->s->fields),
&last_lengths, (uint) (sizeof(ulong) * table->s->fields),
NullS))