xref: /PHP-8.2/ext/oci8/tests/bind_long_raw.phpt (revision b5a14e6c)
1--TEST--
2bind LONG 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 phptestlngraw( id number(10), fileimage long raw)");
16oci_execute($stmt);
17
18$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
19$i=1;
20$fileimage = file_get_contents( __DIR__."/test.gif");
21
22oci_bind_by_name( $stmt, ":id", $i, -1);
23oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
24oci_execute($stmt, OCI_DEFAULT);
25oci_commit($c);
26
27$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
28oci_execute($stmt);
29
30$row = oci_fetch_row($stmt);
31var_dump(md5($row[0]));
32var_dump(strlen($row[0]));
33
34$stmt = oci_parse($c, "drop table phptestlngraw");
35oci_execute($stmt);
36
37echo "Done\n";
38
39?>
40--EXPECT--
41string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
42int(2523)
43Done
44