mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-29 13:04:32 +08:00
91 lines
5.0 KiB
HTML
91 lines
5.0 KiB
HTML
<!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>Get the contents of sqlca.sqlerrd[0..5] after a query</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ifx-getsqlca" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ifx_getsqlca</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5 < 5.2.1)</p><p class="refpurpose"><span class="refname">ifx_getsqlca</span> — <span class="dc-title">Get the contents of sqlca.sqlerrd[0..5] after a query</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ifx-getsqlca-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ifx_getsqlca</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_id</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Returns a pseudo-row with sqlca.sqlerrd[0] ... sqlca.sqlerrd[5] after the
|
|
query associated with <code class="parameter">result_id</code>.
|
|
</p>
|
|
<p class="para">
|
|
For inserts, updates and deletes the values returned are those as set by
|
|
the server after executing the query. This gives access to the number of
|
|
affected rows and the serial insert value. For <em>SELECT</em>s
|
|
the values are those saved after the <em>PREPARE</em> statement.
|
|
This gives access to the *estimated* number of affected rows. The use of
|
|
this function saves the overhead of executing a <em>SELECT
|
|
dbinfo('sqlca.sqlerrdx')</em> query, as it retrieves the values that
|
|
were saved by the ifx driver at the appropriate moment.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ifx-getsqlca-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">result_id</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
<code class="parameter">result_id</code> is a valid result id returned by
|
|
<span class="function"><a href="ifx_query.html" class="function">ifx_query()</a></span> or
|
|
<span class="function"><a href="ifx_prepare.html" class="function">ifx_prepare()</a></span> (select type queries only!).
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ifx-getsqlca-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns an associative array with the following entries:
|
|
<em>sqlerrd0</em>, <em>sqlerrd1</em>,
|
|
<em>sqlerrd2</em>, <em>sqlerrd3</em>,
|
|
<em>sqlerrd4</em> and <em>sqlerrd5</em>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ifx-getsqlca-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-1290">
|
|
<p><strong>Example #1 Retrieve Informix sqlca.sqlerrd[x] values</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">/* assume the first column of 'sometable' is a serial */<br /></span><span style="color: #0000BB">$qid </span><span style="color: #007700">= </span><span style="color: #0000BB">ifx_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"insert into sometable<br /> values (0, '2nd column', 'another column') "</span><span style="color: #007700">, </span><span style="color: #0000BB">$connid</span><span style="color: #007700">);<br />if (!</span><span style="color: #0000BB">$qid</span><span style="color: #007700">) {<br /> </span><span style="color: #FF8000">/* ... error ... */<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$sqlca </span><span style="color: #007700">= </span><span style="color: #0000BB">ifx_getsqlca</span><span style="color: #007700">(</span><span style="color: #0000BB">$qid</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$serial_value </span><span style="color: #007700">= </span><span style="color: #0000BB">$sqlca</span><span style="color: #007700">[</span><span style="color: #DD0000">"sqlerrd1"</span><span style="color: #007700">];<br />echo </span><span style="color: #DD0000">"The serial value of the inserted row is : </span><span style="color: #0000BB">$serial_value</span><span style="color: #DD0000"><br />\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |