vrana Wed Sep 22 04:55:48 2004 EDT
Modified files:
/phpdoc/en/reference/ibase/functions ibase-blob-import.xml
Log:
Example (bug #22871)
http://cvs.php.net/diff.php/phpdoc/en/reference/ibase/functions/ibase-blob-import.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/ibase/functions/ibase-blob-import.xml
diff -u phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.5
phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.6
--- phpdoc/en/reference/ibase/functions/ibase-blob-import.xml:1.5 Thu Aug 12
14:11:58 2004
+++ phpdoc/en/reference/ibase/functions/ibase-blob-import.xml Wed Sep 22 04:55:45
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/ibase.xml, last change in rev 1.39 -->
<refentry id='function.ibase-blob-import'>
<refnamediv>
@@ -23,6 +23,33 @@
This function creates a BLOB, reads an entire file into it, closes it and
returns the assigned BLOB id. The file handle is a handle returned by
<function>fopen</function>. Returns &false; on failure.
+ </para>
+ <para>
+ <example>
+ <title><function>ibase_blob_import</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$dbh = ibase_connect($host, $username, $password);
+$filename = '/tmp/bar';
+
+$fd = fopen($filename, 'r');
+$blob = ibase_blob_import($dbh, $fd);
+fclose($fd);
+
+if (!is_string($blob)) {
+ // import failed
+} else {
+ $query = "INSERT INTO foo (name, data) VALUES ('$filename', ?)";
+ $prepared = ibase_prepare($dbh, $query);
+ if (!ibase_execute($prepared, $blob)) {
+ // record insertion failed
+ }
+}
+?>
+]]>
+ </programlisting>
+ </example>
</para>
<para>
See also