php-doc-en/reference/cubrid/functions/cubrid-lob2-write.xml
2013-07-15 02:24:45 +00:00

154 lines
4.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.cubrid-lob2-write" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_lob2_write</refname>
<refpurpose>Write to a lob object.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_lob2_write</methodname>
<methodparam><type>resource</type><parameter>lob_identifier</parameter></methodparam>
<methodparam><type>string</type><parameter>buf</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_lob2_write</function> function reads as much as data
from <parameter>buf</parameter> and stores it to the LOB object. Note that
this function can only append characters now.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>lob_identifier</parameter></term>
<listitem>
<para>Lob identifier as a result of <function>cubrid_lob2_new</function> or get from the result set.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>buf</parameter></term>
<listitem>
<para>Data that need to be written to the lob object.</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; if the process is successful and &false; for failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>cubrid_lob2_write</function> example 1</title>
<programlisting role="php">
<![CDATA[
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
cubrid_execute($conn,"DROP TABLE if exists test_lob");
cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)");
$req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES(2, ?)");
$lob = cubrid_lob2_new($conn, 'CLOB');
$len = cubrid_lob2_write($lob, "Hello world");
cubrid_lob2_bind($req, 1, $lob);
cubrid_execute($req);
cubrid_disconnect($conn);
?>
]]>
</programlisting>
</example>
<example>
<title><function>cubrid_lob2_write</function> example 2</title>
<programlisting role="php">
<![CDATA[
<?php
// test_lob (id INT, contents CLOB)
$conn = cubrid_connect("localhost", 33000, "demodb", "dba", "");
cubrid_execute($conn,"DROP TABLE if exists test_lob");
cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)");
$req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES(1, ?)");
$lob1 = cubrid_lob2_new($conn, 'CLOB');
$len = cubrid_lob2_write($lob1, "cubrid php driver");
cubrid_lob2_bind($req, 1, $lob1);
cubrid_execute($req);
$req = cubrid_execute($conn, "select * from test_lob");
$row = cubrid_fetch_row($req, CUBRID_LOB);
$lob2 = $row[1];
cubrid_lob2_seek($lob2, 0, CUBRID_CURSOR_LAST);
$pos = cubrid_lob2_tell($lob2);
print "pos before write: $pos\n";
cubrid_lob2_write($lob2, "Hello world");
$pos = cubrid_lob2_tell($lob2);
print "pos after write: $pos\n";
cubrid_disconnect($conn);
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_lob2_read</function></member>
<member><function>cubrid_lob2_seek</function></member>
<member><function>cubrid_lob2_seek64</function></member>
<member><function>cubrid_lob2_tell</function></member>
<member><function>cubrid_lob2_tell64</function></member>
<member><function>cubrid_lob2_size</function></member>
<member><function>cubrid_lob2_size64</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->