Example #1
0
 /**
  * 初始化mysql数据库操作类
  *
  * @access public
  * @param  void
  * @return void
  */
 function setMySQL()
 {
     global $oMySQL, $DBSet;
     InitCommon::loadClass("DBMySQL");
     $oMySQL = new DBMySQL($DBSet['user'], $DBSet['pass'], $DBSet['name'], $DBSet['host']);
     if (!$oMySQL->dbh) {
         $this->error("数据库系统忙,请稍候访问");
     }
     $oMySQL->query("SET NAMES 'utf8'");
 }
 /**
  * @dataProvider getConParams
  */
 public function testNoSetNameQueryExecuted($conparams)
 {
     if (version_compare(PHP_VERSION, '5.3.6', '<')) {
         $this->markTestSkipped('PHP_VERSION < 5.3.6 will throw an exception.');
     }
     $db = new DBMySQL();
     $params = $db->prepareParams($conparams);
     $settings = array();
     if (isset($params['settings'])) {
         $settings = $params['settings'];
     }
     $db->initConnection($this->getPdoMock(), $settings);
 }
 public function import($sql)
 {
     foreach (explode(";\n", $sql) as $sql) {
         $sql = trim($sql);
         if ($sql) {
             $this->db->query($sql);
         }
     }
 }
 public function testQuotingIdentifiers()
 {
     $db = new DBMySQL();
     $this->assertEquals('`Book ISBN`', $db->quoteIdentifier('Book ISBN'));
 }