本文整理汇总了PHP中mysqli_get_client_version函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_get_client_version函数的具体用法?PHP mysqli_get_client_version怎么用?PHP mysqli_get_client_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_get_client_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump_properties
function dump_properties($mysqli)
{
printf("\nClass variables:\n");
$variables = array_keys(get_class_vars(get_class($mysqli)));
sort($variables);
foreach ($variables as $k => $var) {
printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
}
printf("\nObject variables:\n");
$variables = array_keys(get_object_vars($mysqli));
foreach ($variables as $k => $var) {
printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
}
printf("\nMagic, magic properties:\n");
assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
assert(@mysqli_get_client_info() === @$mysqli->client_info);
printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", @$mysqli->client_info, gettype(@$mysqli->client_info), @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
assert(@mysqli_get_client_version() === @$mysqli->client_version);
printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n", @$mysqli->client_version, gettype(@$mysqli->client_version), @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
assert(@mysqli_errno($mysqli) === @$mysqli->errno);
printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", @$mysqli->errno, gettype(@$mysqli->errno), @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
assert(@mysqli_error($mysqli) === @$mysqli->error);
printf("mysqli->error = '%s'/%s ('%s'/%s)\n", @$mysqli->error, gettype(@$mysqli->error), @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", @$mysqli->field_count, gettype(@$mysqli->field_count), @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", @$mysqli->insert_id, gettype(@$mysqli->insert_id), @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", @$mysqli->host_info, gettype(@$mysqli->host_info), @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
/* note that the data types are different */
assert(@mysqli_info($mysqli) == @$mysqli->info);
printf("mysqli->info = '%s'/%s ('%s'/%s)\n", @$mysqli->info, gettype(@$mysqli->info), @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", @$mysqli->thread_id, gettype(@$mysqli->thread_id), @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", @$mysqli->server_info, gettype(@$mysqli->server_info), @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", @$mysqli->server_version, gettype(@$mysqli->server_version), @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", @$mysqli->warning_count, gettype(@$mysqli->warning_count), @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
printf("\nAccess to undefined properties:\n");
printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
@($mysqli->unknown = 13);
printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
$unknown = 'friday';
@($mysqli->unknown = $unknown);
printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
assert(@mysqli_connect_error() === @$mysqli->connect_error);
printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_error, gettype(@$mysqli->connect_error), @mysqli_connect_error(), gettype(@mysqli_connect_error()));
assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
}
示例2: get_mysql_client_version
/**
* A string that represents the MySQL client library version.
*
* @param DB $db
*
* @return string
*/
public static function get_mysql_client_version(DB $db)
{
static $_mysqli_client_version = null;
if ($_mysqli_client_version === null) {
$_mysqli_client_version = \mysqli_get_client_version($db->getLink());
}
return $_mysqli_client_version;
}
示例3: getMySQLVersion
public function getMySQLVersion()
{
$version = mysqli_get_client_version();
$mv = floor($version / 10000);
$version = $version - $mv * 10000;
$sv = floor($version / 100);
$bv = $version - $sv * 100;
return $mv . "." . $sv . "." . $bv;
//return mysqli_get_client_version();
}
示例4: checkMysqlClientVersion
function checkMysqlClientVersion()
{
$mysqli = new mysqli("127.0.0.1", "bober", "YaB2sQR346VbNcee", "bober", 3307);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
return mysqli_get_client_version($mysqli);
}
示例5: check
public function check()
{
$data = array();
$status = 1;
//输出基本配置信息
$data['env']['操作系统'] = array('need' => '不限制', 'best' => '类Unix', 'current' => PHP_OS);
$data['env']['PHP'] = array('need' => '5.2', 'best' => '5.4 or new', 'current' => PHP_VERSION);
if (function_exists('mysqli_get_client_version')) {
$current = 'mysqli:' . mysqli_get_client_version();
} elseif (function_exists('mysql_get_client_info')) {
$current = 'mysql:' . mysql_get_client_info();
} else {
$current = '未安装';
$status = 0;
}
$data['env']['数据库'] = array('need' => '与php版本对应', 'best' => '与php版本对应', 'current' => $current);
$gd_info = array();
if (function_exists('gd_info')) {
$gd_info = gd_info();
} else {
$status = 0;
}
$data['env']['GD库'] = array('need' => '1.0', 'best' => '2.0', 'current' => isset($gd_info['GD Version']) ? $gd_info['GD Version'] : '未安装');
$curl_version = array();
if (function_exists('curl_version')) {
$curl_version = curl_version();
} else {
$status = 0;
}
$data['env']['CURL扩展'] = array('need' => '与php版本对应', 'best' => '与php版本对应', 'current' => isset($curl_version['version']) ? $curl_version['version'] : '未安装');
if (class_exists('ZipArchive')) {
$current = '已安装';
} else {
$current = '未安装';
$status = 0;
}
$data['env']['ZIP扩展'] = array('need' => '与php版本对应', 'best' => '与php版本对应', 'current' => $current);
//检查文件是否可写
$check_write_file = array();
$check_write_file = array('api/application/config/database.php' => APPPATH . 'config/database.php', 'api/application/cache' => APPPATH . 'cache', 'api/application/logs' => APPPATH . 'logs', 'api/resources' => dirname(APPPATH) . '/resources');
foreach ($check_write_file as $item => $file) {
if (is_writable($file)) {
$is_writable = 1;
} else {
$is_writable = 0;
$status = 0;
}
$data['writeable'][$item] = $is_writable;
}
$data['allow_next'] = $status;
echo $this->to_api_message(1, 'check_env', $data);
}
示例6: dbcheck_mysqli
function dbcheck_mysqli()
{
global $language, $lang_update_php;
if (!isset($language)) {
$language = $lang_update_php;
}
if (!function_exists('mysqli_connect')) {
return $language['not_available'];
}
if (mysqli_get_client_version() < 40000) {
return $language['version_too_old'];
}
return true;
}
示例7: array
$dbList = null;
$dbTests = array('mysql_connect', 'mysqli_connect', 'pg_connect', 'mssql_connect', 'sqlite_open');
foreach ($dbTests as $test) {
if (function_exists($test) && is_callable($test)) {
$db = explode('_', $test);
switch ($db[0]) {
default:
$dbList[] = $db[0];
break;
case 'mysql':
$dbList[] = $db[0] . ' (Server: ' . mysql_get_server_info() . ')';
break;
case 'mysqli':
include cmsROOT . 'cache/config.php';
$mysqli = new mysqli($config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['database']);
$dbList[] = $db[0] . ' (Server: ' . mysqli_get_server_version($mysqli) . ', Client: ' . mysqli_get_client_version() . ')';
$mysqli->close();
unset($mysqli, $config['db']);
break;
case 'sqlite':
$dbList[] = $db[0] . ' (Server: ' . sqlite_libversion() . ')';
break;
case 'pg':
$dbList[] = 'postgre (Server: ' . pg_version() . ')';
break;
}
}
}
if (class_exists('SQLite3', false) && is_callable(array('SQLite3', 'open'))) {
$ver = SQLite3::version();
$dbList[] = 'SQLite3 (Server: ' . $ver['versionString'] . ')';
示例8: printConfig
/**
* Renders stage 2: either config details panel (on success) or database details
* error message (on fail).
*/
function printConfig()
{
$_SESSION['ddb'] = ps('ddb');
$_SESSION['duser'] = ps('duser');
$_SESSION['dpass'] = ps('dpass');
$_SESSION['dhost'] = ps('dhost');
$_SESSION['dprefix'] = ps('dprefix');
$_SESSION['siteurl'] = ps('siteurl');
$GLOBALS['textarray'] = setup_load_lang($_SESSION['lang']);
global $txpcfg;
echo txp_setup_progress_meter(2) . n . '<div class="txp-setup">';
if (!isset($txpcfg['db'])) {
@(include txpath . '/config.php');
}
if (!empty($txpcfg['db'])) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-alert')) . ' ' . setup_gTxt('already_installed', array('{txpath}' => txpath)), array('class' => 'alert-block warning')) . setup_back_button(__FUNCTION__) . n . '</div>';
exit;
}
// TODO: @see http://forum.textpattern.com/viewtopic.php?pid=263205#p263205
// if ('' === $_SESSION['dhost'] || '' === $_SESSION['duser'] || '' === $_SESSION['ddb']) {
// echo graf(
// span(null, array('class' => 'ui-icon ui-icon-alert')).' '.
// setup_gTxt('missing_db_details'),
// array('class' => 'alert-block warning')
// ).
// n.setup_back_button(__FUNCTION__).
// n.'</div>';
//
// exit;
// }
echo hed(setup_gTxt("checking_database"), 2);
if (strpos($_SESSION['dhost'], ':') === false) {
$dhost = $_SESSION['dhost'];
$dport = ini_get("mysqli.default_port");
} else {
list($dhost, $dport) = explode(':', $_SESSION['dhost'], 2);
$dport = intval($dport);
}
$dsocket = ini_get("mysqli.default_socket");
$mylink = mysqli_init();
if (@mysqli_real_connect($mylink, $dhost, $_SESSION['duser'], $_SESSION['dpass'], '', $dport, $dsocket)) {
$_SESSION['dclient_flags'] = 0;
} elseif (@mysqli_real_connect($mylink, $dhost, $_SESSION['duser'], $_SESSION['dpass'], '', $dport, $dsocket, MYSQLI_CLIENT_SSL)) {
$_SESSION['dclient_flags'] = 'MYSQLI_CLIENT_SSL';
} else {
echo graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('db_cant_connect'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>';
exit;
}
echo graf(span(null, array('class' => 'ui-icon ui-icon-check')) . ' ' . setup_gTxt('db_connected'), array('class' => 'alert-block success'));
if (!($_SESSION['dprefix'] == '' || preg_match('#^[a-zA-Z_][a-zA-Z0-9_]*$#', $_SESSION['dprefix']))) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('prefix_bad_characters', array('{dbprefix}' => strong(txpspecialchars($_SESSION['dprefix']))), 'raw'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>';
exit;
}
if (!($mydb = mysqli_select_db($mylink, $_SESSION['ddb']))) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('db_doesnt_exist', array('{dbname}' => strong(txpspecialchars($_SESSION['ddb']))), 'raw'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>';
exit;
}
$tables_exist = mysqli_query($mylink, "DESCRIBE `" . $_SESSION['dprefix'] . "textpattern`");
if ($tables_exist) {
echo graf(span(null, array('class' => 'ui-icon ui-icon-closethick')) . ' ' . setup_gTxt('tables_exist', array('{dbname}' => strong(txpspecialchars($_SESSION['ddb']))), 'raw'), array('class' => 'alert-block error')) . setup_back_button(__FUNCTION__) . n . '</div>';
exit;
}
// On MySQL 5.5.3+ use real UTF-8 tables, if the client supports it.
$_SESSION['dbcharset'] = "utf8mb4";
// Lower versions only support UTF-8 limited to 3 bytes per character
if (mysqli_get_server_version($mylink) < 50503) {
$_SESSION['dbcharset'] = "utf8";
} else {
if (false !== strpos(mysqli_get_client_info($mylink), 'mysqlnd')) {
// mysqlnd 5.0.9+ required
if (mysqli_get_client_version($mylink) < 50009) {
$_SESSION['dbcharset'] = "utf8";
}
} else {
// libmysqlclient 5.5.3+ required
if (mysqli_get_client_version($mylink) < 50503) {
$_SESSION['dbcharset'] = "utf8";
}
}
}
echo graf(span(null, array('class' => 'ui-icon ui-icon-check')) . ' ' . setup_gTxt('using_db', array('{dbname}' => strong(txpspecialchars($_SESSION['ddb']))), 'raw') . ' (' . $_SESSION['dbcharset'] . ')', array('class' => 'alert-block success'));
echo setup_config_contents() . n . '</div>';
}
示例9: printf
if (empty($expected_methods) && empty($methods)) {
printf("ok\n");
}
printf("\nClass variables:\n");
$variables = array_keys(get_class_vars(get_class($driver)));
sort($variables);
foreach ($variables as $k => $var) {
printf("%s\n", $var);
}
printf("\nObject variables:\n");
$variables = array_keys(get_object_vars($driver));
foreach ($variables as $k => $var) {
printf("%s\n", $var);
}
printf("\nMagic, magic properties:\n");
assert(mysqli_get_client_info() === $driver->client_info);
printf("driver->client_info = '%s'\n", $driver->client_info);
assert(mysqli_get_client_version() === $driver->client_version);
printf("driver->client_version = '%s'\n", $driver->client_version);
assert($driver->driver_version > 0);
printf("driver->driver_version = '%s'\n", $driver->driver_version);
assert(in_array($driver->report_mode, array(MYSQLI_REPORT_ALL, MYSQLI_REPORT_STRICT, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_INDEX, MYSQLI_REPORT_OFF)));
printf("driver->report_mode = '%s'\n", $driver->report_mode);
$driver->report_mode = MYSQLI_REPORT_STRICT;
assert($driver->report_mode === MYSQLI_REPORT_STRICT);
assert(is_bool($driver->embedded));
printf("driver->embedded = '%s'\n", $driver->embedded);
printf("driver->reconnect = '%s'\n", $driver->reconnect);
printf("\nAccess to undefined properties:\n");
printf("driver->unknown = '%s'\n", @$driver->unknown);
print "done!";
示例10: open_cursor
<?php
function open_cursor($mysql, $query)
{
if (!is_object($stmt = $mysql->prepare($query))) {
printf("[001] Cannot create statement object for '%s', [%d] %s\n", $query, $mysql->errno, $mysql->error);
}
$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
return $stmt;
}
require_once "connect.inc";
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
if (!$IS_MYSQLND && mysqli_get_client_version() < 50009 || mysqli_get_server_version($mysql) < 50009) {
/* we really want to skip it... */
die(var_dump(63));
}
$a = array();
for ($i = 0; $i < 3; $i++) {
$mysql->query("DROP TABLE IF EXISTS test_067_table_1{$i}");
$mysql->query("CREATE TABLE test_067_table_1{$i} (a int not null) ENGINE=" . $engine);
$mysql->query("INSERT INTO test_067_table_1{$i} VALUES (1),(2),(3),(4),(5),(6)");
$stmt[$i] = open_cursor($mysql, "SELECT a FROM test_067_table_1{$i}");
$stmt[$i]->execute();
$stmt[$i]->bind_result($a[$i]);
}
$cnt = 0;
while ($stmt[0]->fetch()) {
$stmt[1]->fetch();
$stmt[2]->fetch();
$cnt += $a[0] + $a[1] + $a[2];
}
示例11: process
public function process()
{
global $wp_version;
$mysql_vars = array('key_buffer_size' => true, 'max_allowed_packet' => false, 'max_connections' => false, 'query_cache_limit' => true, 'query_cache_size' => true, 'query_cache_type' => 'ON');
if ($dbq = QM_Collectors::get('db_queries')) {
foreach ($dbq->db_objects as $id => $db) {
$variables = $db->get_results("\n\t\t\t\t\tSHOW VARIABLES\n\t\t\t\t\tWHERE Variable_name IN ( '" . implode("', '", array_keys($mysql_vars)) . "' )\n\t\t\t\t");
if (is_resource($db->dbh)) {
# Old mysql extension
$extension = 'mysql';
} else {
if (is_object($db->dbh)) {
# mysqli or PDO
$extension = get_class($db->dbh);
} else {
# Who knows?
$extension = null;
}
}
if (method_exists($db, 'db_version')) {
$server = $db->db_version();
} else {
$server = null;
}
if (isset($db->use_mysqli) && $db->use_mysqli) {
$client = mysqli_get_client_version();
} else {
if (preg_match('|[0-9]{1,2}\\.[0-9]{1,2}\\.[0-9]{1,2}|', mysql_get_client_info(), $matches)) {
$client = $matches[0];
} else {
$client = null;
}
}
if ($client) {
$client_version = implode('.', QM_Util::get_client_version($client));
$client_version = sprintf('%s (%s)', $client, $client_version);
} else {
$client_version = null;
}
$info = array('extension' => $extension, 'server version' => $server, 'client version' => $client_version, 'user' => $db->dbuser, 'host' => $db->dbhost, 'database' => $db->dbname);
$this->data['db'][$id] = array('info' => $info, 'vars' => $mysql_vars, 'variables' => $variables);
}
}
$this->data['php']['version'] = phpversion();
$this->data['php']['sapi'] = php_sapi_name();
$this->data['php']['user'] = self::get_current_user();
if (defined('HHVM_VERSION')) {
$this->data['php']['hhvm'] = HHVM_VERSION;
}
foreach ($this->php_vars as $setting) {
$this->data['php']['variables'][$setting]['after'] = ini_get($setting);
}
$this->data['php']['error_reporting'] = error_reporting();
$this->data['wp'] = array('version' => $wp_version, 'WP_DEBUG' => self::format_bool_constant('WP_DEBUG'), 'WP_DEBUG_DISPLAY' => self::format_bool_constant('WP_DEBUG_DISPLAY'), 'WP_DEBUG_LOG' => self::format_bool_constant('WP_DEBUG_LOG'), 'SCRIPT_DEBUG' => self::format_bool_constant('SCRIPT_DEBUG'), 'WP_CACHE' => self::format_bool_constant('WP_CACHE'), 'CONCATENATE_SCRIPTS' => self::format_bool_constant('CONCATENATE_SCRIPTS'), 'COMPRESS_SCRIPTS' => self::format_bool_constant('COMPRESS_SCRIPTS'), 'COMPRESS_CSS' => self::format_bool_constant('COMPRESS_CSS'), 'WP_LOCAL_DEV' => self::format_bool_constant('WP_LOCAL_DEV'));
if (is_multisite()) {
$this->data['wp']['SUNRISE'] = self::format_bool_constant('SUNRISE');
}
$server = explode(' ', $_SERVER['SERVER_SOFTWARE']);
$server = explode('/', reset($server));
if (isset($server[1])) {
$server_version = $server[1];
} else {
$server_version = null;
}
if (isset($_SERVER['SERVER_ADDR'])) {
$address = $_SERVER['SERVER_ADDR'];
} else {
$address = null;
}
$this->data['server'] = array('name' => $server[0], 'version' => $server_version, 'address' => $address, 'host' => php_uname('n'));
}
示例12: printf
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t 2.6,58.89,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t '206','6.7')")) {
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
$c = array(0, 0, 0, 0, 0, 0, 0, 0);
$b_res = mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$result = mysqli_query($link, "select * from test_bind_result");
$d = mysqli_fetch_row($result);
mysqli_free_result($result);
$test = "";
for ($i = 0; $i < count($c); $i++) {
$test .= $c[$i] == $d[$i] ? "1" : "0";
}
if ($test == "11111111") {
echo "ok\n";
} else {
if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 && mysqli_get_server_version($link) > 50000) {
echo "error (4.1 library with 5.x server)";
} else {
echo "error";
}
}
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
mysqli_close($link);
print "done!";
示例13: setCharset
/**
* Set the charset on the current connection
*
* @param string charset (or array(charset, collation))
* @param resource connection handle
*
* @return true on success, MDB2 Error Object on failure
*/
function setCharset($charset, $connection = null)
{
if (null === $connection) {
$connection = $this->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
}
$collation = null;
if (is_array($charset) && 2 == count($charset)) {
$collation = array_pop($charset);
$charset = array_pop($charset);
}
$client_info = mysqli_get_client_version();
if (OS_WINDOWS && (40111 > $client_info || 50000 <= $client_info && 50006 > $client_info)) {
$query = "SET NAMES '" . mysqli_real_escape_string($connection, $charset) . "'";
if (null !== $collation) {
$query .= " COLLATE '" . mysqli_real_escape_string($connection, $collation) . "'";
}
return $this->_doQuery($query, true, $connection);
}
if (!($result = mysqli_set_charset($connection, $charset))) {
$err = $this->raiseError(null, null, null, 'Could not set client character set', __FUNCTION__);
return $err;
}
return $result;
}
示例14: printf
<?php
$test_table_name = 'test_mysqli_driver_table_1';
require "table.inc";
if (!is_object($driver = new mysqli_driver())) {
printf("[001] Failed to create mysqli_driver object\n");
}
$client_info = mysqli_get_client_info();
if (($tmp = $driver->client_info) !== $client_info) {
printf("[002] Expecting %s/%s, got %s/%s\n", gettype($client_info), $client_info, gettype($tmp), $tmp);
}
$client_version = mysqli_get_client_version();
if (($tmp = $driver->client_version) !== $client_version) {
printf("[003] Expecting %s/%s, got %s/%s\n", gettype($client_version), $client_version, gettype($tmp), $tmp);
}
if (!is_int($tmp = $driver->driver_version) || 0 == $tmp) {
printf("[004] Expecting int/any, got %s/%s\n", gettype($tmp), $tmp);
}
$all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT, MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
$report_mode = $driver->report_mode;
if (!is_int($report_mode)) {
printf("[005] Expecting int/any, got %s/%s\n", gettype($report_mode), $report_mode);
}
if (!in_array($report_mode, $all_modes)) {
printf("[006] Illegal report mode returned? Got %s, expected %s\n", $report_mode, implode(', ', $all_modes));
}
$driver->report_mode = MYSQLI_REPORT_STRICT;
$ok = false;
try {
if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) {
printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", $host, $user . 'unknown_really', $db, $port, $socket);
示例15: clientVers
function clientVers()
{
$orig = @mysqli_get_client_info($this->_conn);
$vstr = $this->_findVers($orig);
$vint = @mysqli_get_client_version($this->_conn);
return array('orig' => $orig, 'vstr' => $vstr, 'vint' => $vint);
}