49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
require __DIR__ . '/lib/redbean/rb-mysql.php';
|
|
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
|
/**
|
|
* MySqlDatabaseService
|
|
* @copyright 2021 Manaknightdigital Inc.
|
|
* @link https://manaknightdigital.com
|
|
* @license Proprietary Software licensing
|
|
* @author Ryan Wong
|
|
*
|
|
*/
|
|
class MySqlAdapter
|
|
{
|
|
private static $instance = null;
|
|
private $_con;
|
|
|
|
public function __construct()
|
|
{
|
|
$config = MkdConfig::get_instance()->get_config();
|
|
R::setup("mysql:host={$config['database-hostname']};dbname={$config['database-name']}", "{$config['database-u-ser']}", "{$config['database-password']}");
|
|
// R::debug(TRUE, 2);
|
|
$this->_con = R::getToolBox();
|
|
}
|
|
|
|
/**
|
|
* Get Instance
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public static function get_instance()
|
|
{
|
|
if (self::$instance == null) {
|
|
self::$instance = new MySqlAdapter();
|
|
}
|
|
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Get Connection
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function get_connection()
|
|
{
|
|
return $this->_con;
|
|
}
|
|
}
|