当前位置: 首页>>代码示例>>PHP>>正文


PHP DBAdapter::dbProperties方法代码示例

本文整理汇总了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;
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:25,代码来源:Adapter.php

示例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;
 }
开发者ID:ni5am,项目名称:Textcube,代码行数:35,代码来源:Adapter.php

示例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;
 }
开发者ID:ragi79,项目名称:Textcube,代码行数:24,代码来源:Adapter.php


注:本文中的DBAdapter::dbProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。