X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDBUpgrade2.pm;h=83210316c795ea4e718330138172f40cc73bd930;hb=c4ba4f3e7cd337939308b57eee799b201bd78cb9;hp=a74e8ae82ed4a75504adb26655e3bc716af3713b;hpb=b2448c147778ca345decb911aee36f13eca610ae;p=kivitendo-erp.git diff --git a/SL/DBUpgrade2.pm b/SL/DBUpgrade2.pm index a74e8ae82..83210316c 100644 --- a/SL/DBUpgrade2.pm +++ b/SL/DBUpgrade2.pm @@ -25,12 +25,17 @@ sub init { $params{path_suffix} ||= ''; $params{schema} ||= ''; + $params{path} = "sql/" . $params{dbdriver} . "-upgrade2" . $params{path_suffix}; map { $self->{$_} = $params{$_} } keys %params; return $self; } +sub path { + $_[0]{path}; +} + sub parse_dbupdate_controls { $::lxdebug->enter_sub(); @@ -42,7 +47,7 @@ sub parse_dbupdate_controls { local *IN; my %all_controls; - my $path = "sql/" . $self->{dbdriver} . "-upgrade2" . $self->{path_suffix}; + my $path = $self->path; foreach my $file_name (<$path/*.sql>, <$path/*.pl>) { next unless (open(IN, $file_name)); @@ -163,9 +168,8 @@ sub process_query { if ($char eq $quote_chars[-1]) { pop(@quote_chars); } elsif (length $quote_chars[-1] > 1 - && substr($quote_chars[-1], 0, 1) eq $char && substr($_, $i, length $quote_chars[-1]) eq $quote_chars[-1]) { - $i += length $quote_chars[-1] - 1; + $i += length($quote_chars[-1]) - 1; $char = $quote_chars[-1]; pop(@quote_chars); } @@ -176,10 +180,10 @@ sub process_query { if (($char eq "'") || ($char eq "\"")) { push(@quote_chars, $char); - } elsif ($char eq '$' # start of dollar quoting - && ($tag_end = index($_, '$', $i + 1)) > -1 # ends on same line - && (do { substr($_, $i + 1, $tag_end - $i - 1); 1 }) # extract tag - && $tag =~ /^ (?= [A-Za-z_] [A-Za-z0-9_]* | ) $/x) { # tag is identifier + } elsif ($char eq '$' # start of dollar quoting + && ($tag_end = index($_, '$', $i + 1)) > -1 # ends on same line + && (do { $tag = substr($_, $i + 1, $tag_end - $i - 1); 1 }) # extract tag + && $tag =~ /^ (?= [A-Za-z_] [A-Za-z0-9_]* | ) $/x) { # tag is identifier push @quote_chars, $char = '$' . $tag . '$'; $i = $tag_end; } elsif ($char eq ";") {