mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
new tests
This commit is contained in:
parent
40fe5baf8c
commit
ad67978a49
8 changed files with 586 additions and 0 deletions
39
ext/oci8/tests/array_bind_013.phpt
Normal file
39
ext/oci8/tests/array_bind_013.phpt
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
--TEST--
|
||||||
|
oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/connect.inc';
|
||||||
|
|
||||||
|
$statement = oci_parse($c, 'SELECT user FROM v$session');
|
||||||
|
|
||||||
|
$array = array();
|
||||||
|
|
||||||
|
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10, SQLT_CHR, -10));
|
||||||
|
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10));
|
||||||
|
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1));
|
||||||
|
var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0));
|
||||||
|
|
||||||
|
oci_execute($statement);
|
||||||
|
|
||||||
|
var_dump($array);
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
array(0) {
|
||||||
|
}
|
||||||
|
Done
|
52
ext/oci8/tests/define1.phpt
Normal file
52
ext/oci8/tests/define1.phpt
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
--TEST--
|
||||||
|
oci_define_by_name()
|
||||||
|
--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." (string) VALUES ('some')";
|
||||||
|
|
||||||
|
if (!($s = oci_parse($c, $insert_sql))) {
|
||||||
|
die("oci_parse(insert) failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!oci_execute($s)) {
|
||||||
|
die("oci_execute(insert) failed!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
|
||||||
|
|
||||||
|
/* the define MUST be done BEFORE ociexecute! */
|
||||||
|
|
||||||
|
$strong = '';
|
||||||
|
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
|
||||||
|
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
|
||||||
|
var_dump(oci_define_by_name($stmt, "", $string, 20));
|
||||||
|
var_dump(oci_define_by_name($stmt, ""));
|
||||||
|
|
||||||
|
oci_execute($stmt);
|
||||||
|
|
||||||
|
while (oci_fetch($stmt)) {
|
||||||
|
var_dump($string);
|
||||||
|
}
|
||||||
|
|
||||||
|
require dirname(__FILE__)."/drop_table.inc";
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
bool(true)
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
string(4) "some"
|
||||||
|
Done
|
74
ext/oci8/tests/lob_021.phpt
Normal file
74
ext/oci8/tests/lob_021.phpt
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
--TEST--
|
||||||
|
oci_lob_free()/close()
|
||||||
|
--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);
|
||||||
|
|
||||||
|
$blob;
|
||||||
|
|
||||||
|
var_dump($blob->write("test"));
|
||||||
|
var_dump($blob->close());
|
||||||
|
var_dump($blob->write("test"));
|
||||||
|
var_dump(oci_free_descriptor($blob));
|
||||||
|
var_dump($blob->write("test"));
|
||||||
|
|
||||||
|
var_dump(oci_free_descriptor($blob));
|
||||||
|
var_dump(oci_free_descriptor(new stdclass));
|
||||||
|
|
||||||
|
$blob = oci_new_descriptor($c,OCI_D_LOB);
|
||||||
|
unset($blob->descriptor);
|
||||||
|
var_dump(oci_free_descriptor($blob));
|
||||||
|
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$select_sql = "SELECT blob FROM ".$schema.$table_name."";
|
||||||
|
$s = oci_parse($c, $select_sql);
|
||||||
|
oci_execute($s);
|
||||||
|
|
||||||
|
var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS));
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/drop_table.inc';
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
int(4)
|
||||||
|
|
||||||
|
Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
int(4)
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_free_descriptor(): %d is not a valid oci8 descriptor resource in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_free_descriptor() expects parameter 1 to be OCI-Lob, object given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_free_descriptor(): Unable to find descriptor property in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
string(8) "testtest"
|
||||||
|
}
|
||||||
|
Done
|
80
ext/oci8/tests/lob_022.phpt
Normal file
80
ext/oci8/tests/lob_022.phpt
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
--TEST--
|
||||||
|
fetching the same lob several times
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/connect.inc';
|
||||||
|
|
||||||
|
$drop = "DROP table lob_test";
|
||||||
|
$statement = oci_parse($c, $drop);
|
||||||
|
@oci_execute($statement);
|
||||||
|
|
||||||
|
$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
|
||||||
|
$statement = oci_parse($c, $create);
|
||||||
|
oci_execute($statement);
|
||||||
|
|
||||||
|
$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
|
||||||
|
$statement = oci_parse($c, $init);
|
||||||
|
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||||
|
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
|
||||||
|
oci_execute($statement, OCI_DEFAULT);
|
||||||
|
$clob->save();
|
||||||
|
oci_lob_save();
|
||||||
|
oci_lob_save($clob, "data");
|
||||||
|
unset($clob->descriptor);
|
||||||
|
oci_lob_save($clob, "data");
|
||||||
|
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
|
||||||
|
$statement = oci_parse($c, $init);
|
||||||
|
$clob = oci_new_descriptor($c, OCI_D_LOB);
|
||||||
|
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
|
||||||
|
oci_execute($statement, OCI_DEFAULT);
|
||||||
|
$clob->save("long data");
|
||||||
|
$clob->save("long data", -1);
|
||||||
|
$clob->save("long data", 0);
|
||||||
|
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
|
||||||
|
$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
|
||||||
|
$statement = oci_parse ($c, $query);
|
||||||
|
oci_execute($statement, OCI_DEFAULT);
|
||||||
|
|
||||||
|
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
|
||||||
|
$result = $row['LOB_1']->load();
|
||||||
|
var_dump($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
|
||||||
|
$statement = oci_parse ($c, $query);
|
||||||
|
oci_execute($statement, OCI_DEFAULT);
|
||||||
|
|
||||||
|
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
|
||||||
|
$result = $row['LOB_1']->load();
|
||||||
|
var_dump($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
$drop = "DROP table lob_test";
|
||||||
|
$statement = oci_parse($c, $drop);
|
||||||
|
@oci_execute($statement);
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d
|
||||||
|
|
||||||
|
Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
|
||||||
|
|
||||||
|
Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d
|
||||||
|
|
||||||
|
Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d
|
||||||
|
string(4) "data"
|
||||||
|
string(9) "long data"
|
||||||
|
string(9) "long data"
|
||||||
|
string(4) "data"
|
||||||
|
Done
|
84
ext/oci8/tests/lob_023.phpt
Normal file
84
ext/oci8/tests/lob_023.phpt
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
--TEST--
|
||||||
|
oci_lob_import()/read()
|
||||||
|
--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);
|
||||||
|
var_dump($blob->seek(10, OCI_SEEK_CUR));
|
||||||
|
var_dump($blob->import(dirname(__FILE__)."/lob_009.txt"));
|
||||||
|
var_dump($blob->import());
|
||||||
|
var_dump(oci_lob_import($blob));
|
||||||
|
var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt"));
|
||||||
|
unset($blob->descriptor);
|
||||||
|
var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt"));
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||||
|
$s = oci_parse($c, $select_sql);
|
||||||
|
oci_execute($s, OCI_DEFAULT);
|
||||||
|
|
||||||
|
var_dump($row = oci_fetch_array($s));
|
||||||
|
|
||||||
|
while (!$row[0]->eof()) {
|
||||||
|
var_dump($row[0]->read(1024));
|
||||||
|
}
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/drop_table.inc';
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
bool(true)
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
["BLOB"]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string(43) "this
|
||||||
|
is
|
||||||
|
a
|
||||||
|
test
|
||||||
|
file for
|
||||||
|
test lob_009.phpt
|
||||||
|
"
|
||||||
|
Done
|
75
ext/oci8/tests/lob_024.phpt
Normal file
75
ext/oci8/tests/lob_024.phpt
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
--TEST--
|
||||||
|
oci_lob_load()
|
||||||
|
--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);
|
||||||
|
|
||||||
|
var_dump($blob->size());
|
||||||
|
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||||
|
var_dump($blob->size());
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||||
|
$s = oci_parse($c, $select_sql);
|
||||||
|
oci_execute($s, OCI_DEFAULT);
|
||||||
|
|
||||||
|
var_dump($row = oci_fetch_array($s));
|
||||||
|
|
||||||
|
var_dump(strlen($row[0]->load()));
|
||||||
|
var_dump(strlen(oci_lob_load($row[0])));
|
||||||
|
var_dump(oci_lob_load());
|
||||||
|
unset($row[0]->descriptor);
|
||||||
|
var_dump(oci_lob_load($row[0]));
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/drop_table.inc';
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
int(0)
|
||||||
|
int(7000)
|
||||||
|
int(7000)
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
["BLOB"]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int(7000)
|
||||||
|
int(7000)
|
||||||
|
|
||||||
|
Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
Done
|
82
ext/oci8/tests/lob_025.phpt
Normal file
82
ext/oci8/tests/lob_025.phpt
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
--TEST--
|
||||||
|
oci_lob_read() tests
|
||||||
|
--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->size());
|
||||||
|
var_dump($blob->write(str_repeat("string.", 1000)));
|
||||||
|
var_dump($blob->size());
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||||
|
$s = oci_parse($c, $select_sql);
|
||||||
|
oci_execute($s, OCI_DEFAULT);
|
||||||
|
|
||||||
|
var_dump($row = oci_fetch_array($s));
|
||||||
|
|
||||||
|
var_dump(oci_lob_read($row[0], 2));
|
||||||
|
var_dump(oci_lob_read($row[0]));
|
||||||
|
var_dump(oci_lob_read());
|
||||||
|
var_dump(oci_lob_eof($row[0]));
|
||||||
|
var_dump(oci_lob_eof());
|
||||||
|
|
||||||
|
unset($row[0]->descriptor);
|
||||||
|
var_dump(oci_lob_read($row[0],1));
|
||||||
|
var_dump(oci_lob_eof($row[0]));
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/drop_table.inc';
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
int(0)
|
||||||
|
int(7000)
|
||||||
|
int(7000)
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
["BLOB"]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string(2) "st"
|
||||||
|
|
||||||
|
Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
|
||||||
|
Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d
|
||||||
|
bool(false)
|
||||||
|
Done
|
100
ext/oci8/tests/lob_026.phpt
Normal file
100
ext/oci8/tests/lob_026.phpt
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
--TEST--
|
||||||
|
oci_lob_seek()/rewind()/append()
|
||||||
|
--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);
|
||||||
|
|
||||||
|
var_dump(oci_lob_write($blob, "test"));
|
||||||
|
var_dump(oci_lob_rewind());
|
||||||
|
var_dump(oci_lob_rewind($blob));
|
||||||
|
var_dump(oci_lob_write($blob, "str"));
|
||||||
|
var_dump(oci_lob_seek(10, OCI_SEEK_SET));
|
||||||
|
var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET));
|
||||||
|
|
||||||
|
oci_commit($c);
|
||||||
|
|
||||||
|
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
|
||||||
|
$s = oci_parse($c, $select_sql);
|
||||||
|
oci_execute($s, OCI_DEFAULT);
|
||||||
|
|
||||||
|
var_dump($row = oci_fetch_array($s));
|
||||||
|
|
||||||
|
var_dump(oci_lob_append());
|
||||||
|
var_dump(oci_lob_append($blob));
|
||||||
|
var_dump(oci_lob_append($row[0], $blob));
|
||||||
|
var_dump(oci_lob_read(10000));
|
||||||
|
var_dump(oci_lob_read($row[0], 10000));
|
||||||
|
|
||||||
|
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(oci_lob_read($row[0], 10000));
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/drop_table.inc';
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
int(4)
|
||||||
|
|
||||||
|
Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
bool(true)
|
||||||
|
int(3)
|
||||||
|
|
||||||
|
Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d
|
||||||
|
NULL
|
||||||
|
bool(true)
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
["BLOB"]=>
|
||||||
|
object(OCI-Lob)#%d (1) {
|
||||||
|
["descriptor"]=>
|
||||||
|
resource(%d) of type (oci8 descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d
|
||||||
|
NULL
|
||||||
|
string(4) "strt"
|
||||||
|
string(8) "strtstrt"
|
||||||
|
Done
|
Loading…
Add table
Add a link
Reference in a new issue