PHP  
 PHP_7_3
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Expected Test Failure Report for ext/pdo_mysql/tests/pdo_022.phpt ('MySQL PDO Common: PDOStatement::getColumnMeta')

Script

1: <?php
2:
if (getenv('REDIR_TEST_DIR') === falseputenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
3: require_once 
getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
4:
$db PDOTest::factory();
5:
6:
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
7:
$db->exec('insert2'"INSERT INTO test VALUES(:first, :second, :third)");
8:
9:
$data = array(
10:     array(
'10''Abc''zxy'),
11:     array(
'20''Def''wvu'),
12:     array(
'30''Ghi''tsr'),
13:     array(
'40''Jkl''qpo'),
14:     array(
'50''Mno''nml'),
15:     array(
'60''Pqr''kji'),
16: );
17:
18:
19:
// Insert using question mark placeholders
20:
$stmt $db->prepare("INSERT INTO test VALUES(?, ?, ?)");
21: foreach (
$data as $row) {
22:     
$stmt->execute($row);
23: }
24:
25:
// Retrieve column metadata for a result set returned by explicit SELECT
26:
$select $db->query('SELECT id, val, val2 FROM test');
27:
$meta $select->getColumnMeta(0);
28:
var_dump($meta);
29:
$meta $select->getColumnMeta(1);
30:
var_dump($meta);
31:
$meta $select->getColumnMeta(2);
32:
var_dump($meta);
33:
34:
// Retrieve column metadata for a result set returned by a function
35:
$select $db->query('SELECT COUNT(*) FROM test');
36:
$meta $select->getColumnMeta(0);
37:
var_dump($meta);
38:
39:
?>
40:

Expected

The unexpected!

Output

Warning: PDO::exec() expects exactly 1 parameter, 2 given in /var/php_gcov/PHP_7_3/ext/pdo_mysql/tests/pdo_022.php on line 7
array(7) {
  ["native_type"]=>
  string(4) "LONG"
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(2) {
    [0]=>
    string(8) "not_null"
    [1]=>
    string(11) "primary_key"
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(2) "id"
  ["len"]=>
  int(11)
  ["precision"]=>
  int(0)
}
array(7) {
  ["native_type"]=>
  string(10) "VAR_STRING"
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(3) "val"
  ["len"]=>
  int(10)
  ["precision"]=>
  int(0)
}
array(7) {
  ["native_type"]=>
  string(10) "VAR_STRING"
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(0) {
  }
  ["table"]=>
  string(4) "test"
  ["name"]=>
  string(4) "val2"
  ["len"]=>
  int(16)
  ["precision"]=>
  int(0)
}
array(7) {
  ["native_type"]=>
  string(8) "LONGLONG"
  ["pdo_type"]=>
  int(2)
  ["flags"]=>
  array(1) {
    [0]=>
    string(8) "not_null"
  }
  ["table"]=>
  string(0) ""
  ["name"]=>
  string(8) "count(*)"
  ["len"]=>
  int(21)
  ["precision"]=>
  int(0)
}

Diff

# original source file: ext/pdo/tests/pdo_022.phpt
001+ Warning: PDO::exec() expects exactly 1 parameter, 2 given in /var/php_gcov/PHP_7_3/ext/pdo_mysql/tests/pdo_022.php on line 7
001- The unexpected!
002+ array(7) {
003+   ["native_type"]=>
004+   string(4) "LONG"
005+   ["pdo_type"]=>
006+   int(2)
007+   ["flags"]=>
008+   array(2) {
009+     [0]=>
010+     string(8) "not_null"
011+     [1]=>
012+     string(11) "primary_key"
013+   }
014+   ["table"]=>
015+   string(4) "test"
016+   ["name"]=>
017+   string(2) "id"
018+   ["len"]=>
019+   int(11)
020+   ["precision"]=>
021+   int(0)
022+ }
023+ array(7) {
024+   ["native_type"]=>
025+   string(10) "VAR_STRING"
026+   ["pdo_type"]=>
027+   int(2)
028+   ["flags"]=>
029+   array(0) {
030+   }
031+   ["table"]=>
032+   string(4) "test"
033+   ["name"]=>
034+   string(3) "val"
035+   ["len"]=>
036+   int(10)
037+   ["precision"]=>
038+   int(0)
039+ }
040+ array(7) {
041+   ["native_type"]=>
042+   string(10) "VAR_STRING"
043+   ["pdo_type"]=>
044+   int(2)
045+   ["flags"]=>
046+   array(0) {
047+   }
048+   ["table"]=>
049+   string(4) "test"
050+   ["name"]=>
051+   string(4) "val2"
052+   ["len"]=>
053+   int(16)
054+   ["precision"]=>
055+   int(0)
056+ }
057+ array(7) {
058+   ["native_type"]=>
059+   string(8) "LONGLONG"
060+   ["pdo_type"]=>
061+   int(2)
062+   ["flags"]=>
063+   array(1) {
064+     [0]=>
065+     string(8) "not_null"
066+   }
067+   ["table"]=>
068+   string(0) ""
069+   ["name"]=>
070+   string(8) "count(*)"
071+   ["len"]=>
072+   int(21)
073+   ["precision"]=>
074+   int(0)
075+ }

 

Generated at Tue, 10 Sep 2019 23:15:19 +0000 (6 days ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.