summaryrefslogtreecommitdiffstats
path: root/Aufgabe7/db-passwd-fill-table.pl
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2016-01-08 18:17:14 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2016-01-08 18:17:14 +0100
commitab265f85673b2eaa1f9de108ad962dba602b71de (patch)
tree43eba38ef45c8cc194b6b181cb95f34cdd4b82df /Aufgabe7/db-passwd-fill-table.pl
parent853dfabf5172b66316849b8ef4fe92b9933677ad (diff)
downloadSkriptsprachen-ab265f85673b2eaa1f9de108ad962dba602b71de.tar.gz
Skriptsprachen-ab265f85673b2eaa1f9de108ad962dba602b71de.zip
Make errors more descriptiveHEADmaster
Diffstat (limited to 'Aufgabe7/db-passwd-fill-table.pl')
-rw-r--r--Aufgabe7/db-passwd-fill-table.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/Aufgabe7/db-passwd-fill-table.pl b/Aufgabe7/db-passwd-fill-table.pl
index c33f89a..0b79693 100644
--- a/Aufgabe7/db-passwd-fill-table.pl
+++ b/Aufgabe7/db-passwd-fill-table.pl
@@ -28,9 +28,9 @@ use DBI;
# Get database config
my %dbconf = do 'dbinc.pl';
-my $dbhandle = DBI->connect("DBI:mysql:host=$dbconf{dbhost};database=$dbconf{dbdatabase}", $dbconf{dbuser}, $dbconf{dbpasswd}) or die 'DB not accessible';
+my $dbhandle = DBI->connect("DBI:mysql:host=$dbconf{dbhost};database=$dbconf{dbdatabase}", $dbconf{dbuser}, $dbconf{dbpasswd}, {RaiseError=>1}) or die 'DB not accessible';
-my $passwdInsertSth = $dbhandle->prepare("INSERT INTO stsuh_passwort (loginname, password, uid, gid, comment, homedir, commandinterpreter) VALUES (?, ?, ?, ?, ?, ?, ?)") or die 'Preparation failed';
+my $passwdInsertSth = $dbhandle->prepare("INSERT INTO stsuh_passwort (loginname, password, uid, gid, comment, homedir, commandinterpreter) VALUES (?, ?, ?, ?, ?, ?, ?)") or die $dbhandle->errstr;
my $passwdFile_file_name = 'passwd'; # input file name
@@ -43,7 +43,7 @@ while (<$passwdFile>)
chomp @passwdLine;
- $passwdInsertSth->execute(@passwdLine) or die 'Execution failed';
+ $passwdInsertSth->execute(@passwdLine) or die $dbhandle->errstr;
}
close $passwdFile