File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
pdo_oci /
tests /
pdo_oci_attr_nulls_1.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: Oracle Nulls
--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_query($dbh)
{
var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS));
$s = $dbh->prepare("select '' as myempty, null as mynull from dual");
$s->execute();
while ($r = $s->fetch()) {
var_dump($r[0]);
var_dump($r[1]);
}
}
$dbh = PDOTest::factory();
print "PDO::ATTR_ORACLE_NULLS: Default: ";
do_query($dbh);
print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_NATURAL: ";
$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); // No conversion.
do_query($dbh);
print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_EMPTY_STRING: ";
$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING); // Empty string is converted to NULL.
do_query($dbh);
print "PDO::ATTR_ORACLE_NULLS: PDO::NULL_TO_STRING: ";
$dbh->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING); // NULL is converted to an empty string.
do_query($dbh);
echo "Done\n";
?>
--EXPECT--
PDO::ATTR_ORACLE_NULLS: Default: int(0)
NULL
NULL
PDO::ATTR_ORACLE_NULLS: PDO::NULL_NATURAL: int(0)
NULL
NULL
PDO::ATTR_ORACLE_NULLS: PDO::NULL_EMPTY_STRING: int(1)
NULL
NULL
PDO::ATTR_ORACLE_NULLS: PDO::NULL_TO_STRING: int(2)
string(0) ""
string(0) ""
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>