From 0232f61ae48f4f0b776beec1a2a5591dc59170f1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Jul 2012 10:50:21 +0200 Subject: [PATCH] Bug 7167: Changing in .sql parsing We first split on delimiter and then extract comments. You can now put \n for delimiter comments. ex: DELIMITER ; -- this is a comment SELECT * FROM my_table; -- another comment Before this patch, we had to write: DELIMITER ; -- this is a comment; SELECT * FROM my_table; -- another comment; Signed-off-by: Paul Poulain --- C4/Update/Database.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/C4/Update/Database.pm b/C4/Update/Database.pm index 8ab5840..ac62209 100644 --- a/C4/Update/Database.pm +++ b/C4/Update/Database.pm @@ -370,6 +370,20 @@ sub get_queries { chomp $line; $line =~ s/^\s*//; if ( $line =~ s/^--(.*)$// ) { + my @l = split $old_delimiter; + if ( @l > 1 ) { + my $tmp_query; + for my $l ( @l ) { + if ( $l =~ m/^--/ ) { + push @comments, $l; + next; + } + $tmp_query .= $l . $old_delimiter; + } + push @queries, $tmp_query if $tmp_query; + next; + } + push @comments, $1; next; } -- 1.7.9.5