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

1.1       misho       1: --TEST--
                      2: mysqli_stmt_result_metadata
                      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:        /*** test mysqli_connect 127.0.0.1 ***/
                     13:        $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
                     14: 
                     15:        mysqli_select_db($link, $db);
                     16: 
                     17:        mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
                     18:        mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine);
                     19: 
                     20:        mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
                     21: 
                     22:        $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
                     23:        mysqli_stmt_execute($stmt);
                     24:        $result = mysqli_stmt_result_metadata($stmt);
                     25: 
                     26:        echo "\n=== fetch_fields ===\n";
                     27:        var_dump(mysqli_fetch_fields($result));
                     28: 
                     29:        echo "\n=== fetch_field_direct ===\n";
                     30:        var_dump(mysqli_fetch_field_direct($result, 0));
                     31:        var_dump(mysqli_fetch_field_direct($result, 1));
                     32: 
                     33:        echo "\n=== fetch_field ===\n";
                     34:        while ($field = mysqli_fetch_field($result)) {
                     35:                var_dump($field);
                     36:        }
                     37: 
                     38:        print_r(mysqli_fetch_lengths($result));
                     39: 
                     40:        mysqli_free_result($result);
                     41: 
                     42: 
                     43:        mysqli_stmt_close($stmt);
                     44:        mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
                     45:        mysqli_close($link);
                     46:        print "done!";
                     47: ?>
                     48: --CLEAN--
                     49: <?php
                     50: require_once("connect.inc");
                     51: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
                     52:    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
                     53: 
                     54: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_affected"))
                     55:        printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
                     56: 
                     57: mysqli_close($link);
                     58: ?>
                     59: --EXPECTF--
                     60: === fetch_fields ===
                     61: array(2) {
                     62:   [0]=>
                     63:   object(stdClass)#5 (13) {
                     64:     [%u|b%"name"]=>
                     65:     %unicode|string%(3) "foo"
                     66:     [%u|b%"orgname"]=>
                     67:     %unicode|string%(3) "foo"
                     68:     [%u|b%"table"]=>
                     69:     %unicode|string%(13) "test_affected"
                     70:     [%u|b%"orgtable"]=>
                     71:     %unicode|string%(13) "test_affected"
                     72:     [%u|b%"def"]=>
                     73:     %unicode|string%(0) ""
                     74:     [%u|b%"db"]=>
                     75:     %unicode|string%(%d) "%s"
                     76:     [%u|b%"catalog"]=>
                     77:     %unicode|string%(%d) "%s"
                     78:     [%u|b%"max_length"]=>
                     79:     int(0)
                     80:     [%u|b%"length"]=>
                     81:     int(%d)
                     82:     [%u|b%"charsetnr"]=>
                     83:     int(%d)
                     84:     [%u|b%"flags"]=>
                     85:     int(32768)
                     86:     [%u|b%"type"]=>
                     87:     int(3)
                     88:     [%u|b%"decimals"]=>
                     89:     int(0)
                     90:   }
                     91:   [1]=>
                     92:   object(stdClass)#6 (13) {
                     93:     [%u|b%"name"]=>
                     94:     %unicode|string%(3) "bar"
                     95:     [%u|b%"orgname"]=>
                     96:     %unicode|string%(3) "bar"
                     97:     [%u|b%"table"]=>
                     98:     %unicode|string%(13) "test_affected"
                     99:     [%u|b%"orgtable"]=>
                    100:     %unicode|string%(13) "test_affected"
                    101:     [%u|b%"def"]=>
                    102:     %unicode|string%(0) ""
                    103:     [%u|b%"db"]=>
                    104:     %unicode|string%(%d) "%s"
                    105:     [%u|b%"catalog"]=>
                    106:     %unicode|string%(%d) "%s"
                    107:     [%u|b%"max_length"]=>
                    108:     int(0)
                    109:     [%u|b%"length"]=>
                    110:     int(%d)
                    111:     [%u|b%"charsetnr"]=>
                    112:     int(%d)
                    113:     [%u|b%"flags"]=>
                    114:     int(0)
                    115:     [%u|b%"type"]=>
                    116:     int(253)
                    117:     [%u|b%"decimals"]=>
                    118:     int(0)
                    119:   }
                    120: }
                    121: 
                    122: === fetch_field_direct ===
                    123: object(stdClass)#6 (13) {
                    124:   [%u|b%"name"]=>
                    125:   %unicode|string%(3) "foo"
                    126:   [%u|b%"orgname"]=>
                    127:   %unicode|string%(3) "foo"
                    128:   [%u|b%"table"]=>
                    129:   %unicode|string%(13) "test_affected"
                    130:   [%u|b%"orgtable"]=>
                    131:   %unicode|string%(13) "test_affected"
                    132:   [%u|b%"def"]=>
                    133:   %unicode|string%(0) ""
                    134:   [%u|b%"db"]=>
                    135:   %unicode|string%(%d) "%s"
                    136:   [%u|b%"catalog"]=>
                    137:   %unicode|string%(%d) "%s"
                    138:   [%u|b%"max_length"]=>
                    139:   int(0)
                    140:   [%u|b%"length"]=>
                    141:   int(%d)
                    142:   [%u|b%"charsetnr"]=>
                    143:   int(%d)
                    144:   [%u|b%"flags"]=>
                    145:   int(32768)
                    146:   [%u|b%"type"]=>
                    147:   int(3)
                    148:   [%u|b%"decimals"]=>
                    149:   int(0)
                    150: }
                    151: object(stdClass)#6 (13) {
                    152:   [%u|b%"name"]=>
                    153:   %unicode|string%(3) "bar"
                    154:   [%u|b%"orgname"]=>
                    155:   %unicode|string%(3) "bar"
                    156:   [%u|b%"table"]=>
                    157:   %unicode|string%(13) "test_affected"
                    158:   [%u|b%"orgtable"]=>
                    159:   %unicode|string%(13) "test_affected"
                    160:   [%u|b%"def"]=>
                    161:   %unicode|string%(0) ""
                    162:   [%u|b%"db"]=>
                    163:   %unicode|string%(%d) "%s"
                    164:   [%u|b%"catalog"]=>
                    165:   %unicode|string%(%d) "%s"
                    166:   [%u|b%"max_length"]=>
                    167:   int(0)
                    168:   [%u|b%"length"]=>
                    169:   int(%d)
                    170:   [%u|b%"charsetnr"]=>
                    171:   int(%d)
                    172:   [%u|b%"flags"]=>
                    173:   int(0)
                    174:   [%u|b%"type"]=>
                    175:   int(253)
                    176:   [%u|b%"decimals"]=>
                    177:   int(0)
                    178: }
                    179: 
                    180: === fetch_field ===
                    181: object(stdClass)#6 (13) {
                    182:   [%u|b%"name"]=>
                    183:   %unicode|string%(3) "foo"
                    184:   [%u|b%"orgname"]=>
                    185:   %unicode|string%(3) "foo"
                    186:   [%u|b%"table"]=>
                    187:   %unicode|string%(13) "test_affected"
                    188:   [%u|b%"orgtable"]=>
                    189:   %unicode|string%(13) "test_affected"
                    190:   [%u|b%"def"]=>
                    191:   %unicode|string%(0) ""
                    192:   [%u|b%"db"]=>
                    193:   %unicode|string%(%d) "%s"
                    194:   [%u|b%"catalog"]=>
                    195:   %unicode|string%(%d) "%s"
                    196:   [%u|b%"max_length"]=>
                    197:   int(0)
                    198:   [%u|b%"length"]=>
                    199:   int(%d)
                    200:   [%u|b%"charsetnr"]=>
                    201:   int(%d)
                    202:   [%u|b%"flags"]=>
                    203:   int(32768)
                    204:   [%u|b%"type"]=>
                    205:   int(3)
                    206:   [%u|b%"decimals"]=>
                    207:   int(0)
                    208: }
                    209: object(stdClass)#5 (13) {
                    210:   [%u|b%"name"]=>
                    211:   %unicode|string%(3) "bar"
                    212:   [%u|b%"orgname"]=>
                    213:   %unicode|string%(3) "bar"
                    214:   [%u|b%"table"]=>
                    215:   %unicode|string%(13) "test_affected"
                    216:   [%u|b%"orgtable"]=>
                    217:   %unicode|string%(13) "test_affected"
                    218:   [%u|b%"def"]=>
                    219:   %unicode|string%(0) ""
                    220:   [%u|b%"db"]=>
                    221:   %unicode|string%(%d) "%s"
                    222:   [%u|b%"catalog"]=>
                    223:   %unicode|string%(%d) "%s"
                    224:   [%u|b%"max_length"]=>
                    225:   int(0)
                    226:   [%u|b%"length"]=>
                    227:   int(%d)
                    228:   [%u|b%"charsetnr"]=>
                    229:   int(%d)
                    230:   [%u|b%"flags"]=>
                    231:   int(0)
                    232:   [%u|b%"type"]=>
                    233:   int(253)
                    234:   [%u|b%"decimals"]=>
                    235:   int(0)
                    236: }
                    237: done!

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