PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/oci8/tests/lob_029.phpt ('reading/writing BFILE LOBs')

Script

1: <?php
2:
3:
require(dirname(__FILE__).'/connect.inc');
4:
5:
$realdirname "/tmp";  // Use /tmp because a local dir can give ORA-22288 depending on perms
6:
$realfilename1 "oci8bfiletest1.txt";
7:
$fullname1 $realdirname."/".$realfilename1;
8:
$realfilename2 "oci8bfiletest2.txt";
9:
$fullname2 $realdirname."/".$realfilename2;
10:
$realfilename3 "oci8bfiletest3.txt";
11:
$fullname3 $realdirname."/".$realfilename3;
12:
13:
// Setup
14:
$s oci_parse($c"drop table FileTest");
15: @
oci_execute($s);
16:
17:
$s oci_parse($c"drop directory TestDir");
18: @
oci_execute($s);
19:
20:
$s oci_parse($c"create directory TestDir as '$realdirname'");
21:
oci_execute($s);
22:
23:
file_put_contents($fullname1'Some text in the bfile 1');
24:
file_put_contents($fullname2'Some text in the bfile 2');
25:
file_put_contents($fullname3'Some text in the bfile 3');
26:
27:
$s oci_parse($c"create table FileTest (FileNum number, FileDesc varchar2(30), Image bfile)");
28:
oci_execute($s);
29:
30:
$s oci_parse($c"insert into FileTest (FileNum, FileDesc, Image) values (1, 'Description 1', bfilename('TESTDIR', '$realfilename1'))");
31:
oci_execute($s);
32:
33:
$s oci_parse($c"insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename2'))");
34:
oci_execute($s);
35:
36:
$s oci_parse($c"insert into FileTest (FileNum, FileDesc, Image) values (3, 'Description 3', bfilename('TESTDIR', '$realfilename3'))");
37:
oci_execute($s);
38:
39:
// Run tests
40:
41:
echo "Test 1. Check how many rows in the table\n";
42:
43:
$s oci_parse($c"select count(*) numrows from FileTest");
44:
oci_execute($s);
45:
oci_fetch_all($s$res);
46:
var_dump($res);
47:
48: echo 
"Test 2\n";
49:
$s oci_parse($c"select * from FileTest order by FileNum");
50:
oci_execute($s);
51:
oci_fetch_all($s$res);
52:
var_dump($res);
53:
54: echo 
"Test 3\n";
55:
$d oci_new_descriptor($cOCI_D_FILE);
56:
57:
$s oci_parse($c"insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename1')) returning Image into :im");
58:
oci_bind_by_name($s":im"$d, -1OCI_B_BFILE);
59:
oci_execute($s);
60:
61:
$r $d->read(40);
62:
var_dump($r);
63:
64:
unlink($fullname1);
65:
unlink($fullname2);
66:
unlink($fullname3);
67:
68:
$s oci_parse($c"drop table FileTest");
69:
oci_execute($s);
70:
71:
$s oci_parse($c"drop directory TestDir");
72:
oci_execute($s);
73:
74: echo 
"Done\n";
75:
?>
76:

Expected

Test 1. Check how many rows in the table
array(1) {
  ["NUMROWS"]=>
  array(1) {
    [0]=>
    string(1) "3"
  }
}
Test 2
array(3) {
  ["FILENUM"]=>
  array(3) {
    [0]=>
    string(1) "1"
    [1]=>
    string(1) "2"
    [2]=>
    string(1) "3"
  }
  ["FILEDESC"]=>
  array(3) {
    [0]=>
    string(13) "Description 1"
    [1]=>
    string(13) "Description 2"
    [2]=>
    string(13) "Description 3"
  }
  ["IMAGE"]=>
  array(3) {
    [0]=>
    string(24) "Some text in the bfile 1"
    [1]=>
    string(24) "Some text in the bfile 2"
    [2]=>
    string(24) "Some text in the bfile 3"
  }
}
Test 3
string(24) "Some text in the bfile 1"
Done

Output

***********************************************************************
Fatal NI connect error 12541, connecting to:
 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))

  VERSION INFORMATION:
	TNS for Linux: Version 11.2.0.2.0 - Beta
	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
  Time: 17-JUN-2018 05:57:47
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12541
    TNS-12541: TNS:no listener
    ns secondary err code: 12560
    nt main err code: 511
    TNS-00511: No listener

Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
    nt secondary err code: 111
    nt OS err code: 0

Diff

001+ ***********************************************************************
002+ Fatal NI connect error 12541, connecting to:
003+  (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
004+ 
005+   VERSION INFORMATION:
006+ 	TNS for Linux: Version 11.2.0.2.0 - Beta
007+ 	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
008+   Time: 17-JUN-2018 05:57:47
009+   Tracing not turned on.
010+   Tns error struct:
011+     ns main err code: 12541
012+     TNS-12541: TNS:no listener
013+     ns secondary err code: 12560
014+     nt main err code: 511
015+     TNS-00511: No listener
016+ 
017+ Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
018+     nt secondary err code: 111
019+     nt OS err code: 0
001- Test 1. Check how many rows in the table
002- array(1) {
003-   ["NUMROWS"]=>
004-   array(1) {
005-     [0]=>
006-     string(1) "3"
007-   }
008- }
009- Test 2
010- array(3) {
011-   ["FILENUM"]=>
012-   array(3) {
013-     [0]=>
014-     string(1) "1"
015-     [1]=>
016-     string(1) "2"
017-     [2]=>
018-     string(1) "3"
019-   }
020-   ["FILEDESC"]=>
021-   array(3) {
022-     [0]=>
023-     string(13) "Description 1"
024-     [1]=>
025-     string(13) "Description 2"
026-     [2]=>
027-     string(13) "Description 3"
028-   }
029-   ["IMAGE"]=>
030-   array(3) {
031-     [0]=>
032-     string(24) "Some text in the bfile 1"
033-     [1]=>
034-     string(24) "Some text in the bfile 2"
035-     [2]=>
036-     string(24) "Some text in the bfile 3"
037-   }
038- }
039- Test 3
040- string(24) "Some text in the bfile 1"
041- Done

 

Generated at Mon, 18 Jun 2018 17:33:50 +0000 (4 days ago)

Copyright © 2005-2018 The PHP Group
All rights reserved.