aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterServer/Database/Pg/dbCiphers.pm
diff options
context:
space:
mode:
authorDarkelarious <darkelarious@333networks.com>2017-05-13 14:18:28 +0200
committerDarkelarious <darkelarious@333networks.com>2017-05-13 14:20:49 +0200
commit34a2c7390ea9662d33258d384e72fff1912343ff (patch)
treed96ea33c0107e4906a152aa1de4b5c75b81ba0a8 /lib/MasterServer/Database/Pg/dbCiphers.pm
parent84af66aba26d2088d5d95c240d176f3edaf17b58 (diff)
downloadMasterServer-Perl-2.3.0.tar.gz
MasterServer-Perl-2.3.0.zip
revised synchronization methods, config settings and bug fixesv2.3.0
Diffstat (limited to 'lib/MasterServer/Database/Pg/dbCiphers.pm')
-rwxr-xr-xlib/MasterServer/Database/Pg/dbCiphers.pm18
1 files changed, 12 insertions, 6 deletions
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,15 +1,23 @@
-
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
################################################################################
sub clear_ciphers {
@@ -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;