com php-src: fix and extend test: ext/pdo_pgsql/tests/bug6 2498.phpt
| From: | Anatol Belski | Date: | Tue, 05 Apr 2016 13:06:17 +0000 |
| Subject: | com php-src: fix and extend test: ext/pdo_pgsql/tests/bug6 2498.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91608@lists.php.net to get a copy of this message | ||
Commit: c2cb4664bcaea292be4d77951fb98785f763c193
Author: Anatol Belski <ab@php.net> Tue, 5 Apr 2016 15:06:17 +0200
Parents: e10257ba8069fb982d9cd8681f6633de9fea534d
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c2cb4664bcaea292be4d77951fb98785f763c193
Log:
fix and extend test
Changed paths:
M ext/pdo_pgsql/tests/bug62498.phpt
Diff:
diff --git a/ext/pdo_pgsql/tests/bug62498.phpt b/ext/pdo_pgsql/tests/bug62498.phpt
index cefcd1f..e4ca3de 100644
--- a/ext/pdo_pgsql/tests/bug62498.phpt
+++ b/ext/pdo_pgsql/tests/bug62498.phpt
@@ -16,21 +16,27 @@ $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
$db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
// create the table
-$db->exec("CREATE TEMPORARY TABLE bugtest_62498 (intcol INTEGER, stringcol VARCHAR(255),
boolcol BOOLEAN, datecol DATE)");
+$db->exec("CREATE TEMPORARY TABLE bugtest_62498 (int2col INT2, int4col INT4, int8col INT8,
stringcol VARCHAR(255), boolcol BOOLEAN, datecol DATE, textcol TEXT, tscol TIMESTAMP, byteacol
BYTEA)");
// insert some data
-$statement = $db->prepare("INSERT INTO bugtest_62498 (intcol, stringcol, boolcol, datecol)
VALUES (:intval, :stringval, :boolval, :dateval)");
-$statement->execute(array(
- "intval" => "42",
+$statement = $db->prepare("INSERT INTO bugtest_62498 (int2col, int4col, int8col, stringcol,
boolcol, datecol, textcol, tscol, byteacol) VALUES (:int2val, :int4val, :int8val, :stringval,
:boolval, :dateval, :textval, :tsval, :byteaval)");
+$vals = array(
+ "int2val" => "42",
+ "int4val" => "42",
+ "int8val" => "42",
"stringval" => "The Answer",
"boolval" => true,
"dateval" => '2015-12-14',
-));
+ "textval" => "some text",
+ "tsval" => 19990108,
+ "byteaval" => 0,
+);
+$statement->execute($vals);
-$select = $db->query('SELECT intcol, stringcol, boolcol, datecol FROM bugtest_62498');
+$select = $db->query('SELECT int2col, int4col, int8col, stringcol, boolcol, datecol,
textcol, tscol, byteacol FROM bugtest_62498');
$meta = [];
-for ($i=0; $i < 4; $i++) {
- $meta[] = $select->getColumnMeta(0);
+for ($i=0; $i < count($vals); $i++) {
+ $meta[] = $select->getColumnMeta($i);
}
var_dump($meta);
@@ -38,17 +44,17 @@ var_dump($meta);
Done
--EXPECT--
Begin test...
-array(4) {
+array(9) {
[0]=>
array(6) {
["pgsql:oid"]=>
- int(23)
+ int(21)
["native_type"]=>
- string(4) "int4"
+ string(4) "int2"
["name"]=>
- string(6) "intcol"
+ string(7) "int2col"
["len"]=>
- int(4)
+ int(2)
["precision"]=>
int(-1)
["pdo_type"]=>
@@ -61,7 +67,7 @@ array(4) {
["native_type"]=>
string(4) "int4"
["name"]=>
- string(6) "intcol"
+ string(7) "int4col"
["len"]=>
int(4)
["precision"]=>
@@ -72,13 +78,13 @@ array(4) {
[2]=>
array(6) {
["pgsql:oid"]=>
- int(23)
+ int(20)
["native_type"]=>
- string(4) "int4"
+ string(4) "int8"
["name"]=>
- string(6) "intcol"
+ string(7) "int8col"
["len"]=>
- int(4)
+ int(8)
["precision"]=>
int(-1)
["pdo_type"]=>
@@ -87,17 +93,92 @@ array(4) {
[3]=>
array(6) {
["pgsql:oid"]=>
- int(23)
+ int(1043)
["native_type"]=>
- string(4) "int4"
+ string(7) "varchar"
["name"]=>
- string(6) "intcol"
+ string(9) "stringcol"
+ ["len"]=>
+ int(-1)
+ ["precision"]=>
+ int(259)
+ ["pdo_type"]=>
+ int(2)
+ }
+ [4]=>
+ array(6) {
+ ["pgsql:oid"]=>
+ int(16)
+ ["native_type"]=>
+ string(4) "bool"
+ ["name"]=>
+ string(7) "boolcol"
+ ["len"]=>
+ int(1)
+ ["precision"]=>
+ int(-1)
+ ["pdo_type"]=>
+ int(5)
+ }
+ [5]=>
+ array(6) {
+ ["pgsql:oid"]=>
+ int(1082)
+ ["native_type"]=>
+ string(4) "date"
+ ["name"]=>
+ string(7) "datecol"
["len"]=>
int(4)
["precision"]=>
int(-1)
["pdo_type"]=>
- int(1)
+ int(2)
+ }
+ [6]=>
+ array(6) {
+ ["pgsql:oid"]=>
+ int(25)
+ ["native_type"]=>
+ string(4) "text"
+ ["name"]=>
+ string(7) "textcol"
+ ["len"]=>
+ int(-1)
+ ["precision"]=>
+ int(-1)
+ ["pdo_type"]=>
+ int(2)
+ }
+ [7]=>
+ array(6) {
+ ["pgsql:oid"]=>
+ int(1114)
+ ["native_type"]=>
+ string(9) "timestamp"
+ ["name"]=>
+ string(5) "tscol"
+ ["len"]=>
+ int(8)
+ ["precision"]=>
+ int(-1)
+ ["pdo_type"]=>
+ int(2)
+ }
+ [8]=>
+ array(6) {
+ ["pgsql:oid"]=>
+ int(17)
+ ["native_type"]=>
+ string(5) "bytea"
+ ["name"]=>
+ string(8) "byteacol"
+ ["len"]=>
+ int(-1)
+ ["precision"]=>
+ int(-1)
+ ["pdo_type"]=>
+ int(3)
}
}
Done