tony2001                Thu Dec 21 19:22:49 2006 UTC

  Added files:                 
    /php-src/ext/oci8/tests     array_bind_014.phpt fetch_all2.phpt 
                                lob_033.phpt lob_034.phpt lob_035.phpt 

  Modified files:              
    /php-src/ext/oci8/tests     array_bind_int1.phpt error1.phpt 
                                lob_020.phpt lob_027.phpt 
                                privileged_connect1.phpt 
  Log:
  improve tests, add new ones
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_int1.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_int1.phpt
diff -u php-src/ext/oci8/tests/array_bind_int1.phpt:1.2 
php-src/ext/oci8/tests/array_bind_int1.phpt:1.3
--- php-src/ext/oci8/tests/array_bind_int1.phpt:1.2     Thu Dec  8 22:31:55 2005
+++ php-src/ext/oci8/tests/array_bind_int1.phpt Thu Dec 21 19:22:49 2006
@@ -50,7 +50,7 @@
 
 $array = Array(1,2,3,4,5);
 
-oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_NUM);
+oci_bind_array_by_name($statement, ":c1", $array, 10, 5, SQLT_INT);
 
 oci_execute($statement);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/error1.phpt?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/oci8/tests/error1.phpt
diff -u php-src/ext/oci8/tests/error1.phpt:1.8 
php-src/ext/oci8/tests/error1.phpt:1.9
--- php-src/ext/oci8/tests/error1.phpt:1.8      Thu Nov 23 16:08:41 2006
+++ php-src/ext/oci8/tests/error1.phpt  Thu Dec 21 19:22:49 2006
@@ -32,7 +32,7 @@
   ["code"]=>
   int(12154)
   ["message"]=>
-  unicode(45) "ORA-12154: TNS:could not resolve %s"
+  unicode(%d) "ORA-12154: TNS:could not resolve %s"
   ["offset"]=>
   int(0)
   ["sqltext"]=>
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_020.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/oci8/tests/lob_020.phpt
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_027.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/oci8/tests/lob_027.phpt
diff -u php-src/ext/oci8/tests/lob_027.phpt:1.1 
php-src/ext/oci8/tests/lob_027.phpt:1.2
--- php-src/ext/oci8/tests/lob_027.phpt:1.1     Mon Dec 11 12:31:54 2006
+++ php-src/ext/oci8/tests/lob_027.phpt Thu Dec 21 19:22:49 2006
@@ -47,6 +47,16 @@
        oci_commit($c);
 }
 
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row = oci_fetch_array($s);
+var_dump($row['BLOB']->load());
+var_dump($row['BLOB']->truncate(-1));
+var_dump($row['BLOB']->truncate(0));
+
+oci_commit($c);
 
 require dirname(__FILE__).'/drop_table.inc';
 
@@ -85,6 +95,11 @@
 
 Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in 
%s on line %d
 bool(false)
+string(0) ""
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in 
%s on line %d
+bool(false)
+bool(true)
 Done
 --UEXPECTF--
 object(OCI-Lob)#%d (1) {
@@ -118,4 +133,9 @@
 
 Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in 
%s on line %d
 bool(false)
+string(0) ""
+
+Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in 
%s on line %d
+bool(false)
+bool(true)
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/privileged_connect1.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/oci8/tests/privileged_connect1.phpt
diff -u php-src/ext/oci8/tests/privileged_connect1.phpt:1.4 
php-src/ext/oci8/tests/privileged_connect1.phpt:1.5
--- php-src/ext/oci8/tests/privileged_connect1.phpt:1.4 Tue Dec 12 13:12:22 2006
+++ php-src/ext/oci8/tests/privileged_connect1.phpt     Thu Dec 21 19:22:49 2006
@@ -25,3 +25,12 @@
 
 Warning: oci_connect() expects parameter 5 to be long, string given in %s on 
line %d
 Done
+--UEXPECTF--
+Warning: oci_connect(): ORA-01017: invalid username/password; logon denied in 
%s on line %d
+
+Warning: oci_connect(): ORA-01017: invalid username/password; logon denied in 
%s on line %d
+
+Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d
+
+Warning: oci_connect() expects parameter 5 to be long, Unicode string given in 
%s on line %d
+Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_014.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/array_bind_014.phpt
+++ php-src/ext/oci8/tests/array_bind_014.phpt
--TEST--
oci_bind_array_by_name() and NUMBERs
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php

