Annotation of embedaddon/php/ext/mysqli/tests/bug35103.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>