From 2c7d62f38944f61e7eafea155c6128521d16aed9 Mon Sep 17 00:00:00 2001 From: Darkelarious Date: Tue, 19 May 2015 22:00:40 +0200 Subject: Beta with support for Pg and SQLite --- lib/MasterServer/Database/SQLite/dbCore.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/MasterServer/Database/SQLite/dbCore.pm') 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; -- cgit v1.2.3