require dirname(__FILE__).'/connect.inc';

$drop = "DROP table bind_test";
$statement = oci_parse($c, $drop);
@oci_execute($statement);

$create = "CREATE table bind_test(name NUMBER)";
$statement = oci_parse($c, $create);
oci_execute($statement);

$create_pkg = "
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS 
  TYPE ARRTYPE IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; 
  PROCEDURE iobind(c1 IN OUT ARRTYPE); 
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);

$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS 
  CURSOR CUR IS SELECT name FROM bind_test;
  PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
    BEGIN
    IF NOT CUR%ISOPEN THEN
      OPEN CUR;
    END IF;
    FOR i IN REVERSE 1..5 LOOP
      FETCH CUR INTO c1(i);
      IF CUR%NOTFOUND THEN
        CLOSE CUR;
        EXIT;
      END IF;
    END LOOP;
  END iobind;
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);

for ($i = 1; $i < 6; $i++) {
        $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
        oci_execute($statement);
}

$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.iobind(:c1); END;");
$array = Array();
oci_bind_array_by_name($statement, ":c1", $array, 5, -1, SQLT_INT);
oci_execute($statement);

var_dump($array);

echo "Done\n";
?>
--EXPECTF--     
array(5) {
  [0]=>
  int(5)
  [1]=>
  int(4)
  [2]=>
  int(3)
  [3]=>
  int(2)
  [4]=>
  int(1)
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/fetch_all2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/fetch_all2.phpt
+++ php-src/ext/oci8/tests/fetch_all2.phpt
--TEST--
oci_fetch_all() - 2 
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php

require dirname(__FILE__)."/connect.inc";
require dirname(__FILE__).'/create_table.inc';

$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";

$s = oci_parse($c, $insert_sql);

for ($i = 0; $i<3; $i++) {
        oci_execute($s);
}

oci_commit($c);

$select_sql = "SELECT * FROM ".$schema."".$table_name."";

$s = oci_parse($c, $select_sql);

oci_execute($s);
var_dump(oci_fetch_all($s, $all));
var_dump($all);

oci_execute($s);
var_dump(oci_fetch_all($s, $all, 0, 10, OCI_FETCHSTATEMENT_BY_ROW));
var_dump($all);

oci_execute($s);
var_dump(oci_fetch_all($s, $all, -1, -1, OCI_FETCHSTATEMENT_BY_ROW));
var_dump($all);

oci_execute($s);
var_dump(oci_fetch_all($s, $all, 0, 2, OCI_FETCHSTATEMENT_BY_ROW+OCI_NUM));
var_dump($all);

oci_execute($s);
var_dump(oci_fetch_all($s, $all, 0, 2, OCI_NUM));
var_dump($all);

oci_execute($s);
var_dump(oci_fetch_all($s, $all, 0, 1, OCI_BOTH));
var_dump($all);

require dirname(__FILE__).'/drop_table.inc';
        
echo "Done\n";
?>
--EXPECT--
int(3)
array(5) {
  ["ID"]=>
  array(3) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
    [2]=>
    string(1) "1"
  }
  ["VALUE"]=>
  array(3) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
    [2]=>
    string(1) "1"
  }
  ["BLOB"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
  ["CLOB"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
  ["STRING"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
}
int(3)
array(3) {
  [0]=>
  array(5) {
    ["ID"]=>
    string(1) "1"
    ["VALUE"]=>
    string(1) "1"
    ["BLOB"]=>
    NULL
    ["CLOB"]=>
    NULL
    ["STRING"]=>
    NULL
  }
  [1]=>
  array(5) {
    ["ID"]=>
    string(1) "1"
    ["VALUE"]=>
    string(1) "1"
    ["BLOB"]=>
    NULL
    ["CLOB"]=>
    NULL
    ["STRING"]=>
    NULL
  }
  [2]=>
  array(5) {
    ["ID"]=>
    string(1) "1"
    ["VALUE"]=>
    string(1) "1"
    ["BLOB"]=>
    NULL
    ["CLOB"]=>
    NULL
    ["STRING"]=>
    NULL
  }
}
int(0)
array(0) {
}
int(2)
array(2) {
  [0]=>
  array(5) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
    [2]=>
    NULL
    [3]=>
    NULL
    [4]=>
    NULL
  }
  [1]=>
  array(5) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
    [2]=>
    NULL
    [3]=>
    NULL
    [4]=>
    NULL
  }
}
int(2)
array(5) {
  [0]=>
  array(2) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
  }
  [1]=>
  array(2) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "1"
  }
  [2]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  [3]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  [4]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
}
int(1)
array(5) {
  [0]=>
  array(1) {
    [0]=>
    string(1) "1"
  }
  [1]=>
  array(1) {
    [0]=>
    string(1) "1"
  }
  [2]=>
  array(1) {
    [0]=>
    NULL
  }
  [3]=>
  array(1) {
    [0]=>
    NULL
  }
  [4]=>
  array(1) {
    [0]=>
    NULL
  }
}
Done
--UEXPECT--
int(3)
array(5) {
  [u"ID"]=>
  array(3) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
    [2]=>
    unicode(1) "1"
  }
  [u"VALUE"]=>
  array(3) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
    [2]=>
    unicode(1) "1"
  }
  [u"BLOB"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
  [u"CLOB"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
  [u"STRING"]=>
  array(3) {
    [0]=>
    NULL
    [1]=>
    NULL
    [2]=>
    NULL
  }
}
int(3)
array(3) {
  [0]=>
  array(5) {
    [u"ID"]=>
    unicode(1) "1"
    [u"VALUE"]=>
    unicode(1) "1"
    [u"BLOB"]=>
    NULL
    [u"CLOB"]=>
    NULL
    [u"STRING"]=>
    NULL
  }
  [1]=>
  array(5) {
    [u"ID"]=>
    unicode(1) "1"
    [u"VALUE"]=>
    unicode(1) "1"
    [u"BLOB"]=>
    NULL
    [u"CLOB"]=>
    NULL
    [u"STRING"]=>
    NULL
  }
  [2]=>
  array(5) {
    [u"ID"]=>
    unicode(1) "1"
    [u"VALUE"]=>
    unicode(1) "1"
    [u"BLOB"]=>
    NULL
    [u"CLOB"]=>
    NULL
    [u"STRING"]=>
    NULL
  }
}
int(0)
array(0) {
}
int(2)
array(2) {
  [0]=>
  array(5) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
    [2]=>
    NULL
    [3]=>
    NULL
    [4]=>
    NULL
  }
  [1]=>
  array(5) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
    [2]=>
    NULL
    [3]=>
    NULL
    [4]=>
    NULL
  }
}
int(2)
array(5) {
  [0]=>
  array(2) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
  }
  [1]=>
  array(2) {
    [0]=>
    unicode(1) "1"
    [1]=>
    unicode(1) "1"
  }
  [2]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  [3]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
  [4]=>
  array(2) {
    [0]=>
    NULL
    [1]=>
    NULL
  }
}
int(1)
array(5) {
  [0]=>
  array(1) {
    [0]=>
    unicode(1) "1"
  }
  [1]=>
  array(1) {
    [0]=>
    unicode(1) "1"
  }
  [2]=>
  array(1) {
    [0]=>
    NULL
  }
  [3]=>
  array(1) {
    [0]=>
    NULL
  }
  [4]=>
  array(1) {
    [0]=>
    NULL
  }
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_033.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/lob_033.phpt
+++ php-src/ext/oci8/tests/lob_033.phpt
--TEST--
various oci_lob_write() error messages
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
        
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';

$ora_sql = "INSERT INTO
                       ".$schema.$table_name." (id, blob)
                      VALUES (2, empty_blob())
                      RETURNING
                               blob
                      INTO :v_blob ";

$statement = oci_parse($c,$ora_sql);
$blob = oci_new_descriptor($c,OCI_D_LOB);

$blob->save("");

oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);

