本文整理汇总了PHP中mysqli_get_server_version函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_get_server_version函数的具体用法?PHP mysqli_get_server_version怎么用?PHP mysqli_get_server_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_get_server_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ServerVersion
public function ServerVersion()
{
if (empty($this->server_version)) {
$this->server_version = mysqli_get_server_version($this->connectid);
}
return $this->server_version;
}
示例2: 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()));
}
示例3: checkMySQLVersion
public function checkMySQLVersion()
{
$result = mysqli_get_server_version();
$mainVersion = round($result / 10000, 0);
$minorVersion = round(($result - $mainVersion * 10000) / 100, 0);
$subVersion = $result - $minorVersion * 100 - $mainVersion * 10000;
return 1 == version_compare($mainVersion . '.' . $minorVersion . '.' . $subVersion, '4.1', '>=');
}
示例4: get_mysql_server_version
/**
* Returns a string representing the version of the MySQL server that the MySQLi extension is connected to.
*
* @param DB $db
*
* @return string
*/
public static function get_mysql_server_version(DB $db)
{
static $_mysqli_server_version = null;
if ($_mysqli_server_version === null) {
$_mysqli_server_version = \mysqli_get_server_version($db->getLink());
}
return $_mysqli_server_version;
}
示例5: checkMysqlServerVersion
function checkMysqlServerVersion()
{
$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_server_version($mysqli);
}
示例6: connect
/**
* Connect to database
*
* @param array $options
* @return array
*/
public function connect($options)
{
$result = ['version' => null, 'status' => 0, 'error' => [], 'errno' => 0, 'success' => false];
// we could pass an array or connection string right a way
$connection = mysqli_connect($options['host'], $options['username'], $options['password'], $options['dbname'], $options['port']);
if ($connection) {
$this->db_resource = $connection;
$this->connect_options = $options;
$this->commit_status = 0;
mysqli_set_charset($connection, 'utf8');
$result['version'] = mysqli_get_server_version($connection);
$result['status'] = 1;
$result['success'] = true;
} else {
$result['error'][] = mysqli_connect_error();
$result['errno'] = mysqli_connect_errno();
}
return $result;
}
示例7: __construct
/**
* Db_Mysql constructor.
*
* @param array $args
* @throws \Exception
*/
public function __construct(array $args)
{
if (!empty($args['charset'])) {
$args['charset'] = $this->fixMysqlCharset($args['charset']);
}
$this->args = $args;
if (!is_callable('mysql_connect')) {
throw new \Exception(__METHOD__ . ': mysql_connect is not supported.');
}
$this->conn = mysql_connect($args['host'], $args['user'], $args['pass']);
if ($this->conn === false) {
throw new \Exception(__METHOD__ . ': failed to connect to MySQL server.');
}
if (!mysql_select_db($args['name'], $this->conn)) {
throw new \Exception(__METHOD__ . ': could not select database.');
}
$this->serverVersion = @mysqli_get_server_version($this->conn);
if (!empty($args['charset'])) {
if (!mysql_set_charset($args['charset'], $this->conn)) {
@mysql_query("SET NAMES {$args['charset']}");
}
}
}
示例8: ss_get_mysql_stats
function ss_get_mysql_stats($options)
{
# Process connection options.
global $debug, $mysql_user, $mysql_pass, $cache_dir, $poll_time, $chk_options, $mysql_port, $mysql_ssl, $mysql_ssl_key, $mysql_ssl_cert, $mysql_ssl_ca, $mysql_connection_timeout, $heartbeat, $heartbeat_table, $heartbeat_server_id, $heartbeat_utc;
$user = isset($options['user']) ? $options['user'] : $mysql_user;
$pass = isset($options['pass']) ? $options['pass'] : $mysql_pass;
$host = $options['host'];
$port = isset($options['port']) ? $options['port'] : $mysql_port;
$connection_timeout = isset($options['connection-timeout']) ? $options['connection-timeout'] : $mysql_connection_timeout;
$heartbeat_server_id = isset($options['server-id']) ? $options['server-id'] : $heartbeat_server_id;
$sanitized_host = str_replace(array(":", "/"), array("", "_"), $host);
$cache_file = "{$cache_dir}/{$sanitized_host}-mysql_cacti_stats.txt" . ($port != 3306 ? ":{$port}" : '');
debug("Cache file is {$cache_file}");
# First, check the cache.
$fp = null;
if ($cache_dir && !array_key_exists('nocache', $options)) {
if ($fp = fopen($cache_file, 'a+')) {
$locked = flock($fp, 1);
# LOCK_SH
if ($locked) {
if (filesize($cache_file) > 0 && filectime($cache_file) + $poll_time / 2 > time() && ($arr = file($cache_file))) {
# The cache file is good to use.
debug("Using the cache file");
fclose($fp);
return $arr[0];
} else {
debug("The cache file seems too small or stale");
# Escalate the lock to exclusive, so we can write to it.
if (flock($fp, 2)) {
# LOCK_EX
# We might have blocked while waiting for that LOCK_EX, and
# another process ran and updated it. Let's see if we can just
# return the data now:
if (filesize($cache_file) > 0 && filectime($cache_file) + $poll_time / 2 > time() && ($arr = file($cache_file))) {
# The cache file is good to use.
debug("Using the cache file");
fclose($fp);
return $arr[0];
}
ftruncate($fp, 0);
# Now it's ready for writing later.
}
}
} else {
$fp = null;
debug("Couldn't lock the cache file, ignoring it");
}
} else {
$fp = null;
debug("Couldn't open the cache file");
}
} else {
debug("Caching is disabled.");
}
# Connect to MySQL.
debug(array('Connecting to', $host, $port, $user, $pass));
if (!extension_loaded('mysqli')) {
debug("PHP MySQLi extension is not loaded");
die("PHP MySQLi extension is not loaded");
}
if ($mysql_ssl) {
$conn = mysqli_init();
$conn->options(MYSQLI_OPT_CONNECT_TIMEOUT, $connection_timeout);
mysqli_ssl_set($conn, $mysql_ssl_key, $mysql_ssl_cert, $mysql_ssl_ca, NULL, NULL);
mysqli_real_connect($conn, $host, $user, $pass, NULL, $port);
} else {
$conn = mysqli_init();
$conn->options(MYSQLI_OPT_CONNECT_TIMEOUT, $connection_timeout);
mysqli_real_connect($conn, $host, $user, $pass, NULL, $port);
}
if (mysqli_connect_errno()) {
debug("MySQL connection failed: " . mysqli_connect_error());
die("ERROR: " . mysqli_connect_error());
}
# MySQL server version.
# The form of this version number is main_version * 10000 + minor_version * 100 + sub_version
# i.e. version 5.5.44 is 50544.
$mysql_version = mysqli_get_server_version($conn);
debug("MySQL server version is " . $mysql_version);
# Set up variables.
$status = array('relay_log_space' => null, 'binary_log_space' => null, 'current_transactions' => 0, 'locked_transactions' => 0, 'active_transactions' => 0, 'innodb_locked_tables' => 0, 'innodb_tables_in_use' => 0, 'innodb_lock_structs' => 0, 'innodb_lock_wait_secs' => 0, 'innodb_sem_waits' => 0, 'innodb_sem_wait_time_ms' => 0, 'State_closing_tables' => 0, 'State_copying_to_tmp_table' => 0, 'State_end' => 0, 'State_freeing_items' => 0, 'State_init' => 0, 'State_locked' => 0, 'State_login' => 0, 'State_preparing' => 0, 'State_reading_from_net' => 0, 'State_sending_data' => 0, 'State_sorting_result' => 0, 'State_statistics' => 0, 'State_updating' => 0, 'State_writing_to_net' => 0, 'State_none' => 0, 'State_other' => 0);
# Get SHOW STATUS and convert the name-value array into a simple
# associative array.
$result = run_query("SHOW /*!50002 GLOBAL */ STATUS", $conn);
foreach ($result as $row) {
$status[$row[0]] = $row[1];
}
# Get SHOW VARIABLES and do the same thing, adding it to the $status array.
$result = run_query("SHOW VARIABLES", $conn);
foreach ($result as $row) {
$status[$row[0]] = $row[1];
}
# Get SHOW SLAVE STATUS, and add it to the $status array.
if ($chk_options['slave']) {
# Leverage lock-free SHOW SLAVE STATUS if available
$result = run_query("SHOW SLAVE STATUS NONBLOCKING", $conn);
if (!$result) {
$result = run_query("SHOW SLAVE STATUS NOLOCK", $conn);
if (!$result) {
$result = run_query("SHOW SLAVE STATUS", $conn);
//.........这里部分代码省略.........
示例9: printf
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA))) {
printf("[021] Expecting object, got %s/%s. [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
}
/* user conn killed, res associated with conn, fetch from res */
unset($link);
var_dump($res->fetch_assoc());
if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
if (!($res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))) {
printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
if (mysqli_get_server_version($link) > 50000) {
// let's try to play with stored procedures
mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
END;')) {
mysqli_multi_query($link, "CALL p(@version)");
do {
if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
printf("---\n");
var_dump($res->fetch_all());
$res->free();
} else {
if ($link->errno) {
echo "Store failed: (" . $link->errno . ") " . $link->error;
}
}
示例10: printf
<?php
require_once "connect.inc";
$test_table_name = 'test_mysqli_get_server_version_table_1';
require "table.inc";
/* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
/* < 30000 = pre 3.2.3, very unlikely! */
if (!is_int($info = mysqli_get_server_version($link)) || $info < 3 * 10000) {
printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
}
print "done!";
示例11: serverVers
function serverVers()
{
// cache for faster execution:
if (is_array($this->_drvSrvVersArr)) {
return $this->_drvSrvVersArr;
}
$orig = @mysqli_get_server_info($this->_conn);
$vstr = $this->_findVers($orig);
$vint = @mysqli_get_server_version($this->_conn);
$vArr = array('orig' => $orig, 'vstr' => $vstr, 'vint' => $vint);
$this->_drvSrvVersArr = $vArr;
return $vArr;
}
示例12: 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>';
}
示例13: func_mysqli_fetch_array
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
if ($IS_MYSQLND || mysqli_get_server_version($link) >= 51000 && mysqli_get_client_version($link) >= 51000) {
func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
}
func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string) (-9.223372036854776E+18 - 1.1), "-9.22337e+18", 290, "/-9\\.22337e\\+?[0]?18/iu");
func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string) (1.8446744073709552E+19 + 1.1), "1.84467e+?19", 310, "/1\\.84467e\\+?[0]?19/iu");
func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
示例14: my_mysqli
<?php
require_once "connect.inc";
$db = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
$qry = $db->stmt_init();
$qry->prepare("SELECT REPEAT('a',100000)");
$qry->execute();
$qry->bind_result($text);
$qry->fetch();
if ($text !== str_repeat('a', $IS_MYSQLND || mysqli_get_server_version($db) > 50110 ? 100000 : (mysqli_get_server_version($db) >= 50000 ? 8193 : 8191))) {
var_dump(strlen($text));
}
echo "Done";
示例15: mysqli_report
$log_queries_not_using_indexes = false;
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_report(MYSQLI_REPORT_INDEX);
if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
if (mysqli_get_server_version($link) <= 50600) {
// this might cause a warning - no index used
if (!($res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))) {
printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!($row = mysqli_fetch_assoc($res))) {
printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$log_slow_query = 'ON' == $row['Value'];
if (mysqli_get_server_version($link) >= 50111) {
// this might cause a warning - no index used
if (!($res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))) {
printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!($row = mysqli_fetch_assoc($res))) {
printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$log_queries_not_using_indexes = 'ON' == $row['Value'];
if ($log_slow_queries && $log_queries_not_using_indexes) {
for ($i = 100; $i < 20000; $i++) {
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ({$i}, 'z')")) {
printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
}
}
// this might cause a warning - no index used