mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-24 04:48:55 +00:00

- All id attributes are now xml:id - Add docbook namespace to all root elements - Replace <ulink /> with <link xlink:href /> - Minor markup fixes here and there git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
196 lines
5 KiB
XML
196 lines
5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
|
<refentry xml:id="function.db2-lob-read" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>db2_lob_read</refname>
|
|
<refpurpose>
|
|
Gets a user defined size of LOB files with each invocation
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>db2_lob_read</methodname>
|
|
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>colnum</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>length</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Use <function>db2_lob_read</function> to iterate through a specified column of
|
|
a result set and retrieve a user defined size of LOB data.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>stmt</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A valid <literal>stmt</literal> resource containing LOB data.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>colnum</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A valid column number in the result set of the <literal>stmt</literal> resource.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The size of the LOB data to be retrieved from the <literal>stmt</literal> resource.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the amount of data the user specifies. Returns
|
|
&false; if the data cannot be retrieved.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Iterating through different types of data</title>
|
|
<para>
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
/* Database Connection Parameters */
|
|
$db = 'SAMPLE';
|
|
$username = 'db2inst1';
|
|
$password = 'ibmdb2';
|
|
|
|
/* Obtain Connection Resource */
|
|
$conn = db2_connect($db,$username,$password);
|
|
|
|
if ($conn) {
|
|
$drop = 'DROP TABLE clob_stream';
|
|
$result = @db2_exec( $conn, $drop );
|
|
|
|
$create = 'CREATE TABLE clob_stream (id INTEGER, my_clob CLOB)';
|
|
$result = db2_exec( $conn, $create );
|
|
|
|
$variable = "";
|
|
$stmt = db2_prepare($conn, "INSERT INTO clob_stream (id,my_clob) VALUES (1, ?)");
|
|
$variable = "THIS IS A CLOB TEST. THIS IS A CLOB TEST.";
|
|
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
|
|
db2_execute($stmt);
|
|
|
|
$sql = "SELECT id,my_clob FROM clob_stream";
|
|
$result = db2_prepare($conn, $sql);
|
|
db2_execute($result);
|
|
db2_fetch_row($result);
|
|
$i = 0;
|
|
/* Read LOB data */
|
|
while ($data = db2_lob_read($result, 2, 6)) {
|
|
echo "Loop $i: $data\n";
|
|
$i = $i + 1;
|
|
}
|
|
|
|
$drop = 'DROP TABLE blob_stream';
|
|
$result = @db2_exec( $conn, $drop );
|
|
|
|
$create = 'CREATE TABLE blob_stream (id INTEGER, my_blob CLOB)';
|
|
$result = db2_exec( $conn, $create );
|
|
|
|
$variable = "";
|
|
$stmt = db2_prepare($conn, "INSERT INTO blob_stream (id,my_blob) VALUES (1, ?)");
|
|
$variable = "THIS IS A BLOB TEST. THIS IS A BLOB TEST.";
|
|
db2_bind_param($stmt, 1, "variable", DB2_PARAM_IN);
|
|
db2_execute($stmt);
|
|
|
|
$sql = "SELECT id,my_blob FROM blob_stream";
|
|
$result = db2_prepare($conn, $sql);
|
|
db2_execute($result);
|
|
db2_fetch_row($result);
|
|
$i = 0;
|
|
/* Read LOB data */
|
|
while ($data = db2_lob_read($result, 2, 6)) {
|
|
echo "Loop $i: $data\n";
|
|
$i = $i + 1;
|
|
}
|
|
} else {
|
|
echo 'no connection: ' . db2_conn_errormsg();
|
|
}
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Loop 0: THIS I
|
|
Loop 1: S A CL
|
|
Loop 2: OB TES
|
|
Loop 3: T. THI
|
|
Loop 4: S IS A
|
|
Loop 5: CLOB
|
|
Loop 6: TEST.
|
|
Loop 0: THIS I
|
|
Loop 1: S A BL
|
|
Loop 2: OB TES
|
|
Loop 3: T. THI
|
|
Loop 4: S IS A
|
|
Loop 5: BLOB
|
|
Loop 6: TEST.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>db2_bind_param</function></member>
|
|
<member><function>db2_exec</function></member>
|
|
<member><function>db2_execute</function></member>
|
|
<member><function>db2_fetch_row</function></member>
|
|
<member><function>db2_prepare</function></member>
|
|
<member><function>db2_result</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:"../../../../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
|
|
-->
|