Skip to content

Commit

Permalink
Merge pull request #333 from RotherOSS/issue-10-blast_from_the_past
Browse files Browse the repository at this point in the history
Issue #10: throw FatalError when the SQL statement fails.
  • Loading branch information
bschmalhofer authored Aug 7, 2020
2 parents f40d9b0 + 48f3be8 commit 9a32e0c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Kernel/Modules/Installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ sub Run {
# Create database tables and insert initial values.
my @SQLPost;
for my $SchemaFile (qw(otobo-schema otobo-initial_insert)) {

if ( !-f "$DirOfSQLFiles/$SchemaFile.xml" ) {
$LayoutObject->FatalError(
Message => $LayoutObject->{LanguageObject}
Expand Down Expand Up @@ -700,8 +701,17 @@ sub Run {
# If we parsed the schema, catch post instructions.
@SQLPost = $DBObject->SQLProcessorPost() if $SchemaFile eq 'otobo-schema';

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

next SQL if $Success;

# an statement was no correct, no idea how this could be handled
$LayoutObject->FatalError(
Message => Translatable('Execution of SQL statement failed: ') . $DBI::errstr,
Comment => $SQL,
);
}

$LayoutObject->Block(
Expand Down

0 comments on commit 9a32e0c

Please sign in to comment.