summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2003-12-19 17:01:24 +0000
committerAntony Dovgal <tony2001@php.net>2003-12-19 17:01:24 +0000
commit60cd2d06049ef3a354934ec1ab647c9005c3b735 (patch)
tree5345c6b2969f0f57510a14b3f18a76307caf5881
parent9349ad79ff144a80a5d513d099e007f24442519e (diff)
downloadphp-git-60cd2d06049ef3a354934ec1ab647c9005c3b735.tar.gz
add test
-rw-r--r--ext/oci8/tests/bug26133.phpt36
-rw-r--r--ext/oci8/tests/connect.inc39
-rw-r--r--ext/oci8/tests/create_table.inc12
-rw-r--r--ext/oci8/tests/drop_table.inc12
-rw-r--r--ext/oci8/tests/skipif.inc10
5 files changed, 109 insertions, 0 deletions
diff --git a/ext/oci8/tests/bug26133.phpt b/ext/oci8/tests/bug26133.phpt
new file mode 100644
index 0000000000..d3f0ed9bf3
--- /dev/null
+++ b/ext/oci8/tests/bug26133.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #26133 (ocifreedesc() segfault)
+--SKIPIF--
+<?php
+ require 'skipif.inc';
+?>
+--FILE--
+<?php
+ require 'connect.inc';
+ require 'create_table.inc';
+
+ if ($connection) {
+ $ora_sql = "INSERT INTO
+ ".$schema."php_test_table (id, value)
+ VALUES ('1','1')
+ RETURNING
+ ROWID
+ INTO :v_rowid ";
+
+ $statement = OCIParse($connection,$ora_sql);
+ $rowid = OCINewDescriptor($connection,OCI_D_ROWID);
+ OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
+ if (OCIExecute($statement)) {
+ OCICommit($connection);
+ }
+ OCIFreeStatement($statement);
+ $rowid->free();
+ }
+
+ require 'drop_table.inc';
+
+ echo "Done\n";
+?>
+--EXPECTF--
+Done
+
diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc
new file mode 100644
index 0000000000..32a1ec0f1c
--- /dev/null
+++ b/ext/oci8/tests/connect.inc
@@ -0,0 +1,39 @@
+<?php
+
+/*
+ * Please, change user, password and dbase to match your configuration.
+ *
+ * */
+
+$user = "user";
+$password = "pass";
+$dbase = "base";
+
+/*
+ * You should have privileges to create tables in this schema
+ *
+ * */
+
+$schema = "system";
+
+/*
+ * Remove the last line in skipif.inc to run tests
+ *
+ * */
+
+
+ if (!empty($dbase)) {
+ $connection = ocilogon($user,$password,$dbase);
+ }
+ else {
+ $connection = ocilogon($user,$password);
+ }
+
+ if (!empty($schema)) {
+ $schema = $schema.".";
+ }
+ else {
+ $schema = '';
+ }
+
+?>
diff --git a/ext/oci8/tests/create_table.inc b/ext/oci8/tests/create_table.inc
new file mode 100644
index 0000000000..c423ce577d
--- /dev/null
+++ b/ext/oci8/tests/create_table.inc
@@ -0,0 +1,12 @@
+<?php
+
+ if ($connection) {
+ $ora_sql = "CREATE TABLE
+ ".$schema."php_test_table (id NUMBER, value NUMBER)
+ ";
+
+ $statement = OCIParse($connection,$ora_sql);
+ OCIExecute($statement);
+ }
+
+?>
diff --git a/ext/oci8/tests/drop_table.inc b/ext/oci8/tests/drop_table.inc
new file mode 100644
index 0000000000..4e558f5e33
--- /dev/null
+++ b/ext/oci8/tests/drop_table.inc
@@ -0,0 +1,12 @@
+<?php
+
+ if ($connection) {
+ $ora_sql = "DROP TABLE
+ ".$schema."php_test_table
+ ";
+
+ $statement = OCIParse($connection,$ora_sql);
+ OCIExecute($statement);
+ }
+
+?>
diff --git a/ext/oci8/tests/skipif.inc b/ext/oci8/tests/skipif.inc
new file mode 100644
index 0000000000..ed0992c8d9
--- /dev/null
+++ b/ext/oci8/tests/skipif.inc
@@ -0,0 +1,10 @@
+<?php
+
+if (!extension_loaded('oci8')) die("skip oci8 extension is not available\n");
+
+/*
+ * Remove or comment this line to run tests
+ *
+ * */
+die("skip change default login/password\n");
+?>