Annotation of embedaddon/php/ext/mysql/tests/bug47438.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #47438 (mysql_fetch_field ignores zero offset)
        !             3: --SKIPIF--
        !             4: <?php
        !             5: require_once('skipif.inc');
        !             6: require_once('skipifconnectfailure.inc');
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: require_once('connect.inc');
        !            11: 
        !            12: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
        !            13:         printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
        !            14:                 $host, $user, $db, $port, $socket);
        !            15: 
        !            16: mysql_select_db($db, $link);
        !            17: mysql_query("DROP TABLE IF EXISTS test_47438", $link);
        !            18: mysql_query("CREATE TABLE test_47438 (a INT, b INT, c INT)", $link);
        !            19: mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)", $link);
        !            20: $result = mysql_query("SELECT * FROM test_47438", $link);
        !            21: mysql_field_seek($result, 1);
        !            22: 
        !            23: $i = 0;
        !            24: 
        !            25: while($i<mysql_num_fields($result))
        !            26: {
        !            27:   $meta=mysql_fetch_field($result,$i);
        !            28:   echo $i . "." . $meta->name . "\n";
        !            29:   $i++;
        !            30: }
        !            31: 
        !            32: mysql_query("DROP TABLE IF EXISTS test_47438", $link);
        !            33: 
        !            34: ?>
        !            35: --CLEAN--
        !            36: <?php
        !            37: require_once('connect.inc');
        !            38: 
        !            39: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
        !            40:         printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
        !            41:                 $host, $user, $db, $port, $socket);
        !            42: 
        !            43: if (!mysql_select_db($db, $link) ||
        !            44:        !mysql_query("DROP TABLE IF EXISTS test_47438", $link))
        !            45:        printf("[c002] [%d] %s\n", mysql_errno($link), mysql_error($link));
        !            46: 
        !            47: mysql_close($link);
        !            48: ?>
        !            49: --EXPECT--
        !            50: 0.a
        !            51: 1.b
        !            52: 2.c

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