mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
112 lines
4.6 KiB
HTML
112 lines
4.6 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>Begin a transaction</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ibase-trans" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ibase_trans</h1>
|
|
<p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ibase_trans</span> — <span class="dc-title">Begin a transaction</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ibase-trans-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ibase_trans</strong></span>
|
|
([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$trans_args</code></span>
|
|
[, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
|
]] ) : <span class="type">resource</span></div>
|
|
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ibase_trans</strong></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">$trans_args</code></span>
|
|
]] ) : <span class="type">resource</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Begins a transaction.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
The first call to <span class="function"><strong>ibase_trans()</strong></span> will not return the default transaction
|
|
of a connection. All transactions started by <span class="function"><strong>ibase_trans()</strong></span>
|
|
will be rolled back at the end of the script if they were not committed or
|
|
rolled back by either <span class="function"><a href="ibase_commit.html" class="function">ibase_commit()</a></span> or
|
|
<span class="function"><a href="ibase_rollback.html" class="function">ibase_rollback()</a></span>.
|
|
</p>
|
|
</p></blockquote>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
This function will accept multiple <code class="parameter">trans_args</code>
|
|
and <code class="parameter">link_identifier</code> arguments. This allows transactions
|
|
over multiple database connections, which are committed using a 2-phase commit
|
|
algorithm. This means you can rely on the updates to either succeed in every
|
|
database, or fail in every database. It does NOT mean you can use tables from
|
|
different databases in the same query!
|
|
</p>
|
|
<p class="para">
|
|
If you use transactions over multiple databases, you will have to specify both
|
|
the <code class="parameter">link_id</code> and <code class="parameter">transaction_id</code>
|
|
in calls to <span class="function"><a href="ibase_query.html" class="function">ibase_query()</a></span> and <span class="function"><a href="ibase_prepare.html" class="function">ibase_prepare()</a></span>.
|
|
</p>
|
|
</p></blockquote>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ibase-trans-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">trans_args</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
<code class="parameter">trans_args</code> can be a combination of
|
|
<strong><code>IBASE_READ</code></strong>,
|
|
<strong><code>IBASE_WRITE</code></strong>,
|
|
<strong><code>IBASE_COMMITTED</code></strong>,
|
|
<strong><code>IBASE_CONSISTENCY</code></strong>,
|
|
<strong><code>IBASE_CONCURRENCY</code></strong>,
|
|
<strong><code>IBASE_REC_VERSION</code></strong>,
|
|
<strong><code>IBASE_REC_NO_VERSION</code></strong>,
|
|
<strong><code>IBASE_WAIT</code></strong> and
|
|
<strong><code>IBASE_NOWAIT</code></strong>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ibase-trans-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns a transaction handle, or <strong><code>FALSE</code></strong> on error.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |