Skip to content
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

Merged
merged 2 commits into from
Mar 25, 2024
Merged

Conversation

MrTeeett
Copy link
Contributor

It's a reworked version of the old pull-request:
#8004

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
Copy link
Member

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
Copy link
Member

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
Comment on lines 8801 to 8802


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

src/dsql/parse.y Outdated
Comment on lines 8810 to 8811


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -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>

Copy link
Member

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.

Copy link
Contributor Author

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

@@ -12831,6 +12834,52 @@ dsc* TrimNode::execute(thread_db* tdbb, Request* request) const
}
}
}

if (multi && (where == blr_trim_both || where == blr_trim_leading))
Copy link
Member

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)
Copy link
Member

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.

src/dsql/ExprNodes.cpp Outdated Show resolved Hide resolved
Co-authored-by: Adriano dos Santos Fernandes <529415+asfernandes@users.noreply.github.com>
@dyemanov dyemanov merged commit 56e8c62 into FirebirdSQL:master Mar 25, 2024
20 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants