xref: /PHP-7.2/ext/oci8/tests/bind_raw.phpt (revision a2c0f872)
1--TEST--
2bind RAW field
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";
12
13$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
14oci_execute($stmt);
15
16$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
17$i=1;
18$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
19$fileimage = substr($fileimage, 0, 300);
20
21oci_bind_by_name( $stmt, ":id", $i, -1);
22oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
23oci_execute($stmt, OCI_DEFAULT);
24oci_commit($c);
25
26$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
27oci_execute($stmt);
28
29$row = oci_fetch_row($stmt);
30var_dump(md5($row[0]));
31var_dump(strlen($row[0]));
32
33$stmt = oci_parse($c, "drop table phptestrawtable");
34oci_execute($stmt);
35
36echo "Done\n";
37
38?>
39--EXPECT--
40string(32) "88b274d7a257ac6f70435b83abd4e26e"
41int(300)
42Done
43