uTools-Manuals/docs/php/ingres_set_environment.html
2019-04-28 19:00:34 +08:00

230 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Set environment features controlling output options</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.ingres-set-environment" class="refentry">
<div class="refnamediv">
<h1 class="refname">ingres_set_environment</h1>
<p class="verinfo">(PECL ingres &gt;= 1.2.0)</p><p class="refpurpose"><span class="refname">ingres_set_environment</span> &mdash; <span class="dc-title">Set environment features controlling output options</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.ingres-set-environment-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>ingres_set_environment</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span>
, <span class="methodparam"><span class="type">array</span> <code class="parameter">$options</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>ingres_set_environment()</strong></span> 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.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.ingres-set-environment-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">link</code></dt>
<dd>
<p class="para">
The connection link identifier
</p>
</dd>
<dt id="function.ingres-set-environment.options"><code class="parameter">options</code></dt>
<dd>
<p class="para">
An enumerated <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of option name/value pairs. The following table
lists the option name and the expected type
</p>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr style="vertical-align: top;">
<th>Option name</th>
<th>Option type</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody class="tbody">
<tr style="vertical-align: top;">
<td>date_century_boundary</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td>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</td>
<td>50</td>
</tr>
<tr style="vertical-align: top;">
<td>timezone</td>
<td><span class="type"><a href="language.types.string.html" class="type string">string</a></span></td>
<td>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.</td>
<td>UNITED-KINGDOM</td>
</tr>
<tr style="vertical-align: top;">
<td>date_format</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td><p class="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:
<ul class="itemizedlist">
<li class="listitem"><span class="simpara">INGRES_DATE_DMY</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_FINISH</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_GERMAN</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_ISO</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_ISO4</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_MDY</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_MULTINATIONAL</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_MULTINATIONAL4</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_YMD</span></li>
<li class="listitem"><span class="simpara">INGRES_DATE_US</span></li>
</ul>
</p>
</td>
<td>INGRES_DATE_ISO4</td>
</tr>
<tr style="vertical-align: top;">
<td>decimal_separator</td>
<td><span class="type"><a href="language.types.string.html" class="type string">string</a></span></td>
<td>The character identifier for decimal data</td>
<td>&quot;,&quot;</td>
</tr>
<tr style="vertical-align: top;">
<td>money_lort</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td><p class="para">Leading or trailing currency sign. Valid values for money_lort
are:
<ul class="itemizedlist">
<li class="listitem"><span class="simpara">INGRES_MONEY_LEADING</span></li>
<li class="listitem"><span class="simpara">INGRES_MONEY_TRAILING</span></li>
</ul>
</p>
</td>
<td>INGRES_MONEY_LEADING</td>
</tr>
<tr style="vertical-align: top;">
<td>money_sign</td>
<td><span class="type"><a href="language.types.string.html" class="type string">string</a></span></td>
<td>The currency symbol to be used with the MONEY datatype</td>
<td></td>
</tr>
<tr style="vertical-align: top;">
<td>money_precision</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td>The precision of the MONEY datatype</td>
<td>2</td>
</tr>
<tr style="vertical-align: top;">
<td>float4_precision</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td>Precision of the FLOAT4 datatype</td>
<td>10</td>
</tr>
<tr style="vertical-align: top;">
<td>float8_precision</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td>Precision of the FLOAT8 data</td>
<td>10</td>
</tr>
<tr style="vertical-align: top;">
<td>blob_segment_length</td>
<td><span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span></td>
<td>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</td>
<td>8192</td>
</tr>
</tbody>
</table>
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.ingres-set-environment-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.ingres-set-environment-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-1314">
<p><strong>Example #1 Set date_format to ISO4</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$options&nbsp;</span><span style="color: #007700">=&nbsp;array(&nbsp;</span><span style="color: #DD0000">"date_format"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">INGRES_DATE_ISO4&nbsp;</span><span style="color: #007700">);<br /><br />if&nbsp;(</span><span style="color: #0000BB">ingres_set_environment</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">))<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">=</span><span style="color: #0000BB">ingres_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,</span><span style="color: #DD0000">"select&nbsp;date('now')&nbsp;as&nbsp;date"</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(&nbsp;</span><span style="color: #0000BB">$object&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ingres_fetch_object&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">date</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
<div class="example" id="example-1315">
<p><strong>Example #2 Set timezone to HONG-KONG</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$options&nbsp;</span><span style="color: #007700">=&nbsp;array(&nbsp;</span><span style="color: #DD0000">"timezone"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"HONG-KONG"</span><span style="color: #007700">);<br /><br />if&nbsp;(</span><span style="color: #0000BB">ingres_set_environment</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$options</span><span style="color: #007700">))<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">=</span><span style="color: #0000BB">ingres_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,</span><span style="color: #DD0000">"select&nbsp;date('now')&nbsp;as&nbsp;date"</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(&nbsp;</span><span style="color: #0000BB">$object&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ingres_fetch_object&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">)&nbsp;)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">date</span><span style="color: #007700">.</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.ingres-set-environment-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="ingres_connect.html" class="function" rel="rdfs-seeAlso">ingres_connect()</a> - Open a connection to an Ingres database</span></li>
<li class="member"><span class="function"><a href="ingres_query.html" class="function" rel="rdfs-seeAlso">ingres_query()</a> - Send an SQL query to Ingres</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>