Skip to content

Commit

Permalink
Issue #255: handle the SQL post statements
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Aug 12, 2020
1 parent 808ccc2 commit 8779ef9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/docker/quick_setup.pl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ sub DBCreateUser {
sub ExecuteSQL {
my %Param = @_;

# unfortunately we have some interdependencies here
state @SQLPost;

# check the params
for my $Key ( grep { ! $Param{$_} } qw(XMLFile) ) {
return 0, "CheckSystemRequirements: the parameter '$Key' is required";
Expand All @@ -358,18 +361,19 @@ sub ExecuteSQL {
Database => \@XMLArray,
);

# If we parsed the schema, catch post instructions.
push @SQL, $DBObject->SQLProcessorPost() if $Param{XMLFile} =~ m/otobo-schema/;

SQL:
for my $SQL (@SQL) {
for my $SQL (@SQL, @SQLPost) {
my $Success = $DBObject->Do( SQL => $SQL );

next SQL if $Success;

return 0, $DBI::errstr;
}

# If we parsed the schema, catch post instructions.
# they will run after the initial insert
push @SQLPost, $DBObject->SQLProcessorPost() if $Param{XMLFile} =~ m/otobo-schema/;

return 1;
}

Expand Down

0 comments on commit 8779ef9

Please sign in to comment.