1--TEST-- 2Bug #35103 (Bad handling of unsigned bigint) 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8?> 9--FILE-- 10<?php 11 12$drop = <<<EOSQL 13DROP TABLE test_bint; 14DROP TABLE test_buint; 15EOSQL; 16 require_once 'connect.inc'; 17 18 $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); 19 $mysql->query("DROP TABLE IF EXISTS test_bint"); 20 $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM"); 21 $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)"); 22 23 $mysql->query("DROP TABLE IF EXISTS test_buint"); 24 $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)"); 25 $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)"); 26 27 $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a"); 28 $stmt->bind_result($v); 29 $stmt->execute(); 30 $i=0; 31 echo "BIG INT SIGNED, TEST\n"; 32 while ($i++ < 8) { 33 $stmt->fetch(); 34 echo $v, "\n"; 35 } 36 $stmt->close(); 37 38 echo str_repeat("-", 20), "\n"; 39 40 $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a"); 41 $stmt->bind_result($v2); 42 $stmt->execute(); 43 $j=0; 44 echo "BIG INT UNSIGNED TEST\n"; 45 while ($j++ < 6) { 46 $stmt->fetch(); 47 echo $v2, "\n"; 48 } 49 $stmt->close(); 50 51 $mysql->multi_query($drop); 52 53 $mysql->close(); 54?> 55--CLEAN-- 56<?php 57require_once 'connect.inc'; 58if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 59 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 60 61if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bint") || !mysqli_query($link, "DROP TABLE IF EXISTS test_buint")) 62 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 63 64mysqli_close($link); 65?> 66--EXPECT-- 67BIG INT SIGNED, TEST 68-9223372036854775808 69-2147483649 70-2147483648 71-2147483647 722147483647 732147483648 742147483649 759223372036854775807 76-------------------- 77BIG INT UNSIGNED TEST 782147483647 792147483649 804294967295 819223372036854775807 829223372036854775808 8318446744073709551615 84