本文整理汇总了PHP中DBAdapter::dbProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP DBAdapter::dbProperties方法的具体用法?PHP DBAdapter::dbProperties怎么用?PHP DBAdapter::dbProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBAdapter
的用法示例。
在下文中一共展示了DBAdapter::dbProperties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bind
public static function bind($database)
{
// Connects DB and set environment variables
// $database array should contain 'server','username','password'.
self::$cachedResult = self::$dbProperties = array();
if (!isset($database) || empty($database)) {
return false;
}
if (!isset($database['port']) && strpos($database['server'], ':')) {
$port = explode(":", $database['server']);
$database['server'] = $port[0];
$database['port'] = $port[1];
}
if (!defined('__TEXTCUBE_DATA_DIR__')) {
define('__TEXTCUBE_DATA_DIR__', __TEXTCUBE_CACHE_DIR__);
}
if (!file_exists(__TEXTCUBE_DATA_DIR__)) {
@mkdir(__TEXTCUBE_DATA_DIR__);
}
self::$db = new SQLite3(__TEXTCUBE_DATA_DIR__ . '/' . $database['database'] . '.sqlite', SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
if (!self::$db) {
return false;
}
return true;
}
示例2: bind
public static function bind($database)
{
// Connects DB and set environment variables
// $database array should contain 'server','username','password'.
self::$cachedResult = self::$dbProperties = array();
if (!isset($database) || empty($database)) {
return false;
}
if (!isset($database['port']) && strpos($database['server'], ':')) {
$port = explode(":", $database['server']);
$database['server'] = $port[0];
$database['port'] = $port[1];
}
if (isset($database['port'])) {
self::$db = new mysqli($database['server'], $database['username'], $database['password'], $database['database'], intval($database['port']));
} else {
self::$db = new mysqli($database['server'], $database['username'], $database['password'], $database['database']);
}
if (!self::$db) {
return false;
}
if (!self::$db->select_db($database['database'])) {
die("Connection error :" . self::$db->errorno . " - " . self::$db->error);
}
//self::$db->autocommit(false); // Turns off autocommit.
self::$db->autocommit(true);
// Turns off autocommit.
if (self::$db->set_charset("utf8")) {
self::$dbProperties['charset'] = 'utf8';
} else {
self::$dbProperties['charset'] = 'default';
}
@self::query('SET SESSION collation_connection = \'utf8_general_ci\'');
return true;
}
示例3: bind
public static function bind($database)
{
self::$cachedResult = self::$dbProperties = array();
// Connects DB and set environment variables
// $database array should contain 'server','username','password'.
if (!isset($database) || empty($database)) {
return false;
}
self::$db = @mysql_connect($database['server'] . (isset($database['port']) ? ':' . $database['port'] : ''), $database['username'], $database['password']);
if (!self::$db) {
return false;
}
self::$db = @mysql_select_db($database['database']);
if (!self::$db) {
return false;
}
if (self::query('SET CHARACTER SET utf8')) {
self::$dbProperties['charset'] = 'utf8';
} else {
self::$dbProperties['charset'] = 'default';
}
@self::query('SET SESSION collation_connection = \'utf8_general_ci\'');
return true;
}