xref: /PHP-7.2/ext/oci8/tests/lob_042.phpt (revision 37652336)
1--TEST--
2Check various LOB error messages
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require(dirname(__FILE__).'/connect.inc');
12require(dirname(__FILE__).'/create_table.inc');
13
14$ora_sql = "INSERT INTO
15                       ".$schema.$table_name." (blob)
16                      VALUES (empty_blob())
17                      RETURNING
18                               blob
19                      INTO :v_blob ";
20
21$statement = oci_parse($c,$ora_sql);
22$blob = oci_new_descriptor($c,OCI_D_LOB);
23oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
24oci_execute($statement, OCI_DEFAULT);
25
26var_dump($blob);
27
28var_dump($blob->writeTemporary("test", OCI_D_LOB));
29
30$str = "string";
31var_dump($blob->write($str));
32var_dump($blob->truncate(1));
33var_dump($blob->truncate(1));
34var_dump($blob->truncate(2));
35var_dump($blob->truncate(-1));
36var_dump($blob->read(2));
37
38var_dump($blob->import("does_not_exist"));
39var_dump($blob->saveFile("does_not_exist"));
40
41require(dirname(__FILE__).'/drop_table.inc');
42
43echo "Done\n";
44
45?>
46--EXPECTF--
47object(OCI-Lob)#%d (1) {
48  ["descriptor"]=>
49  resource(%d) of type (oci8 descriptor)
50}
51
52Warning: OCI-Lob::writetemporary(): Invalid temporary lob type: %d in %s on line %d
53bool(false)
54int(6)
55bool(true)
56bool(true)
57
58Warning: OCI-Lob::truncate(): Size must be less than or equal to the current LOB size in %s on line %d
59bool(false)
60
61Warning: OCI-Lob::truncate(): Length must be greater than or equal to zero in %s on line %d
62bool(false)
63
64Warning: OCI-Lob::read(): Offset must be less than size of the LOB in %s on line %d
65bool(false)
66
67Warning: OCI-Lob::import(): Can't open file %s in %s on line %d
68bool(false)
69
70Warning: OCI-Lob::savefile(): Can't open file %s in %s on line %d
71bool(false)
72Done
73