mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
169 lines
6.8 KiB
HTML
169 lines
6.8 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>Execute a query on an InterBase database</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ibase-query" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ibase_query</h1>
|
|
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ibase_query</span> — <span class="dc-title">Execute a query on an InterBase database</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ibase-query-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ibase_query</strong></span>
|
|
([ <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
|
], <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$bind_args</code></span>
|
|
] ) : <span class="type">resource</span></div>
|
|
|
|
<p class="simpara">
|
|
Performs a query on an InterBase database.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ibase-query-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">link_identifier</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
An InterBase link identifier. If omitted, the last opened link is
|
|
assumed.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">query</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
An InterBase query.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">bind_args</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ibase-query-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
If the query raises an error, returns <strong><code>FALSE</code></strong>. If it is successful and
|
|
there is a (possibly empty) result set (such as with a SELECT query),
|
|
returns a result identifier. If the query was successful and there were
|
|
no results, returns <strong><code>TRUE</code></strong>.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
In PHP 5.0.0 and up, this function will return the number of rows
|
|
affected by the query for INSERT, UPDATE and DELETE statements. In order
|
|
to retain backward compatibility, it will return <strong><code>TRUE</code></strong> for these
|
|
statements if the query succeeded without affecting any rows.
|
|
</p>
|
|
</p></blockquote>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 errors" id="refsect1-function.ibase-query-errors">
|
|
<h3 class="title">错误/异常</h3>
|
|
<p class="para">
|
|
If you get some error like "arithmetic exception, numeric overflow, or
|
|
string truncation. Cannot transliterate character between character sets"
|
|
(this occurs when you try use some character with accents) when using this
|
|
and after <span class="function"><strong>ibase_query()</strong></span> you must set the character set
|
|
(i.e. ISO8859_1 or your current character set).
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.ibase-query-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<p class="para">
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>5.3.1</td>
|
|
<td>
|
|
On success the function now returns <strong><code>TRUE</code></strong> if there were no
|
|
affected rows, where it previously returned <em>0 </em>
|
|
(a zero followed by an empty space).
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ibase-query-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-1202">
|
|
<p><strong>Example #1 <span class="function"><strong>ibase_query()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /><br />$host </span><span style="color: #007700">= </span><span style="color: #DD0000">'localhost:/path/to/your.gdb'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$dbh </span><span style="color: #007700">= </span><span style="color: #0000BB">ibase_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$host</span><span style="color: #007700">, </span><span style="color: #0000BB">$username</span><span style="color: #007700">, </span><span style="color: #0000BB">$password</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt </span><span style="color: #007700">= </span><span style="color: #DD0000">'SELECT * FROM tblname'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$sth </span><span style="color: #007700">= </span><span style="color: #0000BB">ibase_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">, </span><span style="color: #0000BB">$stmt</span><span style="color: #007700">) or die(</span><span style="color: #0000BB">ibase_errmsg</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.ibase-query-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="ibase_errmsg.html" class="function" rel="rdfs-seeAlso">ibase_errmsg()</a> - Return error messages</span></li>
|
|
<li class="member"><span class="function"><a href="ibase_fetch_row.html" class="function" rel="rdfs-seeAlso">ibase_fetch_row()</a> - Fetch a row from an InterBase database</span></li>
|
|
<li class="member"><span class="function"><a href="ibase_fetch_object.html" class="function" rel="rdfs-seeAlso">ibase_fetch_object()</a> - Get an object from a InterBase database</span></li>
|
|
<li class="member"><span class="function"><a href="ibase_free_result.html" class="function" rel="rdfs-seeAlso">ibase_free_result()</a> - Free a result set</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |