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_sqlite/tests/pdo_022.phpt ('SQLite 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_sqlite/tests/pdo_022.php on line 7
array(8) {
  ["native_type"]=>
  string(7) "integer"
  ["sqlite:decl_type"]=>
  string(3) "INT"
  ["table"]=>
  string(4) "test"
  ["flags"]=>
  array(0) {
  }
  ["name"]=>
  string(2) "id"
  ["len"]=>
  int(4294967295)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
array(8) {
  ["native_type"]=>
  string(6) "string"
  ["sqlite:decl_type"]=>
  string(11) "VARCHAR(10)"
  ["table"]=>
  string(4) "test"
  ["flags"]=>
  array(0) {
  }
  ["name"]=>
  string(3) "val"
  ["len"]=>
  int(4294967295)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
array(8) {
  ["native_type"]=>
  string(6) "string"
  ["sqlite:decl_type"]=>
  string(11) "VARCHAR(16)"
  ["table"]=>
  string(4) "test"
  ["flags"]=>
  array(0) {
  }
  ["name"]=>
  string(4) "val2"
  ["len"]=>
  int(4294967295)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}
array(6) {
  ["native_type"]=>
  string(7) "integer"
  ["flags"]=>
  array(0) {
  }
  ["name"]=>
  string(8) "count(*)"
  ["len"]=>
  int(4294967295)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}

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

 

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

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