本文整理汇总了PHP中ADOConnection::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP ADOConnection::connect方法的具体用法?PHP ADOConnection::connect怎么用?PHP ADOConnection::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ADOConnection
的用法示例。
在下文中一共展示了ADOConnection::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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;
}