Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #10: throw FatalError when the SQL statement fails. #333

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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