Пример #1
0
/**
 * Loads connections configuration.
 *
 * @return void
 */
	protected static function _init() {
		include_once APP . 'Config' . DS . 'database.php';
		if (class_exists('DATABASE_CONFIG')) {
			self::$config = new DATABASE_CONFIG();
		}
		self::$_init = true;
	}
Пример #2
0
 /**
  * Loads connections configuration.
  *
  */
 private static function init()
 {
     include_once APP . 'Config' . DS . 'database.php';
     if (class_exists('DATABASE_CONFIG')) {
         self::$config = new DATABASE_CONFIG();
     }
     register_shutdown_function('ConnectionManager::shutdown');
     self::$_init = true;
 }
 public function display()
 {
     App::uses('ConnectionManager', 'Model');
     $dsn = 'mysql://*****:*****@localhost/employee_db';
     ConnectionManager::config('default', ['url' => $dsn]);
     $db = ConnectionManager::getDataSource("default");
     // $data = $db->fetchAll("show databases");
     $data = $db->execute('SELECT * FROM employee_master')->fetchAll('assoc');
     $this->set('data', $data);
 }
Пример #4
0
 /**
  * setup
  *
  * @return void
  */
 public function setup()
 {
     parent::setUp();
     $config = ConnectionManager::config('test');
     $this->skipIf(strpos($config['driver'], 'Mysql') === false, 'Not using Mysql for test config');
 }