philip Wed Apr 11 05:53:31 2007 UTC
Added files:
/phpdoc/en/reference/ibm_db2/functions db2-get-option.xml
db2-lob-read.xml
db2-escape-string.xml
Modified files:
/phpdoc/en/reference/ibm_db2 configure.xml constants.xml
/phpdoc/en/reference/ibm_db2/functions db2-set-option.xml
Log:
ref.ibm_db2 commit via a set of patches by Owain Jones.
I simply modified whitespace and a few touch ups before commit.
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/configure.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc/en/reference/ibm_db2/configure.xml
diff -u phpdoc/en/reference/ibm_db2/configure.xml:1.4
phpdoc/en/reference/ibm_db2/configure.xml:1.5
--- phpdoc/en/reference/ibm_db2/configure.xml:1.4 Thu Sep 1 16:02:39 2005
+++ phpdoc/en/reference/ibm_db2/configure.xml Wed Apr 11 05:53:31 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<section id="ibm-db2.installation">
&reftitle.install;
<para>
@@ -29,6 +29,31 @@
The <command>configure</command> command defaults to
<filename class='directory'>/opt/IBM/db2/V8.1</filename>.
</para>
+ <para>
+ <note>
+ <title>Note for IIS users</title>
+ <para>
+ If you are using the ibm_db2 driver with Microsoft Internet Information
Server (IIS)
+ you may have to do the following:
+ </para>
+ <para>
+ <simplelist>
+ <member>
+ Install DB2 with extended operating system security.
+ </member>
+ <member>
+ Add the PHP binary path to the PATH system environment variable (default
C:\php\).
+ </member>
+ <member>
+ Create another system environment variable equal to the path where the
PHP.INI file is located (eg: PHPRC = C:\php\).
+ </member>
+ <member>
+ Add the IUSR_COMPUTERNAME to the DB2USERS group.
+ </member>
+ </simplelist>
+ </para>
+ </note>
+ </para>
</section>
<!-- Keep this comment at the end of the file
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/constants.xml?r1=1.7&r2=1.8&diff_format=u
Index: phpdoc/en/reference/ibm_db2/constants.xml
diff -u phpdoc/en/reference/ibm_db2/constants.xml:1.7
phpdoc/en/reference/ibm_db2/constants.xml:1.8
--- phpdoc/en/reference/ibm_db2/constants.xml:1.7 Tue Feb 21 16:42:41 2006
+++ phpdoc/en/reference/ibm_db2/constants.xml Wed Apr 11 05:53:31 2007
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc.
-->
<section id="ibm-db2.constants">
&reftitle.constants;
@@ -202,6 +202,28 @@
</simpara>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <constant>DB2_DEFERRED_PREPARE_ON</constant>
+ (<type>integer</type>)
+ </term>
+ <listitem>
+ <simpara>
+ Specifies that deferred prepare should be turned on for the specified
statement resource.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <constant>DB2_DEFERRED_PREPARE_OFF</constant>
+ (<type>integer</type>)
+ </term>
+ <listitem>
+ <simpara>
+ Specifies that deferred prepare should be turned off for the specified
statement resource.
+ </simpara>
+ </listitem>
+ </varlistentry>
</variablelist>
</section>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml
diff -u phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml:1.4
phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml:1.5
--- phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml:1.4 Thu Nov
9 14:43:20 2006
+++ phpdoc/en/reference/ibm_db2/functions/db2-set-option.xml Wed Apr 11
05:53:31 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<refentry id="function.db2-set-option">
<refnamediv>
<refname>db2_set_option</refname>
@@ -122,11 +122,29 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><parameter>deferred_prepare</parameter></term>
+ <listitem>
+ <para>
+ Passing <literal>DB2_DEFERRED_PREPARE_ON</literal> turns
deferred
+ prepare on for the specified statement resource.
+ </para>
+ <para>
+ Passing <literal>DB2_DEFERRED_PREPARE_OFF</literal> turns
deferred
+ prepare off for the specified statement resource.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
<para>
- The following new i5/OS options are available as of ibm_db2
version 1.5.1.
- Note: prior versions of ibm_db2 do not support these new i5
options.
+ The following new i5/OS options are available as of ibm_db2
version 1.5.1.
+ <note>
+ <title>Note</title>
+ <para>
+ Prior versions of ibm_db2 do not support these new i5 options.
+ </para>
+ </note>
<variablelist>
<varlistentry>
<term><parameter>i5_fetch_only</parameter></term>
@@ -145,6 +163,93 @@
</varlistentry>
</variablelist>
</para>
+ <para>
+ The following new options are available as of ibm_db2 version
1.6.0. They provide useful tracking information
+ that can be accessed during execution with
<function>db2_get_option</function>.
+ <note>
+ <title>Note</title>
+ <para>
+ Prior versions of ibm_db2 do not support these new options.
+ </para>
+ <para>
+ When the value in each option is being set, some servers might
not handle
+ the entire length provided and might truncate the value.
+ </para>
+ <para>
+ To ensure that the data specified in each option is converted
correctly
+ when transmitted to a host system, use only the characters A
through Z,
+ 0 through 9, and the underscore (_) or period (.).
+ </para>
+ </note>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>userid</parameter></term>
+ <listitem>
+ <para>
+ <literal>SQL_ATTR_INFO_USERID</literal> - A pointer to a
null-terminated
+ character string used to identify the client user ID sent to
the host
+ database server when using DB2 Connect.
+ <note>
+ <title>Note</title>
+ <para>
+ DB2 for z/OS and OS/390 servers support up to a length of
16 characters.
+ This user-id is not to be confused with the authentication
user-id, it is for
+ identification purposes only and is not used for any
authorization.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>acctstr</parameter></term>
+ <listitem>
+ <para>
+ <literal>SQL_ATTR_INFO_ACCTSTR</literal> - A pointer to a
null-terminated
+ character string used to identify the client accounting
string sent to the
+ host database server when using DB2 Connect.
+ <note>
+ <title>Note</title>
+ <para>
+ DB2 for z/OS and OS/390 servers support up to a length of
200 characters.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>applname</parameter></term>
+ <listitem>
+ <para>
+ <literal>SQL_ATTR_INFO_APPLNAME</literal> - A pointer to a
null-terminated
+ character string used to identify the client application name
sent to the
+ host database server when using DB2 Connect.
+ <note>
+ <title>Note</title>
+ <para>
+ DB2 for z/OS and OS/390 servers support up to a length of
32 characters.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>wrkstnname</parameter></term>
+ <listitem>
+ <para>
+ <literal>SQL_ATTR_INFO_WRKSTNNAME</literal> - A pointer to a
null-terminated
+ character string used to identify the client workstation name
sent to the
+ host database server when using DB2 Connect.
+ <note>
+ <title>Note</title>
+ <para>
+ DB2 for z/OS and OS/390 servers support up to a length of
18 characters.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
</listitem>
</varlistentry>
<varlistentry>
@@ -220,14 +325,14 @@
<row>
<entry>cursor</entry>
<entry><literal>DB2_SCROLLABLE</literal></entry>
- <entry colname="col3">X</entry>
+ <entry colname="col3">-</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
<row>
<entry>cursor</entry>
<entry><literal>DB2_FORWARD_ONLY</literal></entry>
- <entry colname="col3">X</entry>
+ <entry colname="col3">-</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
@@ -274,6 +379,20 @@
<entry colname="col5">-</entry>
</row>
<row>
+ <entry>deferred_prepare</entry>
+ <entry><literal>DB2_DEFERRED_PREPARE_ON</literal></entry>
+ <entry colname="col3">-</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
+ <row>
+ <entry>deferred_prepare</entry>
+ <entry><literal>DB2_DEFERRED_PREPARE_OFF</literal></entry>
+ <entry colname="col3">-</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
+ <row>
<entry>i5_fetch_only</entry>
<entry><literal>DB2_I5_FETCH_ON</literal></entry>
<entry colname="col3">-</entry>
@@ -287,6 +406,34 @@
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
+ <row>
+ <entry>userid</entry>
+ <entry><literal>SQL_ATTR_INFO_USERID</literal></entry>
+ <entry colname="col3">X</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
+ <row>
+ <entry>acctstr</entry>
+ <entry><literal>SQL_ATTR_INFO_ACCTSTR</literal></entry>
+ <entry colname="col3">X</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
+ <row>
+ <entry>applname</entry>
+ <entry><literal>SQL_ATTR_INFO_APPLNAME</literal></entry>
+ <entry colname="col3">X</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
+ <row>
+ <entry>wrkstnname</entry>
+ <entry><literal>SQL_ATTR_INFO_WRKSTNNAME</literal></entry>
+ <entry colname="col3">X</entry>
+ <entry colname="col4">X</entry>
+ <entry colname="col5">-</entry>
+ </row>
</tbody>
</tgroup>
</table>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/functions/db2-get-option.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/ibm_db2/functions/db2-get-option.xml
+++ phpdoc/en/reference/ibm_db2/functions/db2-get-option.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.db2-get-option">
<refnamediv>
<refname>db2_get_option</refname>
<refpurpose>Retrieves an option value for a statement resource or a
connection resource</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>db2_get_option</methodname>
<methodparam><type>resource</type><parameter>resource</parameter></methodparam>
<methodparam><type>string</type><parameter>option</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the value of a specified option value for a statement resource
or a connection resource.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>resource</parameter></term>
<listitem>
<para>
A valid statement resource as returned from
<function>db2_prepare</function> or a valid connection resource as
returned from <function>db2_connect</function> or
<function>db2_pconnect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
A valid statement or connection options. The following new options are
available
as of ibm_db2 version 1.6.0. They provide useful tracking information
that can be set during execution with <function>db2_get_option</function>.
<note>
<title>Note</title>
<para>
Prior versions of ibm_db2 do not support these new options.
</para>
<para>
When the value in each option is being set, some servers might not
handle
the entire length provided and might truncate the value.
</para>
<para>
To ensure that the data specified in each option is converted correctly
when transmitted to a host system, use only the characters A through Z,
0 through 9, and the underscore (_) or period (.).
</para>
</note>
<variablelist>
<varlistentry>
<term><parameter>userid</parameter></term>
<listitem>
<para>
<literal>SQL_ATTR_INFO_USERID</literal> - A pointer to a
null-terminated
character string used to identify the client user ID sent to the
host
database server when using DB2 Connect.
<note>
<title>Note</title>
<para>
DB2 for z/OS and OS/390 servers support up to a length of 16
characters.
This user-id is not to be confused with the authentication
user-id, it is for
identification purposes only and is not used for any authorization.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>acctstr</parameter></term>
<listitem>
<para>
<literal>SQL_ATTR_INFO_ACCTSTR</literal> - A pointer to a
null-terminated
character string used to identify the client accounting string sent
to the
host database server when using DB2 Connect.
<note>
<title>Note</title>
<para>
DB2 for z/OS and OS/390 servers support up to a length of 200
characters.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>applname</parameter></term>
<listitem>
<para>
<literal>SQL_ATTR_INFO_APPLNAME</literal> - A pointer to a
null-terminated
character string used to identify the client application name sent
to the
host database server when using DB2 Connect.
<note>
<title>Note</title>
<para>
DB2 for z/OS and OS/390 servers support up to a length of 32
characters.
</para>
</note>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>wrkstnname</parameter></term>
<listitem>
<para>
<literal>SQL_ATTR_INFO_WRKSTNNAME</literal> - A pointer to a
null-terminated
character string used to identify the client workstation name sent
to the
host database server when using DB2 Connect.
<note>
<title>Note</title>
<para>
DB2 for z/OS and OS/390 servers support up to a length of 18
characters.
</para>
</note>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
The following table specifies which options are compatible with
the available resource types:
<table>
<title>Resource-Parameter Matrix</title>
<tgroup cols="5">
<colspec colnum="1" colname="col1" align="center" />
<colspec colnum="2" colname="col2" align="center" />
<colspec colnum="3" colname="col3" align="center" />
<colspec colnum="4" colname="col4" align="center" />
<colspec colnum="5" colname="col5" align="center" />
<thead>
<row>
<entry morerows="1">Key</entry>
<entry morerows="1">Value</entry>
<entry namest="col3" nameend="col5">Resource Type</entry>
</row>
</thead>
<tbody>
<row>
<entry colname="col3">Connection</entry>
<entry colname="col4">Statement</entry>
<entry colname="col5">Result Set</entry>
</row>
<row>
<entry>userid</entry>
<entry><literal>SQL_ATTR_INFO_USERID</literal></entry>
<entry colname="col3">X</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
<row>
<entry>acctstr</entry>
<entry><literal>SQL_ATTR_INFO_ACCTSTR</literal></entry>
<entry colname="col3">X</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
<row>
<entry>applname</entry>
<entry><literal>SQL_ATTR_INFO_APPLNAME</literal></entry>
<entry colname="col3">X</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
<row>
<entry>wrkstnname</entry>
<entry><literal>SQL_ATTR_INFO_WRKSTNNAME</literal></entry>
<entry colname="col3">X</entry>
<entry colname="col4">X</entry>
<entry colname="col5">-</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the current setting of the connection attribute provided on success
or &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Setting and retrieving parameters through a connection
resource</title>
<programlisting role="php">
<![CDATA[
<?php
/* Database Connection Parameters */
$database = 'SAMPLE';
$user = 'db2inst1';
$password = 'ibmdb2';
/* Obtain Connection Resource */
$conn = db2_connect($database, $user, $password);
echo "Client attributes passed through conection string:\n";
/* Create the associative options array with valid key-value pairs */
/* Assign the attributes through connection string */
/* Access the options specified */
$options1 = array('userid' => 'db2inst1');
$conn1 = db2_connect($database, $user, $password, $options1);
$val = db2_get_option($conn1, 'userid');
echo $val . "\n";
$options2 = array('acctstr' => 'account');
$conn2 = db2_connect($database, $user, $password, $options2);
$val = db2_get_option($conn2, 'acctstr');
echo $val . "\n";
$options3 = array('applname' => 'myapp');
$conn3 = db2_connect($database, $user, $password, $options3);
$val = db2_get_option($conn3, 'applname');
echo $val . "\n";
$options4 = array('wrkstnname' => 'workstation');
$conn4 = db2_connect($database, $user, $password, $options4);
$val = db2_get_option($conn4, 'wrkstnname');
echo $val . "\n";
echo "Client attributes passed post-conection:\n";
/* Create the associative options array with valid key-value pairs */
/* Assign the attributes after a connection is made */
/* Access the options specified */
$options5 = array('userid' => 'db2inst1');
$conn5 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn5, $options5, 1);
$val = db2_get_option($conn5, 'userid');
echo $val . "\n";
$options6 = array('acctstr' => 'account');
$conn6 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn6, $options6, 1);
$val = db2_get_option($conn6, 'acctstr');
echo $val . "\n";
$options7 = array('applname' => 'myapp');
$conn7 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn7, $options7, 1);
$val = db2_get_option($conn7, 'applname');
echo $val . "\n";
$options8 = array('wrkstnname' => 'workstation');
$conn8 = db2_connect($database, $user, $password);
$rc = db2_set_option($conn8, $options8, 1);
$val = db2_get_option($conn8, 'wrkstnname');
echo $val . "\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Client attributes passed through conection string:
db2inst1
account
myapp
workstation
Client attributes passed post-connection:
db2inst1
account
myapp
workstation]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>db2_connect</function></member>
<member><function>db2_cursor_type</function></member>
<member><function>db2_exec</function></member>
<member><function>db2_set_option</function></member>
<member><function>db2_pconnect</function></member>
<member><function>db2_prepare</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
-->
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/functions/db2-lob-read.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/ibm_db2/functions/db2-lob-read.xml
+++ phpdoc/en/reference/ibm_db2/functions/db2-lob-read.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<refentry id="function.db2-lob-read">
<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
-->
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/ibm_db2/functions/db2-escape-string.xml?view=markup&rev=1.1
Index: phpdoc/en/reference/ibm_db2/functions/db2-escape-string.xml
+++ phpdoc/en/reference/ibm_db2/functions/db2-escape-string.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<refentry id="function.db2-escape-string">
<refnamediv>
<refname>db2_escape_string</refname>
<refpurpose>
Used to escape certain characters.
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>db2_escape_string</methodname>
<methodparam><type>string</type><parameter>string_literal</parameter></methodparam>
</methodsynopsis>
<para>
Prepends backslashes to special characters in the string argument.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string_literal</parameter></term>
<listitem>
<para>
The string that contains special characters that need to be modified.
Characters that are prepended with a backslash are
<literal>\x00</literal>,
<literal>\n</literal>, <literal>\r</literal>, <literal>\</literal>,
<literal>'</literal>, <literal>"</literal> and <literal>\x1a</literal>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <parameter>string_literal</parameter> with the special characters
noted above prepended with backslashes.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>db2_escape_string</function> example</title>
<para>
Result of using the <function>db2_escape_string</function> function
</para>
<programlisting role="php">
<![CDATA[
<?php
$conn = db2_connect($database, $user, $password);
if ($conn) {
$str[0] = "All characters: \x00 , \n , \r , \ , ' , \" , \x1a .";
$str[1] = "Backslash (\). Single quote ('). Double quote (\")";
$str[2] = "The NULL character \0 must be quoted as well";
$str[3] = "Intersting characters: \x1a , \x00 .";
$str[4] = "Nothing to quote";
$str[5] = 200676;
$str[6] = "";
foreach( $str as $string ) {
echo "db2_escape_string: " . db2_escape_string($string). "\n";
}
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
db2_escape_string: All characters: \0 , \n , \r , \\ , \' , \" , \Z .
db2_escape_string: Backslash (\\). Single quote (\'). Double quote (\")
db2_escape_string: The NULL character \0 must be quoted as well
db2_escape_string: Intersting characters: \Z , \0 .
db2_escape_string: Nothing to quote
db2_escape_string: 200676
db2_escape_string:
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>db2_prepare</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
-->