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