summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-01-01 16:25:48 +0100
committerSergei Golubchik <serg@mariadb.org>2022-01-26 18:43:06 +0100
commitf00236ac230ebc48cd30fb72166fc1106141c365 (patch)
tree7e9d034b204eb2a7516bc55acb7e8582a585ce3d
parent820aa11ef161ad5e72e71c7ea56b5ad776dbe4ed (diff)
downloadmariadb-git-f00236ac230ebc48cd30fb72166fc1106141c365.tar.gz
cleanup: FederatedX
-rw-r--r--storage/federatedx/ha_federatedx.cc40
-rw-r--r--storage/federatedx/ha_federatedx.h3
2 files changed, 16 insertions, 27 deletions
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 99513d70950..e18a3cfd854 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -1218,7 +1218,6 @@ bool ha_federatedx::create_where_from_key(String *to,
KEY *key_info,
const key_range *start_key,
const key_range *end_key,
- bool from_records_in_range,
bool eq_range)
{
bool both_not_null=
@@ -1239,7 +1238,6 @@ bool ha_federatedx::create_where_from_key(String *to,
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
for (uint i= 0; i <= 1; i++)
{
- bool needs_quotes;
KEY_PART_INFO *key_part;
if (ranges[i] == NULL)
continue;
@@ -1262,7 +1260,11 @@ bool ha_federatedx::create_where_from_key(String *to,
Field *field= key_part->field;
uint store_length= key_part->store_length;
uint part_length= MY_MIN(store_length, length);
- needs_quotes= field->str_needs_quotes();
+ bool needs_quotes= field->str_needs_quotes();
+ static const LEX_CSTRING lt={STRING_WITH_LEN(" < ") };
+ static const LEX_CSTRING gt={STRING_WITH_LEN(" > ") };
+ static const LEX_CSTRING le={STRING_WITH_LEN(" <= ") };
+ static const LEX_CSTRING ge={STRING_WITH_LEN(" >= ") };
DBUG_DUMP("key, start of loop", ptr, length);
if (key_part->null_bit)
@@ -1304,16 +1306,8 @@ bool ha_federatedx::create_where_from_key(String *to,
if (emit_key_part_name(&tmp, key_part))
goto err;
- if (from_records_in_range)
- {
- if (tmp.append(STRING_WITH_LEN(" >= ")))
- goto err;
- }
- else
- {
- if (tmp.append(STRING_WITH_LEN(" = ")))
- goto err;
- }
+ if (tmp.append(STRING_WITH_LEN(" = ")))
+ goto err;
if (emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
part_length))
@@ -1344,12 +1338,12 @@ bool ha_federatedx::create_where_from_key(String *to,
if (i > 0) /* end key */
{
- if (tmp.append(STRING_WITH_LEN(" <= ")))
+ if (tmp.append(le))
goto err;
}
else /* start key */
{
- if (tmp.append(STRING_WITH_LEN(" > ")))
+ if (tmp.append(gt))
goto err;
}
@@ -1364,7 +1358,7 @@ bool ha_federatedx::create_where_from_key(String *to,
case HA_READ_KEY_OR_NEXT:
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_NEXT %d", i));
if (emit_key_part_name(&tmp, key_part) ||
- tmp.append(STRING_WITH_LEN(" >= ")) ||
+ tmp.append(ge) ||
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
part_length))
goto err;
@@ -1374,7 +1368,7 @@ bool ha_federatedx::create_where_from_key(String *to,
if (store_length >= length)
{
if (emit_key_part_name(&tmp, key_part) ||
- tmp.append(STRING_WITH_LEN(" < ")) ||
+ tmp.append(lt) ||
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
part_length))
goto err;
@@ -1384,7 +1378,7 @@ bool ha_federatedx::create_where_from_key(String *to,
case HA_READ_KEY_OR_PREV:
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_PREV %d", i));
if (emit_key_part_name(&tmp, key_part) ||
- tmp.append(STRING_WITH_LEN(" <= ")) ||
+ tmp.append(le) ||
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
part_length))
goto err;
@@ -2639,10 +2633,7 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
range.key= key;
range.length= key_len;
range.flag= find_flag;
- create_where_from_key(&index_string,
- &table->key_info[index],
- &range,
- NULL, 0, 0);
+ create_where_from_key(&index_string, &table->key_info[index], &range, 0, 0);
sql_query.append(index_string);
if ((retval= txn->acquire(share, ha_thd(), TRUE, &io)))
@@ -2721,9 +2712,8 @@ int ha_federatedx::read_range_first(const key_range *start_key,
sql_query.length(0);
sql_query.append(share->select_query);
- create_where_from_key(&sql_query,
- &table->key_info[active_index],
- start_key, end_key, 0, eq_range_arg);
+ create_where_from_key(&sql_query, &table->key_info[active_index],
+ start_key, end_key, eq_range_arg);
if ((retval= txn->acquire(share, ha_thd(), TRUE, &io)))
DBUG_RETURN(retval);
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index 665cb303fba..344afc449d8 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -291,8 +291,7 @@ private:
FEDERATEDX_IO_RESULT *result);
bool create_where_from_key(String *to, KEY *key_info,
const key_range *start_key,
- const key_range *end_key,
- bool records_in_range, bool eq_range);
+ const key_range *end_key, bool eq_range);
int stash_remote_error();
static federatedx_txn *get_txn(THD *thd, bool no_create= FALSE);