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_pgsql/tests/pdo_022.phpt ('Postgres 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_pgsql/tests/pdo_022.php on line 7
array(8) {
  ["pgsql:oid"]=>
  int(23)
  ["pgsql:table_oid"]=>
  int(636868)
  ["table"]=>
  string(4) "test"
  ["native_type"]=>
  string(4) "int4"
  ["name"]=>
  string(2) "id"
  ["len"]=>
  int(4)
  ["precision"]=>
  int(-1)
  ["pdo_type"]=>
  int(1)
}
array(8) {
  ["pgsql:oid"]=>
  int(1043)
  ["pgsql:table_oid"]=>
  int(636868)
  ["table"]=>
  string(4) "test"
  ["native_type"]=>
  string(7) "varchar"
  ["name"]=>
  string(3) "val"
  ["len"]=>
  int(-1)
  ["precision"]=>
  int(14)
  ["pdo_type"]=>
  int(2)
}
array(8) {
  ["pgsql:oid"]=>
  int(1043)
  ["pgsql:table_oid"]=>
  int(636868)
  ["table"]=>
  string(4) "test"
  ["native_type"]=>
  string(7) "varchar"
  ["name"]=>
  string(4) "val2"
  ["len"]=>
  int(-1)
  ["precision"]=>
  int(20)
  ["pdo_type"]=>
  int(2)
}
array(7) {
  ["pgsql:oid"]=>
  int(20)
  ["pgsql:table_oid"]=>
  int(0)
  ["native_type"]=>
  string(4) "int8"
  ["name"]=>
  string(5) "count"
  ["len"]=>
  int(8)
  ["precision"]=>
  int(-1)
  ["pdo_type"]=>
  int(1)
}

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_pgsql/tests/pdo_022.php on line 7
001- The unexpected!
002+ array(8) {
003+   ["pgsql:oid"]=>
004+   int(23)
005+   ["pgsql:table_oid"]=>
006+   int(636868)
007+   ["table"]=>
008+   string(4) "test"
009+   ["native_type"]=>
010+   string(4) "int4"
011+   ["name"]=>
012+   string(2) "id"
013+   ["len"]=>
014+   int(4)
015+   ["precision"]=>
016+   int(-1)
017+   ["pdo_type"]=>
018+   int(1)
019+ }
020+ array(8) {
021+   ["pgsql:oid"]=>
022+   int(1043)
023+   ["pgsql:table_oid"]=>
024+   int(636868)
025+   ["table"]=>
026+   string(4) "test"
027+   ["native_type"]=>
028+   string(7) "varchar"
029+   ["name"]=>
030+   string(3) "val"
031+   ["len"]=>
032+   int(-1)
033+   ["precision"]=>
034+   int(14)
035+   ["pdo_type"]=>
036+   int(2)
037+ }
038+ array(8) {
039+   ["pgsql:oid"]=>
040+   int(1043)
041+   ["pgsql:table_oid"]=>
042+   int(636868)
043+   ["table"]=>
044+   string(4) "test"
045+   ["native_type"]=>
046+   string(7) "varchar"
047+   ["name"]=>
048+   string(4) "val2"
049+   ["len"]=>
050+   int(-1)
051+   ["precision"]=>
052+   int(20)
053+   ["pdo_type"]=>
054+   int(2)
055+ }
056+ array(7) {
057+   ["pgsql:oid"]=>
058+   int(20)
059+   ["pgsql:table_oid"]=>
060+   int(0)
061+   ["native_type"]=>
062+   string(4) "int8"
063+   ["name"]=>
064+   string(5) "count"
065+   ["len"]=>
066+   int(8)
067+   ["precision"]=>
068+   int(-1)
069+   ["pdo_type"]=>
070+   int(1)
071+ }

 

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

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