Skip to content

Commit f00236a

Browse files
committed
cleanup: FederatedX
1 parent 820aa11 commit f00236a

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

storage/federatedx/ha_federatedx.cc

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,6 @@ bool ha_federatedx::create_where_from_key(String *to,
12181218
KEY *key_info,
12191219
const key_range *start_key,
12201220
const key_range *end_key,
1221-
bool from_records_in_range,
12221221
bool eq_range)
12231222
{
12241223
bool both_not_null=
@@ -1239,7 +1238,6 @@ bool ha_federatedx::create_where_from_key(String *to,
12391238
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
12401239
for (uint i= 0; i <= 1; i++)
12411240
{
1242-
bool needs_quotes;
12431241
KEY_PART_INFO *key_part;
12441242
if (ranges[i] == NULL)
12451243
continue;
@@ -1262,7 +1260,11 @@ bool ha_federatedx::create_where_from_key(String *to,
12621260
Field *field= key_part->field;
12631261
uint store_length= key_part->store_length;
12641262
uint part_length= MY_MIN(store_length, length);
1265-
needs_quotes= field->str_needs_quotes();
1263+
bool needs_quotes= field->str_needs_quotes();
1264+
static const LEX_CSTRING lt={STRING_WITH_LEN(" < ") };
1265+
static const LEX_CSTRING gt={STRING_WITH_LEN(" > ") };
1266+
static const LEX_CSTRING le={STRING_WITH_LEN(" <= ") };
1267+
static const LEX_CSTRING ge={STRING_WITH_LEN(" >= ") };
12661268
DBUG_DUMP("key, start of loop", ptr, length);
12671269

12681270
if (key_part->null_bit)
@@ -1304,16 +1306,8 @@ bool ha_federatedx::create_where_from_key(String *to,
13041306
if (emit_key_part_name(&tmp, key_part))
13051307
goto err;
13061308

1307-
if (from_records_in_range)
1308-
{
1309-
if (tmp.append(STRING_WITH_LEN(" >= ")))
1310-
goto err;
1311-
}
1312-
else
1313-
{
1314-
if (tmp.append(STRING_WITH_LEN(" = ")))
1315-
goto err;
1316-
}
1309+
if (tmp.append(STRING_WITH_LEN(" = ")))
1310+
goto err;
13171311

13181312
if (emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
13191313
part_length))
@@ -1344,12 +1338,12 @@ bool ha_federatedx::create_where_from_key(String *to,
13441338

13451339
if (i > 0) /* end key */
13461340
{
1347-
if (tmp.append(STRING_WITH_LEN(" <= ")))
1341+
if (tmp.append(le))
13481342
goto err;
13491343
}
13501344
else /* start key */
13511345
{
1352-
if (tmp.append(STRING_WITH_LEN(" > ")))
1346+
if (tmp.append(gt))
13531347
goto err;
13541348
}
13551349

@@ -1364,7 +1358,7 @@ bool ha_federatedx::create_where_from_key(String *to,
13641358
case HA_READ_KEY_OR_NEXT:
13651359
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_NEXT %d", i));
13661360
if (emit_key_part_name(&tmp, key_part) ||
1367-
tmp.append(STRING_WITH_LEN(" >= ")) ||
1361+
tmp.append(ge) ||
13681362
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
13691363
part_length))
13701364
goto err;
@@ -1374,7 +1368,7 @@ bool ha_federatedx::create_where_from_key(String *to,
13741368
if (store_length >= length)
13751369
{
13761370
if (emit_key_part_name(&tmp, key_part) ||
1377-
tmp.append(STRING_WITH_LEN(" < ")) ||
1371+
tmp.append(lt) ||
13781372
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
13791373
part_length))
13801374
goto err;
@@ -1384,7 +1378,7 @@ bool ha_federatedx::create_where_from_key(String *to,
13841378
case HA_READ_KEY_OR_PREV:
13851379
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_PREV %d", i));
13861380
if (emit_key_part_name(&tmp, key_part) ||
1387-
tmp.append(STRING_WITH_LEN(" <= ")) ||
1381+
tmp.append(le) ||
13881382
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
13891383
part_length))
13901384
goto err;
@@ -2639,10 +2633,7 @@ int ha_federatedx::index_read_idx_with_result_set(uchar *buf, uint index,
26392633
range.key= key;
26402634
range.length= key_len;
26412635
range.flag= find_flag;
2642-
create_where_from_key(&index_string,
2643-
&table->key_info[index],
2644-
&range,
2645-
NULL, 0, 0);
2636+
create_where_from_key(&index_string, &table->key_info[index], &range, 0, 0);
26462637
sql_query.append(index_string);
26472638

26482639
if ((retval= txn->acquire(share, ha_thd(), TRUE, &io)))
@@ -2721,9 +2712,8 @@ int ha_federatedx::read_range_first(const key_range *start_key,
27212712

27222713
sql_query.length(0);
27232714
sql_query.append(share->select_query);
2724-
create_where_from_key(&sql_query,
2725-
&table->key_info[active_index],
2726-
start_key, end_key, 0, eq_range_arg);
2715+
create_where_from_key(&sql_query, &table->key_info[active_index],
2716+
start_key, end_key, eq_range_arg);
27272717

27282718
if ((retval= txn->acquire(share, ha_thd(), TRUE, &io)))
27292719
DBUG_RETURN(retval);

storage/federatedx/ha_federatedx.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ class ha_federatedx final : public handler
291291
FEDERATEDX_IO_RESULT *result);
292292
bool create_where_from_key(String *to, KEY *key_info,
293293
const key_range *start_key,
294-
const key_range *end_key,
295-
bool records_in_range, bool eq_range);
294+
const key_range *end_key, bool eq_range);
296295
int stash_remote_error();
297296

298297
static federatedx_txn *get_txn(THD *thd, bool no_create= FALSE);

0 commit comments

Comments
 (0)