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 a "keep comment but remove empty statements" option #3

Open
rabbiveesh opened this issue Jun 4, 2021 · 0 comments
Open

add a "keep comment but remove empty statements" option #3

rabbiveesh opened this issue Jun 4, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@rabbiveesh
Copy link
Owner

copied from RT.

Hi,

First of all, thank you for your module, which works absolutely fine.

If possible, I have a feature request about adding an option to keep the
comments in SQL code but still remove the statements that contain no
code. My use case is that my code is processing user code, from which I
remove empty statement (the Teradata DB output some error message on
empty statement), but I would still like to keep the comments (except
when they are on their own) to help users diagnose problem from the
execution log.

Currently, as a workaround, I am doing something along the line of:

my $s = SQL::SplitStatement->new(keep_comments => 1,
keep_empty_statements => 0);
my $r = SQL::SplitStatement->new(keep_empty_statements => 0);
my @l = grep { $r->split($_) } $s->split($sql);

So this is really not a big issue, but an option to control this
behaviour would be a added bonus.

Thank you again for your time,
Cheers,

Mathias

@rabbiveesh rabbiveesh added the enhancement New feature or request label Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant