<!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><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ibase-set-event-handler.html">ibase_set_event_handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ibase-wait-event.html">ibase_wait_event</a></div> <div class="up"><a href="ref.ibase.html">Firebird/InterBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ibase-trans" class="refentry"> <div class="refnamediv"> <h1 class="refname">ibase_trans</h1> <p class="verinfo">(PHP 5)</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">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <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> ]] )</div> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <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> ]] )</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="function.ibase-commit.html" class="function">ibase_commit()</a></span> or <span class="function"><a href="function.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 <em><code class="parameter">trans_args</code></em> and <em><code class="parameter">link_identifier</code></em> 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 <em><code class="parameter">link_id</code></em> and <em><code class="parameter">transaction_id</code></em> in calls to <span class="function"><a href="function.ibase-query.html" class="function">ibase_query()</a></span> and <span class="function"><a href="function.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">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">trans_args</code></em></span> <dd> <p class="para"> <em><code class="parameter">trans_args</code></em> 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> <dt> <span class="term"><em><code class="parameter">link_identifier</code></em></span> <dd> <p class="para"> An InterBase link identifier. If omitted, the last opened link is assumed. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ibase-trans-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a transaction handle, or <strong><code>FALSE</code></strong> on error. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ibase-set-event-handler.html">ibase_set_event_handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ibase-wait-event.html">ibase_wait_event</a></div> <div class="up"><a href="ref.ibase.html">Firebird/InterBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>