xref: /PHP-8.3/ext/oci8/tests/bind_long_raw.phpt (revision a53e5617)
1--TEST--
2bind LONG RAW field
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 phptestlngraw( id number(10), fileimage long raw)");
17oci_execute($stmt);
18
19$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
20$i=1;
21$fileimage = file_get_contents( __DIR__."/test.gif");
22
23oci_bind_by_name( $stmt, ":id", $i, -1);
24oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
25oci_execute($stmt, OCI_DEFAULT);
26oci_commit($c);
27
28$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
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 phptestlngraw");
36oci_execute($stmt);
37
38echo "Done\n";
39
40?>
41--EXPECT--
42string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
43int(2523)
44Done
45