diff options
Diffstat (limited to 'lib/MasterServer/Database/SQLite/dbCore.pm')
| -rwxr-xr-x | lib/MasterServer/Database/SQLite/dbCore.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/MasterServer/Database/SQLite/dbCore.pm b/lib/MasterServer/Database/SQLite/dbCore.pm index a75f7a0..27c9b35 100755 --- a/lib/MasterServer/Database/SQLite/dbCore.pm +++ b/lib/MasterServer/Database/SQLite/dbCore.pm @@ -8,9 +8,8 @@ use Exporter 'import'; our @EXPORT = qw| database_login |; ################################################################################ -## database_login ## login to the database with credentials provided in the config file. -## returns dbh object +## returns dbh object or quits application on error. ################################################################################ sub database_login { my $self = shift; @@ -28,12 +27,12 @@ sub database_login { } # create the dbi object - my $dbh = DBI->connect(@{$self->{dblogin}}, {PrintError => 0}); + my $dbh = DBI->connect(@{$self->{dblogin}}, {PrintError => $self->{db_print}}); # verify that the database connected if (defined $dbh) { # log the event - $self->log("database","Connected to the SQLite database."); + $self->log("load","Connected to the SQLite database."); # turn on error printing $dbh->{printerror} = 1; @@ -44,6 +43,9 @@ sub database_login { # it takes too long to write to the database, which means that new beacons, # requests and servers cannot be processed. You don't have a choice, really.. $dbh->do("PRAGMA synchronous = OFF"); + + # allow the use of foreign keys (referencing) + $dbh->do("PRAGMA foreign_keys = ON"); # return the dbi object for further use return $dbh; |
