mirror of
https://github.com/php/php-src.git
synced 2025-01-10 21:14:37 +08:00
7ab5d01e23
- Updated PDO_OCI to the latest version (from PHP_5_3 branch) # This commit reverts some changes to the tests. Given the very high # failure ratio of the current tests on HEAD I'm not going to fix them # now. Keeping ext/pdo_oci in sync with 5.3 will be much more helpful when # merging. The effort to fix the tests can start when 5.3 is out.
82 lines
1.8 KiB
PHP
82 lines
1.8 KiB
PHP
--TEST--
|
|
PDO_OCI: Attribute: Column Case
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
|
|
require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
|
|
|
|
function do_query1($dbh)
|
|
{
|
|
var_dump($dbh->getAttribute(PDO::ATTR_CASE));
|
|
$s = $dbh->prepare("select dummy from dual");
|
|
$s->execute();
|
|
while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
|
|
var_dump($r);
|
|
}
|
|
}
|
|
|
|
function do_query2($dbh, $mode)
|
|
{
|
|
echo "Mode desired is $mode\n";
|
|
$s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode));
|
|
$s->execute();
|
|
while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
|
|
var_dump($r);
|
|
}
|
|
}
|
|
|
|
$dbh = PDOTest::factory();
|
|
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
echo "Test 1 - Force column names to lower case\n";
|
|
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
|
|
do_query1($dbh);
|
|
|
|
echo "Test 2 - Leave column names as returned by the database driver\n";
|
|
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
|
|
do_query1($dbh);
|
|
|
|
echo "Test 3 - Force column names to upper case\n";
|
|
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);
|
|
do_query1($dbh);
|
|
|
|
echo "Test 4 - Setting on statement has no effect. Attempt lower case but get upper\n";
|
|
$dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); // reset
|
|
do_query2($dbh, PDO::CASE_LOWER);
|
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
--EXPECT--
|
|
Test 1 - Force column names to lower case
|
|
int(2)
|
|
array(1) {
|
|
["dummy"]=>
|
|
string(1) "X"
|
|
}
|
|
Test 2 - Leave column names as returned by the database driver
|
|
int(0)
|
|
array(1) {
|
|
["DUMMY"]=>
|
|
string(1) "X"
|
|
}
|
|
Test 3 - Force column names to upper case
|
|
int(1)
|
|
array(1) {
|
|
["DUMMY"]=>
|
|
string(1) "X"
|
|
}
|
|
Test 4 - Setting on statement has no effect. Attempt lower case but get upper
|
|
Mode desired is 2
|
|
array(1) {
|
|
["DUMMY"]=>
|
|
string(1) "X"
|
|
}
|
|
Done
|