Skip to content

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

@rabbiveesh

Description

@rabbiveesh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions