i5 options and examples. Patch by Owain Jones

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@223045 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2006-11-09 14:43:20 +00:00
parent 5bc0398abd
commit 8d0ec869ac
4 changed files with 1105 additions and 680 deletions

View file

@ -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. -->
<refentry id="function.db2-connect">
<refnamediv>
@ -167,6 +167,233 @@
</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.
<variablelist>
<varlistentry>
<term><parameter>i5_lib</parameter></term>
<listitem>
<para>
A character value that indicates the default library that will be
used for resolving unqualified file references. This is not valid
if the connection is using system naming mode.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_naming</parameter></term>
<listitem>
<para>
<literal>DB2_I5_NAMING_ON</literal> value turns on DB2 UDB CLI iSeries
system naming mode. Files are qualified using the slash (/) delimiter.
Unqualified files are resolved using the library list for the job.
</para>
<para>
<literal>DB2_I5_NAMING_OFF</literal> value turns off DB2 UDB CLI default
naming mode, which is SQL naming. Files are qualified using the period (.)
delimiter. Unqualified files are resolved using either the default library
or the current user ID.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_commit</parameter></term>
<listitem>
<para>
The <parameter>i5_commit</parameter> attribute should be set before the
<function>db2_connect</function>. If the value is changed after the
connection has been established, and the connection is to a remote data
source, the change does not take effect until the next successful
<function>db2_connect</function> for the connection handle.
</para>
<para>
Note: php.ini setting <parameter>ibm_db2.i5_allow_commit</parameter>==0
or <literal>DB2_I5_TXN_NO_COMMIT</literal> is the default, but may be
overridden with the <parameter>i5_commit</parameter> option.
</para>
<para>
<literal>DB2_I5_TXN_NO_COMMIT</literal> - Commitment control is not used.
</para>
<para>
<literal>DB2_I5_TXN_READ_UNCOMMITTED</literal> - Dirty reads, nonrepeatable
reads, and phantoms are possible.
</para>
<para>
<literal>DB2_I5_TXN_READ_COMMITTED</literal> - Dirty reads are not possible.
Nonrepeatable reads, and phantoms are possible.
</para>
<para>
<literal>DB2_I5_TXN_REPEATABLE_READ</literal> - Dirty reads and nonrepeatable
reads are not possible. Phantoms are possible.
</para>
<para>
<literal>DB2_I5_TXN_SERIALIZABLE</literal> - Transactions are serializable.
Dirty reads, non-repeatable reads, and phantoms are not possible
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_query_optimize</parameter></term>
<listitem>
<para>
<literal>DB2_FIRST_IO</literal> All queries are optimized with the goal of
returning the first page of output as fast as possible. This goal works well
when the output is controlled by a user who is most likely to cancel the query
after viewing the first page of output data. Queries coded with an
OPTIMIZE FOR nnn ROWS clause honor the goal specified by the clause.
</para>
<para>
<literal>DB2_ALL_IO All</literal> queries are optimized with the goal of running
the entire query to completion in the shortest amount of elapsed time. This is a
good option when the output of a query is being written to a file or report, or
the interface is queuing the output data. Queries coded with an OPTIMIZE FOR nnn
ROWS clause honor the goal specified by the clause. This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_dbcs_alloc</parameter></term>
<listitem>
<para>
<literal>DB2_I5_DBCS_ALLOC_ON</literal> value turns on DB2 6X allocation scheme
for DBCS translation column size growth.
</para>
<para>
<literal>DB2_I5_DBCS_ALLOC_OFF</literal> value turns off DB2 6X allocation scheme
for DBCS translation column size growth.
</para>
<para>
Note: php.ini setting <parameter>ibm_db2.i5_dbcs_alloc</parameter>==0 or
<literal>DB2_I5_DBCS_ALLOC_OFF</literal> is the default, but may be overridden
with the <parameter>i5_dbcs_alloc</parameter> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_date_fmt</parameter></term>
<listitem>
<para>
<literal>SQL_FMT_ISO</literal> - The International Organization for Standardization
(ISO) date format yyyy-mm-dd is used. This is the default.
</para>
<para>
<literal>DB2_I5_FMT_USA</literal> - The United States date format mm/dd/yyyy is used.
</para>
<para>
<literal>DB2_I5_FMT_EUR</literal> - The European date format dd.mm.yyyy is used.
</para>
<para>
<literal>DB2_I5_FMT_JIS</literal> - The Japanese Industrial Standard date format
yyyy-mm-dd is used.
</para>
<para>
<literal>DB2_I5_FMT_MDY</literal> - The date format mm/dd/yyyy is used.
</para>
<para>
<literal>DB2_I5_FMT_DMY</literal> - The date format dd/mm/yyyy is used.
</para>
<para>
<literal>DB2_I5_FMT_YMD</literal> - The date format yy/mm/dd is used.
</para>
<para>
<literal>DB2_I5_FMT_JUL</literal> - The Julian date format yy/ddd is used.
</para>
<para>
<literal>DB2_I5_FMT_JOB</literal> - The job default is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_date_sep</parameter></term>
<listitem>
<para>
<literal>DB2_I5_SEP_SLASH</literal> - A slash ( / ) is used as the date separator.
This is the default.
</para>
<para>
<literal>DB2_I5_SEP_DASH</literal> - A dash ( - ) is used as the date separator.
</para>
<para>
<literal>DB2_I5_SEP_PERIOD</literal> - A period ( . ) is used as the date
separator.
</para>
<para>
<literal>DB2_I5_SEP_COMMA</literal> - A comma ( , ) is used as the date separator.
</para>
<para>
<literal>DB2_I5_SEP_BLANK</literal> - A blank is used as the date separator.
</para>
<para>
<literal>DB2_I5_SEP_JOB</literal> - The job default is used
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_time_fmt</parameter></term>
<listitem>
<para>
<literal>DB2_I5_FMT_ISO</literal> - The International Organization for
Standardization (ISO) time format hh.mm.ss is used. This is the default.
</para>
<para>
<literal>DB2_I5_FMT_USA</literal> - The United States time format
hh:mmxx is used, where xx is AM or PM.
</para>
<para>
<literal>DB2_I5_FMT_EUR</literal> - The European time format hh.mm.ss
is used.
</para>
<para>
<literal>DB2_I5_FMT_JIS</literal> - The Japanese Industrial Standard
time format hh:mm:ss is used.
</para>
<para>
<literal>DB2_I5_FMT_HMS</literal> - The hh:mm:ss format is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_time_sep</parameter></term>
<listitem>
<para>
<literal>DB2_I5_SEP_COLON</literal> - A colon ( : ) is used as the time
separator. This is the default.
</para>
<para>
<literal>DB2_I5_SEP_PERIOD</literal> - A period ( . ) is used as the time
separator.
</para>
<para>
<literal>DB2_I5_SEP_COMMA</literal> - A comma ( , ) is used as the time
separator.
</para>
<para>
<literal>DB2_I5_SEP_BLANK</literal> - A blank is used as the time separator.
</para>
<para>
<literal>DB2_I5_SEP_JOB</literal> - The job default is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>i5_decimal_sep</parameter></term>
<listitem>
<para>
<literal>DB2_I5_SEP_PERIOD</literal> - A period ( . ) is used as
the decimal separator. This is the default.
</para>
<para>
<literal>DB2_I5_SEP_COMMA</literal> - A comma ( , ) is used as the
date separator.
</para>
<para>
<literal>DB2_I5_SEP_JOB</literal> - The job default is used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
@ -293,7 +520,36 @@ Autocommit is off.
]]>
</screen>
</example>
<example>
<title>i5/OS best performance</title>
<para>
To achieve best performance for your i5/OS ibm_db2 1.5.1 PHP application
use the default host, userid, and password for your
<function>db2_connect</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$library = "ADC";
$i5 = db2_connect("", "", "", array("i5_lib"=>"qsys2"));
$result = db2_exec($i5,
"select * from systables where table_schema = '$library'");
while ($row = db2_fetch_both($result)) {
echo $row['TABLE_NAME']."</br>";
}
db2_close($i5);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
ANIMALS
NAMES
PICTURES
]]>
</screen>
</example>
</para>
</refsect1>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
<refentry id="function.db2-fetch-row">
<refnamediv>
@ -98,6 +98,52 @@ cat Pook
gold fish Bubbles
budgerigar Gizmo
goat Rickety Ride
]]>
</screen>
</example>
<example>
<title>i5/OS recommended alternatives to db2_fetch_row/db2_result</title>
<para>
On i5/OS it is recommended that you use <function>db2_fetch_both</function>,
<function>db2_fetch_array</function>, or <function>db2_fetch_object</function>
over <function>db2_fetch_row</function>/<function>db2_result</function>. In general
<function>db2_fetch_row</function>/<function>db2_result</function> have more issues
with various column types in <literal>EBCIDIC</literal> to <literal>ASCII</literal>
translation, including possible truncation in <literal>DBCS</literal> applications.
You may also find the performance of <function>db2_fetch_both</function>,
<function>db2_fetch_array</function>, and <function>db2_fetch_object</function> to
be superior to <function>db2_fetch_row</function>/<function>db2_result</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$conn = db2_connect("","","");
$sql = 'SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE, ROUTINE_CREATED, ROUTINE_BODY, IN_PARMS, OUT_PARMS, INOUT_PARMS, PARAMETER_STYLE, EXTERNAL_NAME, EXTERNAL_LANGUAGE FROM QSYS2.SYSROUTINES FETCH FIRST 2 ROWS ONLY';
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_both($stmt)){
echo "<br>db2_fetch_both {$row['SPECIFIC_NAME']} {$row['ROUTINE_CREATED']} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_array($stmt)){
echo "<br>db2_fetch_array {$row[1]} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_object($stmt)){
echo "<br>db2_fetch_object {$row->SPECIFIC_NAME} {$row->ROUTINE_CREATED}";
}
db2_close($conn);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
db2_fetch_both MATCH_ANIMAL 2006-08-25-17.10.23.775000 2006-08-25-17.10.23.775000
db2_fetch_both MULTIRESULTS 2006-10-17-10.11.05.308000 2006-10-17-10.11.05.308000
db2_fetch_array MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_array MULTIRESULTS 2006-10-17-10.11.05.308000
db2_fetch_object MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_object MULTIRESULTS 2006-10-17-10.11.05.308000
]]>
</screen>
</example>

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<section id="extname.configuration">
&reftitle.runtime;
&extension.runtime;
@ -22,6 +22,18 @@
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry>ibm_db2.i5_allow_commit</entry>
<entry>"0"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry></entry>
</row>
<row>
<entry>ibm_db2.i5_dbcs_alloc</entry>
<entry>"0"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry></entry>
</row>
<row>
<entry>ibm_db2.instance_name</entry>
<entry>NULL</entry>
@ -67,6 +79,54 @@
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.ibm-db2.i5-allow-commit">
<term>
<parameter>ibm_db2.i5_allow_commit</parameter>
<type>integer</type>
</term>
<listitem>
<para>
This option controls the commit mode used for i5 schema collections
in the PHP application.
<itemizedlist>
<listitem>
<para>
0 no commit (see i5_commit for override)
</para>
</listitem>
<listitem>
<para>
1 allow commit (see i5_commit for override)
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.ibm-db2.i5-dbcs-alloc">
<term>
<parameter>ibm_db2.i5_dbcs_alloc</parameter>
<type>integer</type>
</term>
<listitem>
<para>
This option controls the internal ibm_db2 allocation scheme
for large DBCS column buffers.
<itemizedlist>
<listitem>
<para>
0 no expanded allocations (see i5_dbcs_alloc for override)
</para>
</listitem>
<listitem>
<para>
1 use expanded allocations (see i5_dbcs_alloc for override)
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry id="ini.ibm-db2.instance-name">
<term>
<parameter>ibm_db2.instance_name</parameter>