From: Dan Scott Date: Wed, 9 Mar 2005 00:20:07 +0000 (+0000) Subject: Add test for PDOStatement::getColumnMeta(). X-Git-Tag: RELEASE_0_3~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e90582a9904c66926bc691e4797dda6bd15574b3;p=php Add test for PDOStatement::getColumnMeta(). Note that PDO_ODBC test fails as it is currently unimplemented. --- diff --git a/ext/pdo/tests/pdo_022.inc b/ext/pdo/tests/pdo_022.inc new file mode 100755 index 0000000000..6cf662e7a7 --- /dev/null +++ b/ext/pdo/tests/pdo_022.inc @@ -0,0 +1,41 @@ +exec($SQL['create1']); + +// Insert using question mark placeholders +$stmt = $DB->prepare($SQL['insert1']); +foreach ($data as $row) { + $stmt->execute($row); +} + +// Retrieve column metadata for a result set returned by explicit SELECT +$select = $DB->query($SQL['select1']); +$meta = $select->getColumnMeta(0); +var_dump($meta); +$meta = $select->getColumnMeta(1); +var_dump($meta); +$meta = $select->getColumnMeta(2); +var_dump($meta); + +// Retrieve column metadata for a result set returned by a function +$select = $DB->query($SQL['select2']); +$meta = $select->getColumnMeta(0); +var_dump($meta); +?> diff --git a/ext/pdo_odbc/tests/pdo_022.phpt b/ext/pdo_odbc/tests/pdo_022.phpt new file mode 100755 index 0000000000..412fe35571 --- /dev/null +++ b/ext/pdo_odbc/tests/pdo_022.phpt @@ -0,0 +1,84 @@ +--TEST-- +PDO_ODBC: PDOStatement::columnMeta results. +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECT-- +array(7) { + ["native_type"]=> + string(7) "integer" + ["odbc:decl_type"]=> + string(3) "INT" + ["flags"]=> + array(0) { + } + ["name"]=> + string(2) "id" + ["len"]=> + int(-1) + ["precision"]=> + int(0) + ["pdo_type"]=> + int(2) +} +array(7) { + ["native_type"]=> + string(6) "string" + ["odbc:decl_type"]=> + string(11) "VARCHAR(10)" + ["flags"]=> + array(0) { + } + ["name"]=> + string(3) "val" + ["len"]=> + int(-1) + ["precision"]=> + int(0) + ["pdo_type"]=> + int(2) +} +array(7) { + ["native_type"]=> + string(6) "string" + ["odbc:decl_type"]=> + string(11) "VARCHAR(16)" + ["flags"]=> + array(0) { + } + ["name"]=> + string(4) "val2" + ["len"]=> + int(-1) + ["precision"]=> + int(0) + ["pdo_type"]=> + int(2) +} +array(6) { + ["native_type"]=> + string(7) "integer" + ["flags"]=> + array(0) { + } + ["name"]=> + string(8) "COUNT(*)" + ["len"]=> + int(-1) + ["precision"]=> + int(0) + ["pdo_type"]=> + int(2) +} +===DONE===