public static function boot($connection) { if (!$connection) { throw new Exception('Provide Valid Dataabse connection'); } if (!self::$connection) { self::$connection = $connection; } }
define('DB_PASS', $config[$db_group]['password']); define('TABLE_PREFIX', $config[$db_group]['prefix']); define('USE_PDO', $config[$db_group]['pdo']); if (USE_PDO) { try { $__SE_CONN__ = new PDO(DB_DSN, DB_USER, DB_PASS); } catch (PDOException $error) { die('DB Connection failed: ' . $error->getMessage()); } if ($__SE_CONN__->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { $__SE_CONN__->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); } } else { require_once SYSPATH . '/libraries/DoLite.php'; $__SE_CONN__ = new DoLite(DB_DSN, DB_USER, DB_PASS); } Model::connection($__SE_CONN__); Model::getConnection()->exec("set names 'utf8'"); } // Set debugger define('DEBUG', $config['debug']); /** * Get all routes and process them */ if (isset($route)) { foreach ($route as $key => $value) { SE::addRoute($key, $value); } } // Dispatch Simplengine SE::dispatch();
function __construct(){ if (is_null(self::$connection)){ self::$connection = new MySQLADO; } $this->conn = self::$connection; }