Commit 4a6a0f77 by Alex Bush

mysql

1 parent ddc133aa
Showing with 36 additions and 5 deletions
......@@ -13,10 +13,25 @@ app->secret($config->{secret} || 'minecraft');
plugin charset => {charset => $config->{encoding}};
# Connect to db
our $dbi = DBIx::Custom->connect(
dsn => "dbi:$config->{db_driver}:database=$config->{db}",
option => {sqlite_unicode => 1},
);
if ( $config->{db_driver} eq 'SQLite' ) {
our $dbi = DBIx::Custom->connect(
dsn => "dbi:$config->{db_driver}:database=$config->{db}",
option => {sqlite_unicode => 1},
);
} elsif ( $config->{db_driver} eq 'mysql') {
my $dbi = DBIx::Custom->connect(
dsn => "dbi:$config->{db_driver}:database=$config->{db}",
user => $config->{db_username},
password => $config->{db_password},
option => {mysql_enable_utf8 => 1}
);
my $dbi = DBIx::Custom->connect(
dsn => "dbi:mysql:database=$config->{db};host=$config->{db_host};port=$config->{db_port}",
user => $config->{db_username},
password => $config->{db_password},
option => { PrintError => 1, mysql_enable_utf8 => 1 }
);
}
sub wikitree {
my $tree_row = $dbi->select(
......
{
secret => 'minecraft',
encoding => 'utf-8',
db_driver => 'SQLite',
# DB
#
# For mysql:
# db => 'DBNAME',
# dh_host => 'db_host' # 'localhost'
# db_port => '3306',
# db_driver => 'mysql',
# db_username => 'DBUSER',
# db_password => 'DBPASSWORD',
#
db => 'minecraft.sqlite',
db_driver => 'SQLite',
db_username => '',
db_passwd => '',
# Auth
username => 'admin',
userpass => 'test',
};
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!