当前位置: 首页>>代码示例>>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;未经允许,请勿转载。