Skip to content

Commit

Permalink
[CBRD-24969] Remove semicolon after shard key (#4662)
Browse files Browse the repository at this point in the history
process shard key including semicolon properly
  • Loading branch information
kisoo-han authored Sep 8, 2023
1 parent b044d24 commit 83b6b03
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/broker/shard_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ static int sp_get_int_bind_value (SP_PARSER_CTX * parser_p, SP_PARSER_HINT * hin
static int sp_is_valid_hint (SP_PARSER_CTX * parser_p, SP_PARSER_HINT * hint_p);
static bool sp_is_start_token (SP_TOKEN token);


SP_PARSER_CTX *
sp_create_parser (const char *sql_stmt)
{
Expand Down Expand Up @@ -316,15 +315,24 @@ static int
sp_make_int_sp_value_from_string (SP_VALUE * value_p, char *pos, int length)
{
int result = 0;
char tmp = pos[length];
const int KEY_LENGTH = 128;
char shard_key[KEY_LENGTH];
char *p;

snprintf (shard_key, KEY_LENGTH, "%s", pos);
p = strchr (shard_key, ';');
if (p)
{
*p = '\0';
}
shard_key[length] = '\0';

pos[length] = '\0';
result = parse_bigint (&value_p->integer, pos, 10);
result = parse_bigint (&value_p->integer, shard_key, 10);
if (result != 0)
{
return ER_SP_INVALID_HINT;
}
pos[length] = tmp;

value_p->type = VT_INTEGER;
return NO_ERROR;
}
Expand Down

0 comments on commit 83b6b03

Please sign in to comment.