php-doc-en/reference/ingres-ii/functions/ingres-set-environment.xml
2011-09-30 14:21:51 +00:00

236 lines
7.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.ingres-set-environment" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ingres_set_environment</refname>
<refpurpose>Set environment features controlling output options</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>ingres_set_environment</methodname>
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
<methodparam><type>array</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>ingres_set_environment</function> is called to set environmental
options that affect the output of certain values from Ingres, such as the
timezone, date format, decimal character separator, and float precision.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>link</parameter></term>
<listitem>
<para>
The connection link identifier
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="function.ingres-set-environment.options">
<term><parameter>options</parameter></term>
<listitem>
<para>
An enumerated <type>array</type> of option name/value pairs. The following table
lists the option name and the expected type
</para>
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row valign="top">
<entry>Option name</entry>
<entry>Option type</entry>
<entry>Description</entry>
<entry>Example</entry>
</row>
</thead>
<tbody>
<row valign="top">
<entry>date_century_boundary</entry>
<entry><type>integer</type></entry>
<entry>The threshold by which a 2-digit year is determined to be in
the current century or in the next century. Equivalent to II_DATE_CENTURY_BOUNDARY</entry>
<entry>50</entry>
</row>
<row valign="top">
<entry>timezone</entry>
<entry><type>string</type></entry>
<entry>Controls the timezone of the session. If not set, it will
default the value defined by II_TIMEZONE_NAME. If
II_TIMEZONE_NAME is not defined, NA-PACIFIC (GMT-8 with Daylight
Savings) is used.</entry>
<entry>UNITED-KINGDOM</entry>
</row>
<row valign="top">
<entry>date_format</entry>
<entry><type>integer</type></entry>
<entry><para>Sets the allowable input and output format for Ingres dates.
Defaults to the value defined by II_DATE_FORMAT. If II_DATE_FORMAT is
not set, the default date format is US, for example mm/dd/yy. Valid values
for date_format are:
<itemizedlist>
<listitem><simpara>INGRES_DATE_DMY</simpara></listitem>
<listitem><simpara>INGRES_DATE_FINISH</simpara></listitem>
<listitem><simpara>INGRES_DATE_GERMAN</simpara></listitem>
<listitem><simpara>INGRES_DATE_ISO</simpara></listitem>
<listitem><simpara>INGRES_DATE_ISO4</simpara></listitem>
<listitem><simpara>INGRES_DATE_MDY</simpara></listitem>
<listitem><simpara>INGRES_DATE_MULTINATIONAL</simpara></listitem>
<listitem><simpara>INGRES_DATE_MULTINATIONAL4</simpara></listitem>
<listitem><simpara>INGRES_DATE_YMD</simpara></listitem>
<listitem><simpara>INGRES_DATE_US</simpara></listitem>
</itemizedlist>
</para>
</entry>
<entry>INGRES_DATE_ISO4</entry>
</row>
<row valign="top">
<entry>decimal_separator</entry>
<entry><type>string</type></entry>
<entry>The character identifier for decimal data</entry>
<entry>","</entry>
</row>
<row valign="top">
<entry>money_lort</entry>
<entry><type>integer</type></entry>
<entry><para>Leading or trailing currency sign. Valid values for money_lort
are:
<itemizedlist>
<listitem><simpara>INGRES_MONEY_LEADING</simpara></listitem>
<listitem><simpara>INGRES_MONEY_TRAILING</simpara></listitem>
</itemizedlist>
</para>
</entry>
<entry>INGRES_MONEY_LEADING</entry>
</row>
<row valign="top">
<entry>money_sign</entry>
<entry><type>string</type></entry>
<entry>The currency symbol to be used with the MONEY datatype</entry>
<entry></entry>
</row>
<row valign="top">
<entry>money_precision</entry>
<entry><type>integer</type></entry>
<entry>The precision of the MONEY datatype</entry>
<entry>2</entry>
</row>
<row valign="top">
<entry>float4_precision</entry>
<entry><type>integer</type></entry>
<entry>Precision of the FLOAT4 datatype</entry>
<entry>10</entry>
</row>
<row valign="top">
<entry>float8_precision</entry>
<entry><type>integer</type></entry>
<entry>Precision of the FLOAT8 data</entry>
<entry>10</entry>
</row>
<row valign="top">
<entry>blob_segment_length</entry>
<entry><type>integer</type></entry>
<entry>The amount of data in bytes to fetch at a time when retrieving
BLOB or CLOB data. Defaults to 4096 bytes when not set explicitly</entry>
<entry>8192</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Set date_format to ISO4</title>
<programlisting role="php">
<![CDATA[
<?php
$options = array( "date_format" => INGRES_DATE_ISO4 );
if (ingres_set_environment($link, $options))
{
$result=ingres_query($link,"select date('now') as date");
while ( $object = ingres_fetch_object ($result) ) {
echo $object->date."\n";
}
}
?>
]]>
</programlisting>
</example>
<example>
<title>Set timezone to HONG-KONG</title>
<programlisting role="php">
<![CDATA[
<?php
$options = array( "timezone" => "HONG-KONG");
if (ingres_set_environment($link, $options))
{
$result=ingres_query($link,"select date('now') as date");
while ( $object = ingres_fetch_object ($result) ) {
echo $object->date."\n";
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ingres_connect</function></member>
<member><function>ingres_query</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
-->