• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysql_client_encoding函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mysql_client_encoding函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_client_encoding函数的具体用法?PHP mysql_client_encoding怎么用?PHP mysql_client_encoding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mysql_client_encoding函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: connect

 /**
  * mysql_connect();
  * Connect and select database.
  * @param string The database host. (default 'localhost')
  * @param string The database username. (default 'root')
  * @param string The database user password. (default '')
  * @return boolean true if new connection, false if not. (default false)
  * @param boolean true if persistent connection, false if not. (default false)
  * @param string The database name.
  * @return string The database table prefix. (default '_')
  */
 function connect($db_host = 'localhost', $db_username = 'root', $db_password = '', $new_link_id = false, $pconnect = false, $db_name, $table_prefix = '_')
 {
     // Construct the username and tables prefix.
     $this->db_username = $db_username;
     $this->db_name = $db_name;
     $this->tbl_pre = $table_prefix;
     // Connect to the database.
     if ($pconnect) {
         $this->link_id = @mysql_pconnect($db_host, $db_username, $db_password);
     } else {
         $this->link_id = @mysql_connect($db_host, $db_username, $db_password, $new_link_id);
     }
     if (!$this->link_id) {
         $this->db_error('connect', $db_host);
     }
     // Valid db charset and set custom charset if it defined.
     // Select db.
     if ($this->link_id) {
         $this->valid_charset = @mysql_client_encoding($this->link_id);
         if (defined('DB_CHARSET') && DB_CHARSET != '') {
             $this->query("SET NAMES " . DB_CHARSET);
         }
         if (!@mysql_select_db($this->db_name, $this->link_id)) {
             $this->db_error('select', '');
         } else {
             return $this->link_id;
         }
     }
     unset($db_host, $db_username, $db_password, $new_link_id, $pconnect, $db_name, $table_prefix);
 }
开发者ID:vijay-panchal,项目名称:myAvazonic,代码行数:41,代码来源:db.php


示例2: db_get_encoding

