summaryrefslogtreecommitdiff
path: root/ext/pdo_oci
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2007-08-31 21:09:43 (GMT)
committerChristopher Jones <sixd@php.net>2007-08-31 21:09:43 (GMT)
commit63bfa32aee6df4c09bc1fb2a90966265519ac4e1 (patch)
tree0972660667bea221d0c9e0e043b20c99a87482a2 /ext/pdo_oci
parentaf387e49ba6297c90fd1c05b5de452194a4bf940 (diff)
downloadphp-63bfa32aee6df4c09bc1fb2a90966265519ac4e1.tar.gz
New tests for getAttribute
Diffstat (limited to 'ext/pdo_oci')
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt64
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt127
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt51
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_case.phpt81
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_client.phpt43
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt21
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt61
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt37
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt47
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_server.phpt40
10 files changed, 572 insertions, 0 deletions
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt
new file mode 100644
index 0000000..298d59e
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt
@@ -0,0 +1,64 @@
+--TEST--
+PDO_OCI: Attribute: Basic autocommit functionality
+--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');
+
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+print "PDO::ATTR_AUTOCOMMIT: Default: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Change setting to false - ";
+
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Change setting back to true - ";
+
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+// Use 2nd connection to check that autocommit does commit
+
+echo "Insert data\n";
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')");
+
+$dbh2 = PDOTest::factory();
+
+echo "Second connection should be able to see committed data\n";
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo "Data is: " . $r[0] . "\n";
+}
+
+$dbh->exec("drop table pdo_ac_tab");
+
+echo "Done\n";
+
+?>
+--EXPECT--
+PDO::ATTR_AUTOCOMMIT: Default: bool(true)
+Change setting to false - PDO::ATTR_AUTOCOMMIT: bool(false)
+Change setting back to true - PDO::ATTR_AUTOCOMMIT: bool(true)
+Insert data
+Second connection should be able to see committed data
+Data is: some data
+Done \ No newline at end of file
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
new file mode 100644
index 0000000..9addca8
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
@@ -0,0 +1,127 @@
+--TEST--
+PDO_OCI: Attribute: beginTransaction and native transactions
+--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');
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(25))");
+
+echo "Test 1 Check beginTransaction insertion\n";
+
+$dbh->beginTransaction();
+try {
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')");
+ $dbh->commit();
+}
+catch (PDOException $e) {
+ echo "Caught unexpected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
+}
+
+echo "Test 2 Cause an exception and test beginTransaction rollback\n";
+
+$dbh->beginTransaction();
+try {
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')");
+ $dbh->commit();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
+}
+
+echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n";
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 3')");
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+try {
+ $dbh->rollback();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+}
+
+echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n";
+
+$dbh->beginTransaction();
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 4')");
+$dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+try {
+ $dbh->rollback();
+}
+catch (PDOException $e) {
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+}
+
+echo "Test 5 Handle transactions ourselves\n";
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #2')");
+$dbh->exec("rollback");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 5')");
+$dbh->exec("insert into pdo_ac_tab (col1) values ('data 6')");
+
+$dbh->exec("commit");
+
+// Open new connection to really verify what was inserted
+
+$dbh2 = PDOTest::factory();
+
+echo "Query Results are:\n";
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1 Check beginTransaction insertion
+Test 2 Cause an exception and test beginTransaction rollback
+Caught expected exception at line 35
+SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s
+%s
+Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction
+PDO::ATTR_AUTOCOMMIT: bool(true)
+Caught expected exception at line %d
+There is no active transaction
+Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Caught expected exception at line %d
+There is no active transaction
+Test 5 Handle transactions ourselves
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Query Results are:
+data 1
+data 2
+data 3
+data 4
+data 5
+data 6
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
new file mode 100644
index 0000000..81e9b74
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt
@@ -0,0 +1,51 @@
+--TEST--
+PDO_OCI: Atrribute: closing a connection in non-autocommit mode commits data
+--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');
+
+// Check connection can be created with AUTOCOMMIT off
+putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_AUTOCOMMIT=>false)));
+$dbh = PDOTest::factory();
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+$dbh->exec("drop table pdo_ac_tab");
+
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+print "PDO::ATTR_AUTOCOMMIT: ";
+var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
+
+echo "Insert data\n";
+
+$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))");
+
+$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')");
+
+$dbh = null; // close first connection
+
+echo "Second connection should be able to see committed data\n";
+$dbh2 = PDOTest::factory();
+$s = $dbh2->prepare("select col1 from pdo_ac_tab");
+$s->execute();
+while ($r = $s->fetch()) {
+ echo "Data is: " . $r[0] . "\n";
+}
+
+$dbh2->exec("drop table pdo_ac_tab");
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+PDO::ATTR_AUTOCOMMIT: bool(false)
+Insert data
+Second connection should be able to see committed data
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
new file mode 100644
index 0000000..4c19d6c
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
@@ -0,0 +1,81 @@
+--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
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
new file mode 100644
index 0000000..b21f1b7
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
@@ -0,0 +1,43 @@
+--TEST--
+PDO_OCI: Attribute: Client version
+--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');
+
+$dbh = PDOTest::factory();
+
+echo "ATTR_CLIENT_VERSION: ";
+$cv = $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION);
+var_dump($cv);
+
+$s = split("\.", $cv);
+if ($s[0] >= 10 && count($s) > 1 && $s[1] >= 2) {
+ if (count($s) != 5) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
+} else {
+ if (count($s) != 2) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+ATTR_CLIENT_VERSION: string(%d) "%d.%s"
+Version OK, so far as can be portably checked
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt b/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt
new file mode 100644
index 0000000..7934e79
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt
@@ -0,0 +1,21 @@
+--TEST--
+PDO_OCI: Attribute: verify driver name
+--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';
+
+$dbh = PDOTest::factory();
+var_dump($dbh->getAttribute(PDO::ATTR_DRIVER_NAME));
+
+echo "Done\n";
+?>
+--EXPECT--
+string(3) "oci"
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
new file mode 100644
index 0000000..b9c4612
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
@@ -0,0 +1,61 @@
+--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 \ No newline at end of file
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt
new file mode 100644
index 0000000..839fe83
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+PDO_OCI: Attribute: Set prefetch on connection
+--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');
+
+$dbh = PDOTest::factory();
+
+echo "Test connect: (value is ignored & has no effect)\n";
+putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_PREFETCH=>101)));
+$dbh = PDOTest::factory();
+
+echo "Test set: (value is ignored & has no effect)\n";
+$dbh->setAttribute(PDO::ATTR_PREFETCH, 102);
+
+// Verify can fetch
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test connect: (value is ignored & has no effect)
+Test set: (value is ignored & has no effect)
+X
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt
new file mode 100644
index 0000000..4b8fd80
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt
@@ -0,0 +1,47 @@
+--TEST--
+PDO_OCI: Attribute: prefetch on statements
+--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');
+
+$dbh = PDOTest::factory();
+
+$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 101));
+
+echo "Test 1: Can't set prefetch after prepare\n";
+var_dump($s->setAttribute(PDO::ATTR_PREFETCH, 102));
+
+// Verify can fetch
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Test 2: Turn off prefetching\n";
+$s = $dbh->prepare("select '' as myempty, null as mynull from dual", array(PDO::ATTR_PREFETCH => 0));
+$s = $dbh->prepare("select dummy from dual" );
+$s->execute();
+while ($r = $s->fetch()) {
+ echo $r[0] . "\n";
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1: Can't set prefetch after prepare
+
+Warning: PDOStatement::setAttribute(): SQLSTATE[IM001]: Driver does not support this function: This driver doesn't support setting attributes in %s on line %d
+bool(false)
+X
+Test 2: Turn off prefetching
+X
+Done
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
new file mode 100644
index 0000000..dba5a19
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
@@ -0,0 +1,40 @@
+--TEST--
+PDO_OCI: Attribute: Server version and info
+--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');
+
+$dbh = PDOTest::factory();
+
+echo "Test 1\n";
+echo "ATTR_SERVER_VERSION: ";
+var_dump($dbh->getAttribute(PDO::ATTR_SERVER_VERSION));
+
+echo "Test 2\n";
+echo "ATTR_SERVER_INFO\n";
+$si = $dbh->getAttribute(PDO::ATTR_SERVER_INFO);
+$pos = strpos($si, "Oracle");
+if ($pos === 0) {
+ echo "Found 'Oracle' at position $pos as expected\n";
+} else {
+ echo "Unexpected result. Server info was:\n";
+ var_dump($si);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1
+ATTR_SERVER_VERSION: string(%d) "%d.%d.%d.%d.%d"
+Test 2
+ATTR_SERVER_INFO
+Found 'Oracle' at position 0 as expected
+Done