xref: /PHP-8.3/ext/oci8/tests/bind_raw_2.phpt (revision a53e5617)
1--TEST--
2bind RAW field with OCI_B_BIN
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
9require __DIR__.'/skipif.inc';
10?>
11--FILE--
12<?php
13
14require __DIR__."/connect.inc";
15
16$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
17oci_execute($stmt);
18
19$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
20$i=1;
21$fileimage = file_get_contents( __DIR__."/test.gif");
22$fileimage = substr($fileimage, 0, 300);
23
24oci_bind_by_name( $stmt, ":id", $i, -1);
25oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, OCI_B_BIN);
26oci_execute($stmt, OCI_DEFAULT);
27oci_commit($c);
28
29$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
30oci_execute($stmt);
31
32$row = oci_fetch_row($stmt);
33var_dump(md5($row[0]));
34var_dump(strlen($row[0]));
35
36$stmt = oci_parse($c, "drop table phptestrawtable");
37oci_execute($stmt);
38
39echo "Done\n";
40
41?>
42--EXPECT--
43string(32) "88b274d7a257ac6f70435b83abd4e26e"
44int(300)
45Done
46