function db_get_encoding($error_checking = true)
{
    global $MySQL;
    $res = mysql_client_encoding($MySQL->link);
    if ($error_checking && !$res) {
        genMySQLErr('Database get encoding error');
    }
    return $res;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:9,代码来源:db.inc.php


示例3: GetCharSet

 function GetCharSet()
 {
     if (function_exists('mysql_client_encoding')) {
         $this->charSet = @mysql_client_encoding($this->_connectionID);
     }
     if (!$this->charSet) {
         return false;
     } else {
         return $this->charSet;
     }
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:11,代码来源:adodb-mysql.inc.php


示例4: _doError

 private function _doError()
 {
     if ($this->database->getAdapter()->hasError()) {
         $e = $this->database->getAdapter()->getError();
         $m = array();
         $m[] = 'Database Error : ' . $e->getCode();
         $m[] = 'Message: ' . $e->getMessage();
         $m[] = 'Query: ' . $e->getQuery();
         $m[] = 'Encoding: ' . mysql_client_encoding();
         trigger_error(implode('<br />', $m));
     }
 }
开发者ID:BGCX261,项目名称:zoombi-svn-to-git,代码行数:12,代码来源:databasemodel.php


示例5: connect

 function connect()
 {
     if ($GLOBALS['db_link']) {
         return;
     }
     profile_point('H2Database:connect() start');
     $GLOBALS['db_link'] = mysql_pconnect(cfg('db/host'), cfg('db/user'), cfg('db/password')) or critical('The database connection to server ' . cfg('db/user') . '@' . cfg('db/host') . ' could not be established (code: ' . @mysql_error($GLOBALS['db_link']) . ')');
     mysql_select_db(cfg('db/database'), $GLOBALS['db_link']) or critical('The database connection to database ' . cfg('db/database') . ' on ' . cfg('db/user') . '@' . cfg('db/host') . ' could not be established. (code: ' . @mysql_error($GLOBALS['db_link']) . ')');
     if (mysql_client_encoding() != 'utf8') {
         mysql_set_charset('utf8');
     }
     profile_point('H2Database:connect() done');
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:13,代码来源:H2Database.php


示例6: lazyConnect

 protected function lazyConnect()
 {
     $this->connection = mysql_connect($this->host, $this->user, $this->pass);
     if (!$this->connection) {
         throw new MySquirrelException_ConnectionError('Could not connect to ' . $this->host . '.');
     }
     $select_db = mysql_select_db($this->database, $this->connection);
     if (!$select_db) {
         throw new MySquirrelException_ConnectionError('Could not select database ' . $this->database . '.');
     }
     // Attempt to change the character set if necessary.
     if ($this->charset !== false) {
         if (function_exists('mysql_set_charset')) {
             $select_charset = mysql_set_charset($this->charset, $this->connection);
         } elseif (mysql_client_encoding($this->connection) !== $this->charset) {
             $msg = 'Changing the character set requires MySQL 5.0.7 or higher, and PHP 5.2.3 or higher. ';
             $msg .= 'Your database\'s default character set is ' . mysql_client_encoding($this->connection) . '.';
             throw new MySquirrelException_CharacterSetError($msg);
         }
     }
 }
开发者ID:kijin,项目名称:mysquirrel,代码行数:21,代码来源:mysquirrel.php


示例7: __tcSqlLogEnd

function __tcSqlLogEnd($result, $cachedResult = 0)
{
    global $__tcSqlLog, $__tcSqlQueryBeginTime, $__tcSqlLogCount, $__tcPageStartTime;
    static $client_encoding = '';
    $tcSqlQueryEndTime = explode(' ', microtime());
    $elapsed = $tcSqlQueryEndTime[1] - $__tcSqlQueryBeginTime[1] + ($tcSqlQueryEndTime[0] - $__tcSqlQueryBeginTime[0]);
    if (!$client_encoding) {
        $client_encoding = str_replace('_', '-', mysql_client_encoding());
    }
    if ($client_encoding != 'utf8' && function_exists('iconv')) {
        $__tcSqlLog[$__tcSqlLogCount]['error'] = iconv($client_encoding, 'utf-8', mysql_error());
    } else {
        $__tcSqlLog[$__tcSqlLogCount]['error'] = mysql_error();
    }
    $__tcSqlLog[$__tcSqlLogCount]['errno'] = mysql_errno();
    if ($cachedResult == 0) {
        $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = ceil($elapsed * 10000) / 10;
    } else {
        $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = 0;
    }
    $__tcSqlLog[$__tcSqlLogCount]['elapsed'] = sprintf("%4.1f", $__tcSqlLog[$__tcSqlLogCount]['elapsed']);
    $__tcSqlLog[$__tcSqlLogCount]['cached'] = $cachedResult;
    $__tcSqlLog[$__tcSqlLogCount]['rows'] = 0;
    $__tcSqlLog[$__tcSqlLogCount]['endtime'] = $tcSqlQueryEndTime[1] - $__tcPageStartTime[1] + ($tcSqlQueryEndTime[0] - $__tcPageStartTime[0]);
    $__tcSqlLog[$__tcSqlLogCount]['endtime'] = sprintf("%4.1f", ceil($__tcSqlLog[$__tcSqlLogCount]['endtime'] * 10000) / 10);
    if (!$cachedResult && mysql_errno() == 0) {
        switch (strtolower(substr($__tcSqlLog[$__tcSqlLogCount]['sql'], 0, 6))) {
            case 'select':
                $__tcSqlLog[$__tcSqlLogCount]['rows'] = mysql_num_rows($result);
                break;
            case 'insert':
            case 'delete':
            case 'update':
                $__tcSqlLog[$__tcSqlLogCount]['rows'] = mysql_affected_rows();
                break;
        }
    }
    $__tcSqlLogCount++;
    $__tcSqlQueryBeginTime = 0;
}
开发者ID:ragi79,项目名称:Textcube,代码行数:40,代码来源:Debug.php


示例8: Connect

 function Connect($host, $user, $pass)
 {
     error_reporting(null);
     global $CONFIG_mysql_charset;
     $this->link = mysql_connect($host, $user, $pass);
     $GLOBALS['link'] = $this->link;
     if (!$this->link) {
         $this->error_found("01");
     }
     switch ($CONFIG_mysql_charset) {
         case auto:
             $this->charset = mysql_client_encoding($this->link);
             mysql_query("SET NAMES " . $this->charset . "");
             break;
         case disable:
             break;
         default:
             mysql_query("SET NAMES " . $CONFIG_mysql_charset . "");
             break;
     }
     return true;
 }
开发者ID:koeznailbiter,项目名称:Koez-RO-CP,代码行数:22,代码来源:function.php


示例9: connect

 function connect($host = NULL, $user = NULL, $password = NULL, $port = "3306")
 {
     if ($host) {
         $this->_connection['host'] = $host;
     }
     if ($user) {
         $this->_connection['user'] = $user;
     }
     if ($password) {
         $this->_connection['pass'] = $password;
     }
     if ($port) {
         $this->_connection['port'] = $port;
     }
     $this->_connection['id'] = @mysql_connect($this->_connection['host'] . ":" . $this->_connection['port'], $this->_connection['user'], $this->_connection['pass']);
     if (!$this->isConnected()) {
         $this->__error("Error establishing database connection: Check details");
         return false;
     }
     $this->_client_info = mysql_get_client_info();
     $this->_client_encoding = mysql_client_encoding($this->_connection['id']);
     return true;
 }
开发者ID:symphonycms,项目名称:symphony-1.7,代码行数:23,代码来源:class.mysql.php


示例10: mysql_client_encoding

    echo "</script>";
}
// include the default language
require_once WB_PATH . '/modules/foldergallery/languages/EN.php';
// check if module language file exists for the language set by the user (e.g. DE, EN)
if (file_exists(WB_PATH . '/modules/foldergallery/languages/' . LANGUAGE . '.php')) {
    require_once WB_PATH . '/modules/foldergallery/languages/' . LANGUAGE . '.php';
}
// Files includen
require_once WB_PATH . '/modules/foldergallery/info.php';
require_once WB_PATH . '/modules/foldergallery/admin/scripts/backend.functions.php';
require_once WB_PATH . '/modules/foldergallery/class/class.upload.php';
require_once WB_PATH . '/modules/foldergallery/class/validator.php';
require_once WB_PATH . '/modules/foldergallery/class/DirectoryHandler.Class.php';
//  Set the mySQL encoding to utf8
$oldMysqlEncoding = mysql_client_encoding();
mysql_set_charset('utf8', $database->db_handle);
$settings = getSettings($section_id);
$root_dir = $settings['root_dir'];
//Chio
if (isset($_GET['cat_id']) && is_numeric($_GET['cat_id'])) {
    $cat_id = $_GET['cat_id'];
} else {
    $error['no_cat_id'] = 1;
    $admin->print_error('lost cat', ADMIN_URL . '/pages/modify.php?page_id=' . $page_id . '&section_id=' . $section_id);
    die;
}
// Kategorie Infos aus der DB holen
$sql = 'SELECT * FROM ' . TABLE_PREFIX . 'mod_foldergallery_categories WHERE id=' . $cat_id . ' LIMIT 1;';
$query = $database->query($sql);
$categorie = $query->fetchRow();
开发者ID:dev4me,项目名称:Foldergallery,代码行数:31,代码来源:modify_cat.php


示例11: doDiagnostics


//.........这里部分代码省略.........
    if (function_exists('gd_info')) {
        $gd_info = gd_info();
        $gd_support = array();
        if ($gd_info['GIF Create Support']) {
            $gd_support[] = 'GIF';
        }
        if ($gd_info['JPG Support']) {
            $gd_support[] = 'JPG';
        }
        if ($gd_info['PNG Support']) {
            $gd_support[] = 'PNG';
        }
        if ($gd_support) {
            $gd_support = join(', ', $gd_support);
        } else {
            $gd_support = gTxt('none');
        }
        $gd = gTxt('gd_info', array('{version}' => $gd_info['GD Version'], '{supported}' => $gd_support));
    } else {
        $gd = gTxt('gd_unavailable');
    }
    if (realpath($prefs['tempdir']) == realpath($prefs['plugin_cache_dir'])) {
        $fail['tmp_plugin_paths_match'] = gTxt('tmp_plugin_paths_match');
    }
    echo pagetop(gTxt('tab_diagnostics'), ''), startTable('list'), tr(td(hed(gTxt('preflight_check'), 1)));
    if ($fail) {
        foreach ($fail as $help => $message) {
            echo tr(tda(nl2br($message) . sp . popHelp($help), ' class="not-ok"'));
        }
    } else {
        echo tr(tda(gTxt('all_checks_passed'), ' class="ok"'));
    }
    echo tr(td(hed(gTxt('diagnostic_info'), 1)));
    $fmt_date = '%Y-%m-%d %H:%M:%S';
    $out = array('<textarea cols="78" rows="18" readonly="readonly" style="width: 500px; height: 300px;">', gTxt('txp_version') . cs . txp_version . ' (' . ($rev ? 'r' . $rev : 'unknown revision') . ')' . n, gTxt('last_update') . cs . gmstrftime($fmt_date, $dbupdatetime) . '/' . gmstrftime($fmt_date, @filemtime(txpath . '/update/_update.php')) . n, gTxt('document_root') . cs . @$_SERVER['DOCUMENT_ROOT'] . ($real_doc_root != @$_SERVER['DOCUMENT_ROOT'] ? ' (' . $real_doc_root . ')' : '') . n, '$path_to_site' . cs . $path_to_site . n, gTxt('txp_path') . cs . txpath . n, gTxt('permlink_mode') . cs . $permlink_mode . n, ini_get('open_basedir') ? 'open_basedir: ' . ini_get('open_basedir') . n : '', ini_get('upload_tmp_dir') ? 'upload_tmp_dir: ' . ini_get('upload_tmp_dir') . n : '', gTxt('tempdir') . cs . $tempdir . n, gTxt('web_domain') . cs . $siteurl . n, getenv('TZ') ? 'TZ: ' . getenv('TZ') . n : '', gTxt('php_version') . cs . phpversion() . n, $is_register_globals ? gTxt('register_globals') . cs . $is_register_globals . n : '', gTxt('gd_library') . cs . $gd . n, gTxt('server_time') . cs . strftime('%Y-%m-%d %H:%M:%S') . n, 'MySQL' . cs . mysql_get_server_info() . n, gTxt('locale') . cs . $locale . n, isset($_SERVER['SERVER_SOFTWARE']) ? gTxt('server') . cs . $_SERVER['SERVER_SOFTWARE'] . n : '', is_callable('apache_get_version') ? gTxt('apache_version') . cs . apache_get_version() . n : '', gTxt('php_sapi_mode') . cs . PHP_SAPI . n, gTxt('rfc2616_headers') . cs . ini_get('cgi.rfc2616_headers') . n, gTxt('os_version') . cs . php_uname('s') . ' ' . php_uname('r') . n, $active_plugins ? gTxt('active_plugins') . cs . join(', ', $active_plugins) . n : '', $fail ? n . gTxt('preflight_check') . cs . n . ln . join("\n", $fail) . n . ln : '', is_readable($path_to_site . '/.htaccess') ? n . gTxt('htaccess_contents') . cs . n . ln . htmlspecialchars(join('', file($path_to_site . '/.htaccess'))) . n . ln : '');
    if ($step == 'high') {
        $mysql_client_encoding = is_callable('mysql_client_encoding') ? mysql_client_encoding() : '-';
        $out[] = n . 'Charset (default/config)' . cs . $mysql_client_encoding . '/' . @$txpcfg['dbcharset'] . n;
        $result = safe_query("SHOW variables like 'character_se%'");
        while ($row = mysql_fetch_row($result)) {
            $out[] = $row[0] . cs . $row[1] . n;
            if ($row[0] == 'character_set_connection') {
                $conn_char = $row[1];
            }
        }
        $table_names = array(PFX . 'textpattern');
        $result = safe_query("SHOW TABLES LIKE '" . PFX . "txp\\_%'");
        while ($row = mysql_fetch_row($result)) {
            $table_names[] = $row[0];
        }
        $table_msg = array();
        foreach ($table_names as $table) {
            $ctr = safe_query("SHOW CREATE TABLE " . $table . "");
            if (!$ctr) {
                unset($table_names[$table]);
                continue;
            }
            $ctcharset = preg_replace('#^CREATE TABLE.*SET=([^ ]+)[^)]*$#is', '\\1', mysql_result($ctr, 0, 'Create Table'));
            if (isset($conn_char) && !stristr($ctcharset, 'CREATE') && $conn_char != $ctcharset) {
                $table_msg[] = "{$table} is {$ctcharset}";
            }
            $ctr = safe_query("CHECK TABLE " . $table);
            if (in_array(mysql_result($ctr, 0, 'Msg_type'), array('error', 'warning'))) {
                $table_msg[] = $table . cs . mysql_result($ctr, 0, 'Msg_Text');
            }
        }
        if ($table_msg == array()) {
            $table_msg = count($table_names) < 18 ? array('-') : array('OK');
        }
        $out[] = count($table_names) . ' Tables' . cs . implode(', ', $table_msg) . n;
        $extns = get_loaded_extensions();
        $extv = array();
        foreach ($extns as $e) {
            $extv[] = $e . (phpversion($e) ? '/' . phpversion($e) : '');
        }
        $out[] = n . gTxt('php_extensions') . cs . join(', ', $extv) . n;
        if (is_callable('apache_get_modules')) {
            $out[] = n . gTxt('apache_modules') . cs . join(', ', apache_get_modules()) . n;
        }
        if (@is_array($pretext_data) and count($pretext_data) > 1) {
            $out[] = n . gTxt('pretext_data') . cs . htmlspecialchars(join('', array_slice($pretext_data, 1, 20))) . n;
        }
        $out[] = n;
        foreach ($files as $f) {
            $rev = '';
            $checksum = '';
            if (is_callable('md5_file')) {
                $checksum = md5_file(txpath . $f);
            }
            if (isset($file_revs[$f])) {
                $rev = $file_revs[$f];
            }
            $out[] = "{$f}" . cs . ($rev ? "r" . $rev : gTxt('unknown')) . ' (' . ($checksum ? $checksum : gTxt('unknown')) . ')' . n;
        }
    }
    $out[] = '</textarea>' . br;
    $dets = array('low' => gTxt('low'), 'high' => gTxt('high'));
    $out[] = form(eInput('diag') . n . gTxt('detail') . cs . selectInput('step', $dets, $step, 0, 1));
    echo tr(td(join('', $out))), endTable();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:txp_diag.php


示例12: getCharSet

 /**
  * get the used character set.
  * if you didnt manually selected one, the one chosen on the server will
  * be returned
  *
  * @access public
  * @return string
  */
 public function getCharSet()
 {
     if ($this->isConnected()) {
         return mysql_client_encoding($this->_connection);
     } else {
         return $this->dbCharSet;
     }
 }
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:16,代码来源:MySql.php


示例13: mysql_connect

Return Values

Returns the default character set name for the current connection. 
*/
require 'MySQLConverterTool/UnitTests/Converter/TestCode/config.php';
$con = mysql_connect($host, $user, $pass);
if (!$con) {
    printf("FAILURE: [%d] %s\n", mysql_errno(), mysql_error());
} else {
    print "SUCCESS: connect\n";
}
if (!mysql_select_db($db, $con)) {
    printf("FAILURE: [%d] %s\n", mysql_errno($con), mysql_error($con));
}
$encoding_default = mysql_client_encoding();
$encoding_con = mysql_client_encoding($con);
if ($encoding_con != $encoding_default) {
    printf("FAILURE: different client encodings reported, [%d] %s\n", mysql_errno($con), mysql_error($con));
} else {
    if (!is_string($encoding_con)) {
        printf("FAILURE: no string returned, [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
}
mysql_close($con);
?>
--EXPECT-EXT/MYSQL-OUTPUT--
SUCCESS: connect

--EXPECT-EXT/MYSQL-PHP-ERRORS--
--EXPECT-EXT/MYSQLI-OUTPUT--
SUCCESS: connect
开发者ID:josenobile,项目名称:MySQLConverterTool,代码行数:31,代码来源:conn_param003.php


示例14: client_encoding

 function client_encoding()
 {
     return mysql_client_encoding($this->connect_id);
 }
开发者ID:Amine12boutouil,项目名称:Kleeja-2.0.0-alpha,代码行数:4,代码来源:mysql.php


示例15: encoding

 /**
  * Gets or sets the encoding for the connection.
  *
  * @param $encoding
  * @return mixed If setting the encoding; returns true on success, else false.
  *         When getting, returns the encoding.
  */
 public function encoding($encoding = null)
 {
     $encodingMap = array('UTF-8' => 'utf8');
     if (empty($encoding)) {
         $encoding = mysql_client_encoding($this->connection);
         return ($key = array_search($encoding, $encodingMap)) ? $key : $encoding;
     }
     $encoding = isset($encodingMap[$encoding]) ? $encodingMap[$encoding] : $encoding;
     return mysql_set_charset($encoding, $this->connection);
 }
开发者ID:WarToaster,项目名称:HangOn,代码行数:17,代码来源:MySql.php


示例16: clientEncoding

 function clientEncoding()
 {
     /* 返回字符集的名称 */
     return mysql_client_encoding($this->LinkId);
 }
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:5,代码来源:db.php


示例17: DoliDb

 /**
  *	Ouverture d'une connexion vers le serveur et eventuellement une database.
  *	@param      type		Type de base de donnees (mysql ou pgsql)
  *	@param	    host		Addresse de la base de donnees
  *	@param	    user		Nom de l'utilisateur autorise
  *	@param	    pass		Mot de passe
  *	@param	    name		Nom de la database
  *	@param	    port		Port of database server
  *	@return	    int			1 en cas de succes, 0 sinon
  */
 function DoliDb($type = 'mysql', $host, $user, $pass, $name = '', $port = 0)
 {
     global $conf, $langs;
     if (!empty($conf->db->character_set)) {
         $this->forcecharset = $conf->db->character_set;
     }
     if (!empty($conf->db->dolibarr_main_db_collation)) {
         $this->forcecollate = $conf->db->dolibarr_main_db_collation;
     }
     $this->database_user = $user;
     $this->transaction_opened = 0;
     //print "Name DB: $host,$user,$pass,$name<br>";
     if (!function_exists("mysql_connect")) {
         $this->connected = 0;
         $this->ok = 0;
         $this->error = "Mysql PHP functions for using MySql driver are not available in this version of PHP. Try to use another driver.";
         dol_syslog("DoliDB::DoliDB : Mysql PHP functions for using Mysql driver are not available in this version of PHP. Try to use another driver.", LOG_ERR);
         return $this->ok;
     }
     if (!$host) {
         $this->connected = 0;
         $this->ok = 0;
         $this->error = $langs->trans("ErrorWrongHostParameter");
         dol_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters", LOG_ERR);
         return $this->ok;
     }
     // Essai connexion serveur
     $this->db = $this->connect($host, $user, $pass, $name, $port);
     if ($this->db) {
         $this->connected = 1;
         $this->ok = 1;
     } else {
         // host, login ou password incorrect
         $this->connected = 0;
         $this->ok = 0;
         $this->error = mysql_error();
         dol_syslog("DoliDB::DoliDB : Erreur Connect mysql_error=" . $this->error, LOG_ERR);
     }
     // Si connexion serveur ok et si connexion base demandee, on essaie connexion base
     if ($this->connected && $name) {
         if ($this->select_db($name)) {
             $this->database_selected = 1;
             $this->database_name = $name;
             $this->ok = 1;
             // If client connected with different charset than Dolibarr HTML output
             $clientmustbe = '';
             if (preg_match('/UTF-8/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'utf8';
             }
             if (preg_match('/ISO-8859-1/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'latin1';
             }
             if (mysql_client_encoding($this->db) != $clientmustbe) {
                 $this->query("SET NAMES '" . $clientmustbe . "'", $this->db);
                 //$this->query("SET CHARACTER SET ". $this->forcecharset);
             }
         } else {
             $this->database_selected = 0;
             $this->database_name = '';
             $this->ok = 0;
             $this->error = $this->error();
             dol_syslog("DoliDB::DoliDB : Erreur Select_db " . $this->error, LOG_ERR);
         }
     } else {
         // Pas de selection de base demandee, ok ou ko
         $this->database_selected = 0;
         if ($this->connected) {
             // If client connected with different charset than Dolibarr HTML output
             $clientmustbe = '';
             if (preg_match('/UTF-8/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'utf8';
             }
             if (preg_match('/ISO-8859-1/i', $conf->file->character_set_client)) {
                 $clientmustbe = 'latin1';
             }
             if (mysql_client_encoding($this->db) != $clientmustbe) {
                 $this->query("SET NAMES '" . $clientmustbe . "'", $this->db);
                 //$this->query("SET CHARACTER SET ". $this->forcecharset);
             }
         }
     }
     return $this->ok;
 }
开发者ID:netors,项目名称:dolibarr,代码行数:93,代码来源:mysql.lib.php


示例18: printf

} else {
    print "SUCCESS: connect\n";
}
if (!mysql_select_db($db, $con)) {
    printf("FAILURE: [%d] %s\n", mysql_errno($con), mysql_error($con));
}
$encoding_default = mysql_client_encoding();
$encoding_con = mysql_client_encoding($con);
if ($encoding_con != $encoding_default) {
    printf("FAILURE: different client encodings reported, [%d] %s\n", mysql_errno($con), mysql_error($con));
} else {
    if (!is_string($encoding_con)) {
        printf("FAILURE: no string returned, [%d] %s\n", mysql_errno($con), mysql_error($con));
    }
}
$encoding_con = mysql_client_encoding($illegal_link_identifier);
if (!is_null($encoding_con)) {
    printf("FAILURE: NULL value expected, got %s value\n", gettype($encoding_con));
}
mysql_close($con);
?>
--EXPECT-EXT/MYSQL-OUTPUT--
SUCCESS: connect

--EXPECT-EXT/MYSQL-PHP-ERRORS--
--EXPECT-EXT/MYSQLI-OUTPUT--
SUCCESS: connect

--EXPECT-EXT/MYSQLI-PHP-ERRORS--
43, E_NOTICE, Undefined variable: illegal_link_identifier
43, E_WARNING, mysqli_character_set_name() expects parameter 1 to be mysqli, null given
开发者ID:josenobile,项目名称:MySQLConverterTool,代码行数:31,代码来源:conn_param004.php


示例19: str_replace

 }
 if (substr($line, 0, 2) == "--" or empty($line)) {
     continue;
 }
 $line = str_replace("/*!40000", "", $line);
 $line = str_replace("/*!40101", "", $line);
 $line = str_replace("/*!40103", "", $line);
 $line = str_replace("/*!40014", "", $line);
 $line = str_replace("/*!40111", "", $line);
 $line = str_replace("*/;", ";", trim($line));
 if (substr($line, 0, 9) == "SET NAMES") {
     $chrset = trim(str_replace("'", "", substr($line, 10, -1)));
     if (function_exists("mysql_set_charset")) {
         mysql_set_charset($chrset);
     }
     if (defined('DB_CHARSET') and $chrset != DB_CHARSET or $chrset != mysql_client_encoding()) {
         echo __('ERROR:', 'backwpup') . ' ' . sprintf(__('Pleace set <i>define(\'DB_CHARSET\', \'%1$s\');</i> in wp-config.php', 'backwpup'), $chrset) . "<br />\n";
         break;
     }
 }
 $command = "";
 if (";" == substr($line, -1)) {
     $command = $rest . $line;
     $rest = "";
 } else {
     $rest .= $line;
 }
 if (!empty($command)) {
     $result = mysql_query($command);
     if ($sqlerr = mysql_error($wpdb->dbh)) {
         echo __('ERROR:', 'backwpup') . ' ' . sprintf(__('BackWPup database error %1$s for query %2$s', 'backwpup'), $sqlerr, $command) . "<br />\n";
开发者ID:hscale,项目名称:webento,代码行数:31,代码来源:db_restore.php


示例20: getDbInfo

 public function getDbInfo()
 {
     $charsets = $this->getCharsetInfo();
     $charset_str = array();
     foreach ($charsets as $name => $value) {
         $charset_str[] = "{$name} = {$value}";
     }
     return array("MySQL Version" => @mysql_get_client_info(), "MySQL Host Info" => @mysql_get_host_info($this->database), "MySQL Server Info" => @mysql_get_server_info($this->database), "MySQL Client Encoding" => @mysql_client_encoding($this->database), "MySQL Character Set Settings" => join(", ", $charset_str));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:9,代码来源:MysqlManager.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysql_close函数代码示例发布时间:2022-05-15
下一篇:
PHP mysql_clean函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap