-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-character TRIM function #8015
Conversation
src/dsql/parse.y
Outdated
@@ -703,6 +703,9 @@ using namespace Firebird; | |||
%token <metaNamePtr> CALL | |||
%token <metaNamePtr> FORMAT | |||
%token <metaNamePtr> NAMED_ARG_ASSIGN | |||
%token <metaNamePtr> BTRIM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reorder it alphabetically inside block // tokens added for Firebird 6.0
, like the others.
src/dsql/parse.y
Outdated
@@ -4495,6 +4498,9 @@ keyword_or_column | |||
| WINDOW | |||
| WITHOUT | |||
| CALL // added in FB 6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reorder it alphabetically inside block // added in FB 6.0
, like the others.
src/dsql/parse.y
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/dsql/parse.y
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -18,6 +18,9 @@ Format: | |||
<trim character> ::= | |||
<value expression> | |||
|
|||
<multi-character trim function> ::= | |||
{ BTRIM | LTRIM | RTRIM } <left paren> <trim source> [ <comma> <trim character> ] <right paren> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document more explicitly difference between the new functions when using a trim character
and specifiy that they work identically to previously function when trim character
is not passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the comments, please check how else I need to finalize the documentation
src/dsql/ExprNodes.cpp
Outdated
@@ -12831,6 +12834,52 @@ dsc* TrimNode::execute(thread_db* tdbb, Request* request) const | |||
} | |||
} | |||
} | |||
|
|||
if (multi && (where == blr_trim_both || where == blr_trim_leading)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use single if (multi)
with others ifs inside it.
@@ -507,6 +507,9 @@ PARSER_TOKEN(TOK_TRANSACTION, "TRANSACTION", true) | |||
PARSER_TOKEN(TOK_TRAPS, "TRAPS", true) | |||
PARSER_TOKEN(TOK_TRIGGER, "TRIGGER", false) | |||
PARSER_TOKEN(TOK_TRIM, "TRIM", false) | |||
PARSER_TOKEN(TOK_BTRIM, "BTRIM", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put each entry in their alphabetically order.
Co-authored-by: Adriano dos Santos Fernandes <529415+asfernandes@users.noreply.github.com>
It's a reworked version of the old pull-request:
#8004