var_dump($blob->save(""));
var_dump($blob->save("data", 100));

require dirname(__FILE__).'/drop_table.inc';

echo "Done\n";

?>
--EXPECTF--
Warning: OCI-Lob::save(): OCI_INVALID_HANDLE in %s on line %d
bool(true)
bool(true)
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_034.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/lob_034.phpt
+++ php-src/ext/oci8/tests/lob_034.phpt
--TEST--
lob buffering - 2
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
        
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';

$ora_sql = "INSERT INTO
                       ".$schema.$table_name." (blob)
                      VALUES (empty_blob())
                      RETURNING
                               blob
                      INTO :v_blob ";

$statement = oci_parse($c,$ora_sql);
$blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);

var_dump($blob->getBuffering());
var_dump($blob->setBuffering(false));
var_dump($blob->setBuffering(false));
var_dump($blob->setBuffering(true));
var_dump($blob->setBuffering(true));
var_dump($blob->flush());
var_dump($blob->flush(0));
var_dump($blob->flush(-1));

oci_commit($c);

require dirname(__FILE__).'/drop_table.inc';

echo "Done\n";

?>
--EXPECTF--
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)

Warning: OCI-Lob::flush(): Invalid flag value: -1 in %s on line %d
bool(false)
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_035.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/lob_035.phpt
+++ php-src/ext/oci8/tests/lob_035.phpt
--TEST--
oci_lob_copy() - 2 
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
        
