1--TEST-- 2MySQL protocol - statement row data fetch) 3--EXTENSIONS-- 4mysqli 5--FILE-- 6<?php 7require_once 'fake_server.inc'; 8 9$servername = "127.0.0.1"; 10$username = "root"; 11$password = ""; 12 13$process = run_fake_server_in_background('query_response_row_read_two_fields'); 14$process->wait(); 15 16$conn = new mysqli($servername, $username, $password, "", $process->getPort()); 17 18function my_query($conn, $field) 19{ 20 $sql = "SELECT strval, $field FROM data"; 21 22 $result = $conn->query($sql); 23 24 if ($result->num_rows > 0) { 25 while ($row = $result->fetch_assoc()) { 26 var_dump($row[$field]); 27 } 28 } 29} 30 31foreach (my_mysqli_data_fields() as $field_name => $field) { 32 my_query($conn, $field_name); 33} 34 35$conn->close(); 36 37$process->terminate(true); 38 39print "done!"; 40?> 41--EXPECTF-- 42[*] Server started on 127.0.0.1:%d 43[*] Connection established 44[*] Sending - Server Greeting: 580000000a352e352e352d31302e352e31382d4d6172696144420003000000473e3f6047257c6700fef7080200ff81150000000000000f0000006c6b55463f49335f686c6431006d7973716c5f6e61746976655f70617373776f7264 45[*] Received: 6900000185a21a00000000c0080000000000000000000000000000000000000000000000726f6f7400006d7973716c5f6e61746976655f70617373776f7264002c0c5f636c69656e745f6e616d65076d7973716c6e640c5f7365727665725f686f7374093132372e302e302e31 46[*] Sending - Server OK: 0700000200000002000000 47[*] Received: 200000000353454c4543542073747276616c2c20696e7476616c2046524f4d2064617461 48[*] Sending - Query execute data intval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f746573740464617461046461746106696e7476616c06696e7476616c0c3f000b00000003011000000005000004fe0000220008000005047465737402313405000006fe00002200 49string(2) "14" 50[*] Received: 200000000353454c4543542073747276616c2c20666c7476616c2046524f4d2064617461 51[*] Sending - Query execute data fltval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f746573740464617461046461746106666c7476616c06666c7476616c0c3f000c0000000401101f000005000004fe0000220009000005047465737403322e3305000006fe00002200 52string(3) "2.3" 53[*] Received: 200000000353454c4543542073747276616c2c2064626c76616c2046524f4d2064617461 54[*] Sending - Query execute data dblval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610664626c76616c0664626c76616c0c3f00160000000501101f000005000004fe0000220009000005047465737403312e3205000006fe00002200 55string(3) "1.2" 56[*] Received: 200000000353454c4543542073747276616c2c2064617476616c2046524f4d2064617461 57[*] Sending - Query execute data datval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610664617476616c0664617476616c0c3f000a0000000a811000000005000004fe000022001000000504746573740a323031342d31322d313505000006fe00002200 58string(10) "2014-12-15" 59[*] Received: 200000000353454c4543542073747276616c2c2074696d76616c2046524f4d2064617461 60[*] Sending - Query execute data timval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610674696d76616c0674696d76616c0c3f000a0000000b811000000005000004fe000022000e00000504746573740831333a30303a303205000006fe00002200 61string(8) "13:00:02" 62[*] Received: 200000000353454c4543542073747276616c2c2064746976616c2046524f4d2064617461 63[*] Sending - Query execute data dtival: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610664746976616c0664746976616c0c3f00130000000c811000000005000004fe0000220019000005047465737413323031342d31322d31362031333a30303a303105000006fe00002200 64string(19) "2014-12-16 13:00:01" 65[*] Received: 200000000353454c4543542073747276616c2c2062697476616c2046524f4d2064617461 66[*] Sending - Query execute data bitval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610662697476616c0662697476616c0c3f004000000010211000000005000004fe000022000e000005047465737408080808080808080805000006fe00002200 67string(18) "578721382704613384" 68[*] Received: 200000000353454c4543542073747276616c2c2073747276616c2046524f4d2064617461 69[*] Sending - Query execute data strval: 01000001023200000203646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd01100000003200000303646566087068705f74657374046461746104646174610673747276616c0673747276616c0ce000c8000000fd011000000005000004fe000022000a0000050474657374047465737405000006fe00002200 70string(4) "test" 71[*] Received: 0100000001 72[*] Server finished 73done! 74