function.fbsql-read-clob.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 123 行
HTML
123 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Read a CLOB from the database</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.fbsql-read-blob.html">fbsql_read_blob</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fbsql-result.html">fbsql_result</a></div> <div class="up"><a href="ref.fbsql.html">FrontBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.fbsql-read-clob" class="refentry"> <div class="refnamediv"> <h1 class="refname">fbsql_read_clob</h1> <p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">fbsql_read_clob</span> — <span class="dc-title">Read a CLOB from the database</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><b><b>fbsql_read_clob</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$clob_handle</tt></span> [, <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$link_identifier</tt></span> ] )</div> <p class="para rdfs-comment"> Reads CLOB data from the database. </p> <p class="para"> If a select statement contains BLOB and/or CLOB columns FrontBase will return the data directly when data is fetched. This default behavior can be changed with <a href="function.fbsql-set-lob-mode.html" class="function">fbsql_set_lob_mode()</a> so the fetch functions will return handles to BLOB and CLOB data. If a handle is fetched a user must call <b>fbsql_read_clob()</b> to get the actual CLOB data from the database. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">clob_handle</tt></i></span> <dd> <p class="para"> A CLOB handle, returned by <a href="function.fbsql-create-clob.html" class="function">fbsql_create_clob()</a>. </p> </dd> </dt> <dt><span class="term"><i><tt class="parameter">link_identifier</tt></i></span><dd><p class="para">A FrontBase link identifierreturned by <a href="function.fbsql-connect.html" class="function">fbsql_connect()</a> or <a href="function.fbsql-pconnect.html" class="function">fbsql_pconnect()</a>.</p><p class="para">If optional and not specified,the function will try to find an open link to the FrontBase server and if nosuch link is found it will try to create one as if <a href="function.fbsql-connect.html" class="function">fbsql_connect()</a> was called with no arguments</p></dd></dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a string containing the specified CLOB data. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>fbsql_read_clob()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$link </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_pconnect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #DD0000">"_SYSTEM"</span><span style="color: #007700">, </span><span style="color: #DD0000">"secret"</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Could not connect"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$sql </span><span style="color: #007700">= </span><span style="color: #DD0000">"SELECT CLOB_COLUMN FROM CLOB_TABLE;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$rs </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$sql</span><span style="color: #007700">, </span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$row_data </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$rs</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// $row_data[0] will now contain the clob data for the first row<br /></span><span style="color: #0000BB">fbsql_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$rs</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$rs </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$sql</span><span style="color: #007700">, </span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fbsql_set_lob_mode</span><span style="color: #007700">(</span><span style="color: #0000BB">$rs</span><span style="color: #007700">, </span><span style="color: #0000BB">FBSQL_LOB_HANDLE</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$row_data </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$rs</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// $row_data[0] will now contain a handle to the CLOB data in the first row<br /></span><span style="color: #0000BB">$clob_data </span><span style="color: #007700">= </span><span style="color: #0000BB">fbsql_read_clob</span><span style="color: #007700">(</span><span style="color: #0000BB">$row_data</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">fbsql_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$rs</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.fbsql-create-clob.html" class="function" rel="rdfs-seeAlso">fbsql_create_clob()</a></li> <li class="member"><a href="function.fbsql-read-blob.html" class="function" rel="rdfs-seeAlso">fbsql_read_blob()</a></li> <li class="member"><a href="function.fbsql-set-lob-mode.html" class="function" rel="rdfs-seeAlso">fbsql_set_lob_mode()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.fbsql-read-blob.html">fbsql_read_blob</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.fbsql-result.html">fbsql_result</a></div> <div class="up"><a href="ref.fbsql.html">FrontBase Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?