diff options
author | Kentoku SHIBA <kentokushiba@gmail.com> | 2014-03-25 04:26:48 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2014-03-25 04:26:48 +0900 |
commit | ad54787d55831bc4921526467e4f1e7d3a52ea19 (patch) | |
tree | ce6c1f6c9cd95e9a6b08919a4bb380ba7326e2e2 /storage/spider/spd_db_oracle.cc | |
parent | b5ebf1e29bd253672e2c3fa8f7ce7e0416fdf48c (diff) | |
download | mariadb-git-ad54787d55831bc4921526467e4f1e7d3a52ea19.tar.gz |
append group by for no order by
Diffstat (limited to 'storage/spider/spd_db_oracle.cc')
-rw-r--r-- | storage/spider/spd_db_oracle.cc | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 9bb4b3db874..7a4ff1decaa 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -5047,14 +5047,24 @@ int spider_oracle_handler::append_tmp_table_and_sql_for_bka( table_dot_aliases, table_dot_alias_lengths)) || (error_num = append_condition_part( SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN, - SPIDER_SQL_TYPE_SELECT_SQL, FALSE)) || - ( - spider->result_list.direct_order_limit && - (error_num = append_key_order_for_direct_order_limit_with_alias(&sql, - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)) - ) + SPIDER_SQL_TYPE_SELECT_SQL, FALSE)) ) DBUG_RETURN(error_num); + if (spider->result_list.direct_order_limit) + { + if ((error_num = append_key_order_for_direct_order_limit_with_alias(&sql, + SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) + DBUG_RETURN(error_num); + } +#ifdef HANDLER_HAS_DIRECT_AGGREGATE + else if (spider->result_list.direct_aggregate) + { + if ((error_num = + append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) + DBUG_RETURN(error_num); + } +#endif + DBUG_RETURN(0); } @@ -5257,14 +5267,24 @@ int spider_oracle_handler::append_union_table_and_sql_for_bka( table_dot_aliases, table_dot_alias_lengths)) || (error_num = append_condition_part( SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN, - SPIDER_SQL_TYPE_TMP_SQL, FALSE)) || - ( - spider->result_list.direct_order_limit && - (error_num = append_key_order_for_direct_order_limit_with_alias(&tmp_sql, - SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)) - ) + SPIDER_SQL_TYPE_TMP_SQL, FALSE)) ) DBUG_RETURN(error_num); + if (spider->result_list.direct_order_limit) + { + if ((error_num = append_key_order_for_direct_order_limit_with_alias( + &tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) + DBUG_RETURN(error_num); + } +#ifdef HANDLER_HAS_DIRECT_AGGREGATE + else if (spider->result_list.direct_aggregate) + { + if ((error_num = + append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN))) + DBUG_RETURN(error_num); + } +#endif + DBUG_RETURN(0); } @@ -7272,6 +7292,37 @@ void spider_oracle_handler::set_order_to_pos( } #ifdef HANDLER_HAS_DIRECT_AGGREGATE +int spider_oracle_handler::append_group_by_part( + const char *alias, + uint alias_length, + ulong sql_type +) { + int error_num; + spider_string *str; + DBUG_ENTER("spider_oracle_handler::append_group_by_part"); + DBUG_PRINT("info",("spider this=%p", this)); + switch (sql_type) + { + case SPIDER_SQL_TYPE_SELECT_SQL: + case SPIDER_SQL_TYPE_TMP_SQL: + str = &sql; + break; + case SPIDER_SQL_TYPE_INSERT_SQL: + case SPIDER_SQL_TYPE_UPDATE_SQL: + case SPIDER_SQL_TYPE_DELETE_SQL: + case SPIDER_SQL_TYPE_BULK_UPDATE_SQL: + str = &update_sql; + break; + case SPIDER_SQL_TYPE_HANDLER: + str = &ha_sql; + break; + default: + DBUG_RETURN(0); + } + error_num = append_group_by(str, alias, alias_length); + DBUG_RETURN(error_num); +} + int spider_oracle_handler::append_group_by( spider_string *str, const char *alias, |