コード例 #1
0
ファイル: mysql.php プロジェクト: ballistiq/revive-adserver
 /**
  * Class constructor
  *
  * @param MDB2_Driver_Common $oDbh
  * @return OA_DB_Charset
  */
 function OA_DB_Charset_mysql(&$oDbh)
 {
     $aVersion = $oDbh->getServerVersion();
     if (version_compare($aVersion['native'], '4.1.2', '>=')) {
         parent::OA_DB_Charset($oDbh);
     }
 }
コード例 #2
0
 /**
  * Class constructor
  *
  * @param MDB2_Driver_Common $oDbh
  * @return OA_DB_Charset
  */
 function __construct(&$oDbh)
 {
     $aVersion = $oDbh->getServerVersion();
     if (version_compare($aVersion['native'], '4.1.2', '>=')) {
         parent::__construct($oDbh);
     }
 }
コード例 #3
0
 function testPgSQL()
 {
     $oDbh = OA_DB::singleton();
     if ($oDbh->dbsyntax == 'pgsql') {
         $oDbc = OA_DB_Charset::factory($oDbh);
         $this->assertTrue($oDbc);
         $this->assertTrue($oDbc->oDbh);
         $this->assertEqual($oDbc->getDatabaseCharset(), 'UTF8');
         $this->assertEqual($oDbc->getClientCharset(), 'UTF8');
         $aCharsets = array('LATIN1', 'UTF8', 'SJIS');
         foreach ($aCharsets as $charset) {
             $this->assertTrue($oDbc->setClientCharset($charset));
             $this->assertEqual($oDbc->getClientCharset(), $charset);
         }
     }
 }
コード例 #4
0
ファイル: DB.php プロジェクト: Spark-Eleven/revive-adserver
 /**
  * A method to set the client encoding.
  *
  * @param MDB2_Driver_common $oDbh
  * @return mixed True on succes, PEAR_Error otherwise
  */
 static function setCharset($oDbh)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $oDbc = OA_DB_Charset::factory($oDbh);
     if (!empty($aConf['databaseCharset']['checkComplete'])) {
         $charset = $aConf['databaseCharset']['clientCharset'];
     } else {
         $charset = $oDbc->getConfigurationValue();
     }
     return $oDbc->setClientCharset($charset);
 }
コード例 #5
0
ファイル: Upgrade.php プロジェクト: villos/tree_admin
 /**
  * add any needed database parameter to the config array
  *
  * @param array $aConfig
  *
  * @return array
  */
 function initDatabaseParameters($aConfig)
 {
     // Check if we need to ensure to enable MySQL 4 compatibility
     if (strcasecmp($aConfig['database']['type'], 'mysql') === 0) {
         $result = $this->oDbh->exec("SET SESSION sql_mode='MYSQL40'");
         $aConfig['database']['mysql4_compatibility'] = !PEAR::isError($result);
     }
     // Set charset information
     $oDbc =& OA_DB_Charset::factory($this->oDbh);
     $charset = $oDbc->getConfigurationValue();
     $aConfig['databaseCharset'] = array('checkComplete' => true, 'clientCharset' => $charset ? $charset : '');
     return $aConfig;
 }