⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.pg-transaction-status.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Returns the current in-transaction status of the server.</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.pg-trace.html">pg_trace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.pg-tty.html">pg_tty</a></div> <div class="up"><a href="ref.pgsql.html">PostgreSQL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.pg-transaction-status" class="refentry"> <div class="refnamediv">  <h1 class="refname">pg_transaction_status</h1>  <p class="verinfo">(PHP 5 &gt;= 5.1.0)</p><p class="refpurpose"><span class="refname">pg_transaction_status</span> &mdash; <span class="dc-title">Returns the current in-transaction status of the server.</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">int</span> <span class="methodname"><b><b>pg_transaction_status</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$connection</tt></span>   )</div>  <p class="para rdfs-comment">    Returns the current in-transaction status of the server.  </p>  <div class="caution"><b class="caution">Caution</b>    <p class="para">      <b>pg_transaction_status()</b> will give incorrect results when using      a PostgreSQL 7.3 server that has the parameter <i>autocommit</i>      set to off.  The server-side autocommit feature has been      deprecated and does not exist in later server versions.    </p>  </div> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">connection</tt></i></span>     <dd>      <p class="para">       PostgreSQL database connection resource.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">The status can be <b><tt>PGSQL_TRANSACTION_IDLE</tt></b> (currently idle),    <b><tt>PGSQL_TRANSACTION_ACTIVE</tt></b> (a command is in progress),    <b><tt>PGSQL_TRANSACTION_INTRANS</tt></b> (idle, in a valid transaction block),    or <b><tt>PGSQL_TRANSACTION_INERROR</tt></b> (idle, in a failed transaction block).    <b><tt>PGSQL_TRANSACTION_UNKNOWN</tt></b> is reported if the connection is bad.    <b><tt>PGSQL_TRANSACTION_ACTIVE</tt></b> is reported only when a query    has been sent to the server and not yet completed.  </p> </div>  <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>pg_transaction_status()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />&nbsp;&nbsp;$dbconn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=publisher"</span><span style="color: #007700">)&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Could&nbsp;not&nbsp;connect"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$stat&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_transaction_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">);<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$stat&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">PGSQL_TRANSACTION_UNKNOWN</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;is&nbsp;bad'</span><span style="color: #007700">;<br />&nbsp;&nbsp;}&nbsp;else&nbsp;if&nbsp;(</span><span style="color: #0000BB">$stat&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">PGSQL_TRANSACTION_IDLE</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;is&nbsp;currently&nbsp;idle'</span><span style="color: #007700">;<br />&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Connection&nbsp;is&nbsp;in&nbsp;a&nbsp;transaction&nbsp;state'</span><span style="color: #007700">;<br />&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.pg-trace.html">pg_trace</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.pg-tty.html">pg_tty</a></div> <div class="up"><a href="ref.pgsql.html">PostgreSQL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -