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