diff options
| -rwxr-xr-x | ext/pdo/tests/pdo_020.inc | 28 | ||||
| -rwxr-xr-x | ext/pdo_odbc/tests/pdo_020.phpt | 21 |
2 files changed, 49 insertions, 0 deletions
diff --git a/ext/pdo/tests/pdo_020.inc b/ext/pdo/tests/pdo_020.inc new file mode 100755 index 0000000000..b04eba26d8 --- /dev/null +++ b/ext/pdo/tests/pdo_020.inc @@ -0,0 +1,28 @@ +<?php # vim:ft=php + +require_once('pdo.inc'); + +set_sql('create1', 'CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))'); +set_sql('insert1', "INSERT INTO test VALUES(1, 'A', 'A')"); +set_sql('insert2', "INSERT INTO test VALUES(2, 'B', 'B')"); +set_sql('insert3', "INSERT INTO test VALUES(3, 'C', 'C')"); +set_sql('select1', 'SELECT id, val FROM test'); +set_sql('select2', 'SELECT id, val, val2 FROM test'); +set_sql('select3', 'SELECT COUNT(*) FROM test'); + +function countColumns($DB, $action) { + global $SQL; + $stmt = $DB->query($SQL[$action]); + $res = $stmt->columnCount(); + return "Counted $res columns after $action.\n"; +} + +$DB->exec($SQL['create1']); +$DB->exec($SQL['insert1']); +$DB->exec($SQL['insert2']); +$DB->exec($SQL['insert3']); + +echo countColumns($DB, 'select1'); +echo countColumns($DB, 'select2'); +echo countColumns($DB, 'select3'); +?> diff --git a/ext/pdo_odbc/tests/pdo_020.phpt b/ext/pdo_odbc/tests/pdo_020.phpt new file mode 100755 index 0000000000..8e00dbdacd --- /dev/null +++ b/ext/pdo_odbc/tests/pdo_020.phpt @@ -0,0 +1,21 @@ +--TEST-- +PDO_ODBC: PDOStatement::columnCount +--SKIPIF-- +<?php # vim:ft=php +require_once('skipif.inc'); ?> +--FILE-- +<?php + +require_once('connection.inc'); +require_once('prepare.inc'); + +require_once($PDO_TESTS . 'pdo_020.inc'); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECT-- +Counted 2 columns after select1. +Counted 3 columns after select2. +Counted 1 columns after select3. +===DONE=== |
