Пример #1
0
	private function __construct() {
		$connectionSettings = ConfigHandler::LoadConfigFile("db");

		switch ($connectionSettings['type']) {
			case 'cassandra':
				require_once(ROOT_PDIR . 'core/libs/phpcassa-0.7.a.4/connection.php');
				require_once(ROOT_PDIR . 'core/libs/core/ADODB_cassandra.class.php');
				$this->connection = new ADODB_cassandra();
				$this->connection->connect($connectionSettings['server'], null, null, $connectionSettings['name']);
				//var_dump($this->connection); die();
				break;
			default:
				$dsn              = "{$connectionSettings['type']}://"
					. "{$connectionSettings['user']}:{$connectionSettings['pass']}"
					. "@{$connectionSettings['server']}"
					. "/{$connectionSettings['name']}"
					. "?persist&fetchmode=ASSOC";
				$this->connection =& ADONewConnection($dsn);

				break;
		}


		// No go?
		if (!$this->connection) return;

		// Caching?
		// @todo Make this a config option.
		//$this->connection->memCache = true;
		//$this->connection->memCacheHost = 'localhost';
		//$this->connection->memCacheCompress = false;
	}