require dirname(__FILE__).'/connect.inc';
require dirname(__FILE__).'/create_table.inc';

$ora_sql = "INSERT INTO
                       ".$schema.$table_name." (id, blob)
                      VALUES (1, empty_blob())
                      RETURNING
                               blob
                      INTO :v_blob ";

$statement = oci_parse($c,$ora_sql);
$blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);

var_dump($blob->write("some string here. string, I said"));
oci_commit($c);

$ora_sql = "INSERT INTO
                       ".$schema.$table_name." (id, blob)
                      VALUES (2, empty_blob())
                      RETURNING
                               blob
                      INTO :v_blob ";

$statement = oci_parse($c,$ora_sql);
$blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);

oci_commit($c);

$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1";
$s = oci_parse($c, $select_sql);
oci_execute($s);

$row1 = oci_fetch_array($s);

$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR 
UPDATE";
$s = oci_parse($c, $select_sql);
oci_execute($s, OCI_DEFAULT);

$row2 = oci_fetch_array($s);

$dummy = oci_new_descriptor($c, OCI_D_LOB);

var_dump(oci_lob_copy($dummy, $row1[0]));
var_dump(oci_lob_copy($row2[0], $dummy));

var_dump(oci_lob_copy($row2[0], $row1[0], 0));
var_dump(oci_lob_copy($row2[0], $row1[0], -1));
var_dump(oci_lob_copy($row2[0], $row1[0], 100000));

var_dump(oci_lob_size());
var_dump(oci_lob_size($row2[0]));
unset($dummy->descriptor);
var_dump(oci_lob_size($dummy));

oci_rollback($c);
oci_rollback($c);
oci_commit($c);
oci_commit($c);

$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR 
UPDATE";
$s = oci_parse($c, $select_sql);
oci_execute($s, OCI_DEFAULT);

var_dump($row2 = oci_fetch_array($s, OCI_RETURN_LOBS));

require dirname(__FILE__).'/drop_table.inc';

echo "Done\n";

?>
--EXPECTF--
int(32)

Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
bool(false)

Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
bool(false)
bool(false)

Warning: oci_lob_copy(): Length parameter must be greater than 0 in %s on line 
%d
bool(false)
bool(true)

Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
NULL
int(0)

Warning: oci_lob_size(): Unable to find descriptor property in %s on line %d
bool(false)
array(2) {
  [0]=>
  string(0) ""
  ["BLOB"]=>
  string(0) ""
}
Done
--UEXPECTF--
int(64)

Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
bool(false)

Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
bool(false)
bool(false)

Warning: oci_lob_copy(): Length parameter must be greater than 0 in %s on line 
%d
bool(false)
bool(true)

Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
NULL
int(0)

Warning: oci_lob_size(): Unable to find descriptor property in %s on line %d
bool(false)
array(2) {
  [0]=>
  string(0) ""
  [u"BLOB"]=>
  string(0) ""
}
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to