File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
pdo_oci /
tests /
pdo_oci_attr_case.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:59 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
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
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>