From 34a2c7390ea9662d33258d384e72fff1912343ff Mon Sep 17 00:00:00 2001 From: Darkelarious Date: Sat, 13 May 2017 14:18:28 +0200 Subject: revised synchronization methods, config settings and bug fixes --- lib/MasterServer/Database/Pg/dbCiphers.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lib/MasterServer/Database/Pg/dbCiphers.pm') diff --git a/lib/MasterServer/Database/Pg/dbCiphers.pm b/lib/MasterServer/Database/Pg/dbCiphers.pm index e2a5784..e099f88 100755 --- a/lib/MasterServer/Database/Pg/dbCiphers.pm +++ b/lib/MasterServer/Database/Pg/dbCiphers.pm @@ -1,14 +1,22 @@ - package MasterServer::Database::Pg::dbCiphers; use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw| clear_ciphers +our @EXPORT = qw| check_cipher_count + clear_ciphers insert_cipher get_game_props |; +################################################################################ +## Check if ciphers exist +################################################################################ +sub check_cipher_count { + my $self = shift; + return $self->db_all('SELECT count(*) as num from games')->[0]->{num}; +} + ################################################################################ ## Clear all existing ciphers from the database ################################################################################ @@ -43,15 +51,13 @@ sub insert_cipher { ################################################################################ ## get the cipher, description and default port that goes with given gamename +## returns only the first item if multiple items ################################################################################ sub get_game_props { my ($self, $gn) = @_; # get cipher from db if gamename exists - return $self->{dbh}->selectall_arrayref( - 'SELECT * FROM games WHERE gamename = ?', - {Slice=>{}}, - lc $gn)->[0]; + return $self->db_all('SELECT * FROM games WHERE gamename = ?', lc $gn)->[0]; } 1; -- cgit v1.2.3