Log In
Sign Up
Go Gold
Home
Forum
Mail
Downloads
Game Search
Macro Editor
Notes
Membership
MySQL.pl - Quest File
General Info
Quest File
#::: Akkadius #::: Description: These plugins are MySQL loaders in use with Perl DBI #::: For plug and play, LoadMysql will load your database credentials from eqemu_config.json sub LoadMysql { use DBI; use DBD::mysql; use JSON; my $json = new JSON(); #::: Load Config my $content; open(my $fh, '<', "eqemu_config.json") or die "cannot open file $filename"; { local $/; $content = <$fh>; } close($fh); #::: Decode $config = $json->decode($content); #::: Set MySQL Connection vars $db = $config->{"server"}{"database"}{"db"}; $host = $config->{"server"}{"database"}{"host"}; $user = $config->{"server"}{"database"}{"username"}; $pass = $config->{"server"}{"database"}{"password"}; #::: Map DSN $dsn = "dbi:mysql:$db:$host:3306"; #::: Connect and return $connect = DBI->connect($dsn, $user, $pass); return $connect; }
Source: 17 Jan 2022
Quest Source: 28 May 2022