Skip to content

Commit b0d3ba0

Browse files
committed
cdk: Fix issue with parsing opeator IN(...)
When parsing quoted strings inside list, it was wrongly assumed that token includes quotes. But after parser refactoring this is no longer the case so this code become incorrect.
1 parent 9bc3a93 commit b0d3ba0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cdk/parser/expr_parser.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,11 +1219,9 @@ Expression* Expr_parser_base::parse_atomic(Processor *prc)
12191219
case Token::QSTRING:
12201220
if (m_strings_as_blobs)
12211221
{
1222-
cdk::bytes raw = consume_token()->get_bytes();
1223-
// NOTE: we remove first and last byte which contain quotes
1224-
assert(raw.size() > 1);
1225-
sprc->val()->value(cdk::TYPE_BYTES, Format_info(),
1226-
cdk::bytes(raw.begin()+1, raw.end()-1));
1222+
sprc->val()->value(
1223+
cdk::TYPE_BYTES, Format_info(), consume_token()->get_bytes()
1224+
);
12271225
}
12281226
else
12291227
sprc->val()->str(consume_token()->get_text());

cdk/parser/tests/parser-t.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ struct Expr_Test{ parser::Parser_mode::value mode; const char *txt;} ;
876876

877877
const Expr_Test exprs[] =
878878
{
879+
{ parser::Parser_mode::DOCUMENT, "_id in ('1','3')"},
879880
{ parser::Parser_mode::DOCUMENT, "-2*34.1%5"},
880881
{ parser::Parser_mode::DOCUMENT, "-2*3+4.1%5"},
881882
{ parser::Parser_mode::DOCUMENT, "-2*3+4.1%5"},

0 commit comments

Comments
 (0)