當前位置: 首頁>>代碼示例>>PHP>>正文


PHP rex_sql::checkDbConnection方法代碼示例

本文整理匯總了PHP中rex_sql::checkDbConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP rex_sql::checkDbConnection方法的具體用法?PHP rex_sql::checkDbConnection怎麽用?PHP rex_sql::checkDbConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rex_sql的用法示例。


在下文中一共展示了rex_sql::checkDbConnection方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkDb

 /**
  * Checks the version of the connected database server.
  *
  * @param array $config   of databaes configs
  * @param bool  $createDb Should the database be created, if it not exists.
  *
  * @return string Error
  */
 public static function checkDb($config, $createDb)
 {
     $err = rex_sql::checkDbConnection($config['db'][1]['host'], $config['db'][1]['login'], $config['db'][1]['password'], $config['db'][1]['name'], $createDb);
     if ($err !== true) {
         return $err;
     }
     $serverVersion = rex_sql::getServerVersion();
     if (rex_string::versionCompare($serverVersion, self::MIN_MYSQL_VERSION, '<') == 1) {
         return rex_i18n::msg('setup_404', $serverVersion, self::MIN_MYSQL_VERSION);
     }
     return '';
 }
開發者ID:VIEWSION,項目名稱:redaxo,代碼行數:20,代碼來源:setup.php

示例2: rex_post

    $redaxo_db_create = rex_post('redaxo_db_create', 'boolean');
    $cont = preg_replace("@(REX\\['SERVER'\\].?\\=.?\")[^\"]*@", '${1}' . $serveraddress, $cont);
    $cont = preg_replace("@(REX\\['SERVERNAME'\\].?\\=.?\")[^\"]*@", '${1}' . $serverbezeichnung, $cont);
    $cont = preg_replace("@(REX\\['LANG'\\].?\\=.?\")[^\"]*@", '${1}' . $lang, $cont);
    $cont = preg_replace("@(REX\\['INSTNAME'\\].?\\=.?\")[^\"]*@", '${1}' . "rex" . date("YmdHis"), $cont);
    $cont = preg_replace("@(REX\\['ERROR_EMAIL'\\].?\\=.?\")[^\"]*@", '${1}' . $error_email, $cont);
    $cont = preg_replace("@(REX\\['PSWFUNC'\\].?\\=.?\")[^\"]*@", '${1}' . $psw_func, $cont);
    $cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['HOST'\\].?\\=.?\")[^\"]*@", '${1}' . $mysql_host, $cont);
    $cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['LOGIN'\\].?\\=.?\")[^\"]*@", '${1}' . $redaxo_db_user_login, $cont);
    $cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['PSW'\\].?\\=.?\")[^\"]*@", '${1}' . $redaxo_db_user_pass, $cont);
    $cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['NAME'\\].?\\=.?\")[^\"]*@", '${1}' . $dbname, $cont);
    if (rex_put_file_contents($master_file, $cont) === false) {
        $err_msg = $I18N->msg('setup_020', '<b>', '</b>');
    }
    // -------------------------- DATENBANKZUGRIFF
    $err = rex_sql::checkDbConnection($mysql_host, $redaxo_db_user_login, $redaxo_db_user_pass, $dbname, $redaxo_db_create);
    if ($err !== true) {
        $err_msg = $err;
    } else {
        $REX['DB']['1']['NAME'] = $dbname;
        $REX['DB']['1']['LOGIN'] = $redaxo_db_user_login;
        $REX['DB']['1']['PSW'] = $redaxo_db_user_pass;
        $REX['DB']['1']['HOST'] = $mysql_host;
        $err_msg = "";
        $checkmodus = 3;
        $send = "";
    }
} else {
    // Allgemeine Infos
    $serveraddress = $REX['SERVER'];
    $serverbezeichnung = $REX['SERVERNAME'];
開發者ID:BackupTheBerlios,項目名稱:redaxo-svn,代碼行數:31,代碼來源:setup.inc.php

示例3: testCheckConnectionInvalidDatabase

 public function testCheckConnectionInvalidDatabase()
 {
     $configFile = rex_path::data('config.yml');
     $config = rex_file::getConfig($configFile);
     $this->assertTrue(true !== rex_sql::checkDbConnection($config['db'][1]['host'], $config['db'][1]['login'], $config['db'][1]['password'], 'fu-database'));
 }
開發者ID:staabm,項目名稱:redaxo,代碼行數:6,代碼來源:sql_test.php


注:本文中的rex_sql::checkDbConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。