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

138 lines
4.7 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>Prepare an SQL-statement for execution</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.ifx-prepare" class="refentry">
<div class="refnamediv">
<h1 class="refname">ifx_prepare</h1>
<p class="verinfo">(PHP 4, PHP 5 &lt; 5.2.1)</p><p class="refpurpose"><span class="refname">ifx_prepare</span> &mdash; <span class="dc-title">Prepare an SQL-statement for execution</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.ifx-prepare-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>ifx_prepare</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$cursor_def</code></span>
], <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$blobidarray</code></span>
) : <span class="type">resource</span></div>
<p class="para rdfs-comment">
Prepares a <code class="parameter">query</code> for later use with
<span class="function"><a href="ifx_do.html" class="function">ifx_do()</a></span>.
</p>
<p class="para">
For &quot;select-type&quot; queries a cursor is declared and opened.
Non-select queries are &quot;execute immediate&quot;.
</p>
<p class="para">
For either query type the number of (estimated or real) affected rows is
saved for retrieval by <span class="function"><a href="ifx_affected_rows.html" class="function">ifx_affected_rows()</a></span>.
</p>
<p class="para">
If the contents of the TEXT (or BYTE) column allow it, you can also use
<em>ifx_textasvarchar(1)</em> and
<em>ifx_byteasvarchar(1)</em>. This allows you to treat TEXT
(or BYTE) columns just as if they were ordinary (but long) VARCHAR columns
for select queries, and you don&#039;t need to bother with blob id&#039;s.
</p>
<p class="para">
With <em>ifx_textasvarchar(0)</em> or
<em>ifx_byteasvarchar(0)</em> (the default situation), select
queries will return BLOB columns as blob id&#039;s (integer value). You can
get the value of the blob as a string or file with the blob functions (see
below).
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.ifx-prepare-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">query</code></dt>
<dd>
<p class="para">
The query string.
</p>
</dd>
<dt>
<code class="parameter">link_identifier</code></dt>
<dd>
<p class="para">
The link identifier.
</p>
</dd>
<dt>
<code class="parameter">cursor_def</code></dt>
<dd>
<p class="para">
This optional parameter allows you to make this a
<em>scroll</em> and/or <em>hold</em> cursor.
It&#039;s a bitmask and can be either <strong><code>IFX_SCROLL</code></strong>,
<strong><code>IFX_HOLD</code></strong>, or both or&#039;ed together.
</p>
</dd>
<dt>
<code class="parameter">blobidarray</code></dt>
<dd>
<p class="para">
If you have BLOB (BYTE or TEXT) columns in the query, you can add
a <code class="parameter">blobidarray</code> parameter containing the
corresponding &quot;blob ids&quot;, and you should replace those columns
with a &quot;?&quot; in the query text.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.ifx-prepare-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns a valid result identifier for use by <span class="function"><a href="ifx_do.html" class="function">ifx_do()</a></span>,
or <strong><code>FALSE</code></strong> on errors.
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.ifx-prepare-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="ifx_do.html" class="function" rel="rdfs-seeAlso">ifx_do()</a> - Execute a previously prepared SQL-statement</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>