Skip Menu |

This queue is for tickets about the SQL-SplitStatement CPAN distribution.

Report information
The Basics
Id: 119366
Status: rejected
Priority: 0/
Queue: SQL-SplitStatement

People
Owner: Nobody in particular
Requestors: spraff [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: semicolon-delimited statements are grouped when custom delimiter given
Date: Thu, 22 Dec 2016 10:13:53 +0000
To: bug-SQL-SplitStatement [...] rt.cpan.org
From: Bernie G <spraff [...] gmail.com>
Below is a test input file. If you split it with my $sql_splitter = SQL::SplitStatement->new; my @statements = $sql_splitter->split ($src); then TableA and TableB are returned in separate statements, but TableC and TableD are joined into a single statement. The presence of the "DELIMETER |" statement should not prevent semicolon-delimited statements from being separated. TEST INPUT FILE BEGINS =================== CREATE TABLE TableA ( id INT ); CREATE TABLE TableB ( id INT ); DELIMITER | CREATE TABLE TableC ( id INT ); CREATE TABLE TableD ( id INT );
I think that the current SQL::SplitStatement behavior is correct: if you set a new delimiter via DELIMITER, the previous delimiter is disabled. In other words, the DELIMITER semantics is not to add a new delimiter, but to replace the current delimiter. Indeed, typically DELIMITER is used to tell the parser to ignore the semicolons inside fragments of procedural code. If you want to restore the previous delimiter, you have to say: DELIMITER ; In MySQL at least. I'm however open to change my mind, if you can show me the documents. Thank you for your contribution! -Emanuele On Thu Dec 22 05:14:02 2016, spraff@gmail.com wrote: Show quoted text
> Below is a test input file. > > If you split it with > > my $sql_splitter = SQL::SplitStatement->new; > my @statements = $sql_splitter->split ($src); > > then TableA and TableB are returned in separate statements, but TableC and > TableD are joined into a single statement. > > The presence of the "DELIMETER |" statement should not prevent > semicolon-delimited statements from being separated. > > TEST INPUT FILE BEGINS > =================== > > CREATE TABLE TableA > ( > id INT > ); > > CREATE TABLE TableB > ( > id INT > ); > > DELIMITER | > > CREATE TABLE TableC > ( > id INT > ); > > CREATE TABLE TableD > ( > id INT > );
Subject: Re: [rt.cpan.org #119366] semicolon-delimited statements are grouped when custom delimiter given
Date: Fri, 23 Dec 2016 08:37:16 +0000
To: bug-SQL-SplitStatement [...] rt.cpan.org
From: Bernie G <spraff [...] gmail.com>
Thank you for replying. MySQL accepts mixed-delimiter code and executes it correctly. Surely then we should support this behaviour elsewhere? On Thu, Dec 22, 2016 at 10:39 PM, Emanuele Zeppieri via RT < bug-SQL-SplitStatement@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=119366 > > > I think that the current SQL::SplitStatement behavior is correct: if you > set a new delimiter via DELIMITER, the previous delimiter is disabled. In > other words, the DELIMITER semantics is not to add a new delimiter, but to > replace the current delimiter. > > Indeed, typically DELIMITER is used to tell the parser to ignore the > semicolons inside fragments of procedural code. > > If you want to restore the previous delimiter, you have to say: > > DELIMITER ; > > In MySQL at least. > I'm however open to change my mind, if you can show me the documents. > > Thank you for your contribution! > -Emanuele > > On Thu Dec 22 05:14:02 2016, spraff@gmail.com wrote:
> > Below is a test input file. > > > > If you split it with > > > > my $sql_splitter = SQL::SplitStatement->new; > > my @statements = $sql_splitter->split ($src); > > > > then TableA and TableB are returned in separate statements, but TableC
> and
> > TableD are joined into a single statement. > > > > The presence of the "DELIMETER |" statement should not prevent > > semicolon-delimited statements from being separated. > > > > TEST INPUT FILE BEGINS > > =================== > > > > CREATE TABLE TableA > > ( > > id INT > > ); > > > > CREATE TABLE TableB > > ( > > id INT > > ); > > > > DELIMITER | > > > > CREATE TABLE TableC > > ( > > id INT > > ); > > > > CREATE TABLE TableD > > ( > > id INT > > );
> > > >
Subject: Re: [rt.cpan.org #119366] semicolon-delimited statements are grouped when custom delimiter given
Date: Fri, 23 Dec 2016 08:38:58 +0000
To: bug-SQL-SplitStatement [...] rt.cpan.org
From: Bernie G <spraff [...] gmail.com>
As in, perhaps MySQL doesn't follow the documentation exactly, but in this case it seems to me that it's the documentation that needs to be fixed. On Fri, Dec 23, 2016 at 8:37 AM, Bernie G <spraff@gmail.com> wrote: Show quoted text
> Thank you for replying. > > MySQL accepts mixed-delimiter code and executes it correctly. Surely then > we should support this behaviour elsewhere? > > On Thu, Dec 22, 2016 at 10:39 PM, Emanuele Zeppieri via RT < > bug-SQL-SplitStatement@rt.cpan.org> wrote: >
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=119366 > >> >> I think that the current SQL::SplitStatement behavior is correct: if you >> set a new delimiter via DELIMITER, the previous delimiter is disabled. In >> other words, the DELIMITER semantics is not to add a new delimiter, but to >> replace the current delimiter. >> >> Indeed, typically DELIMITER is used to tell the parser to ignore the >> semicolons inside fragments of procedural code. >> >> If you want to restore the previous delimiter, you have to say: >> >> DELIMITER ; >> >> In MySQL at least. >> I'm however open to change my mind, if you can show me the documents. >> >> Thank you for your contribution! >> -Emanuele >> >> On Thu Dec 22 05:14:02 2016, spraff@gmail.com wrote:
>> > Below is a test input file. >> > >> > If you split it with >> > >> > my $sql_splitter = SQL::SplitStatement->new; >> > my @statements = $sql_splitter->split ($src); >> > >> > then TableA and TableB are returned in separate statements, but TableC
>> and
>> > TableD are joined into a single statement. >> > >> > The presence of the "DELIMETER |" statement should not prevent >> > semicolon-delimited statements from being separated. >> > >> > TEST INPUT FILE BEGINS >> > =================== >> > >> > CREATE TABLE TableA >> > ( >> > id INT >> > ); >> > >> > CREATE TABLE TableB >> > ( >> > id INT >> > ); >> > >> > DELIMITER | >> > >> > CREATE TABLE TableC >> > ( >> > id INT >> > ); >> > >> > CREATE TABLE TableD >> > ( >> > id INT >> > );
>> >> >> >>
>