Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2398

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Import BLOB/CLOB data from a file.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.cubrid-lob2-export.html">cubrid_lob2_export</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.cubrid-lob2-new.html">cubrid_lob2_new</a></div>
 <div class="up"><a href="ref.cubrid.html">CUBRID Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.cubrid-lob2-import" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_lob2_import</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.4.1)</p><p class="refpurpose"><span class="refname">cubrid_lob2_import</span> &mdash; <span class="dc-title">Import BLOB/CLOB data from a file.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-lob2-import-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>cubrid_lob2_import</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$lob_identifier</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$file_name</code></span>
   )</div>

  <p class="para rdfs-comment">
   The  <span class="function"><strong>cubrid_lob2_import()</strong></span> function is used to save the
   contents of BLOB/CLOB data from a file. To use this function, you must use
    <span class="function"><a href="function.cubrid-lob2-new.html" class="function">cubrid_lob2_new()</a></span> or fetch a lob object from CUBRID database
   first. If the file already exists, the operation will fail. 
   This function will not influence the cursor position of the lob object. 
   It operates the entire lob object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.cubrid-lob2-import-parameters">
 <h3 class="title">Parameters</h3>
 <p class="para">
  <dl>

   <dt>

    <span class="term"><em><code class="parameter">lob_identifier</code></em></span>
    <dd>

     <p class="para">Lob identifier as a result of  <span class="function"><a href="function.cubrid-lob2-new.html" class="function">cubrid_lob2_new()</a></span> or get from the result set.</p>
    </dd>

   </dt>

   <dt>

    <span class="term"><em><code class="parameter">filename</code></em></span>
    <dd>

     <p class="para">File name you want to import BLOB/CLOB data. It also supports the path of the file.</p>
    </dd>

   </dt>

  </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.cubrid-lob2-import-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <strong><code>TRUE</code></strong> if the process is successful and <strong><code>FALSE</code></strong> for failure.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.cubrid-lob2-import-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1036">
   <p><strong>Example #1  <span class="function"><a href="function.cubrid-lob2-export.html" class="function">cubrid_lob2_export()</a></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"dba"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,</span><span style="color: #DD0000">"DROP&nbsp;TABLE&nbsp;if&nbsp;exists&nbsp;test_lob"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,</span><span style="color: #DD0000">"CREATE&nbsp;TABLE&nbsp;test_lob&nbsp;(id&nbsp;INT,&nbsp;contents&nbsp;CLOB)"</span><span style="color: #007700">);<br />&nbsp;<br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"INSERT&nbsp;INTO&nbsp;test_lob&nbsp;VALUES&nbsp;(?,&nbsp;?)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$lob&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_lob2_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"clob"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_lob2_import</span><span style="color: #007700">(</span><span style="color: #0000BB">$lob</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"doc_1.txt"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_lob2_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$lob</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'CLOB'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;or&nbsp;cubrid_lob2_bind($req,&nbsp;2,&nbsp;$lob);<br /><br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_lob2_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$lob</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.cubrid-lob2-import-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
   <li class="member"> <span class="function"><a href="function.cubrid-lob2-new.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_new()</a> - Create a lob object.</span></li>
   <li class="member"> <span class="function"><a href="function.cubrid-lob2-close.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_close()</a> - Close LOB object.</span></li>
   <li class="member"> <span class="function"><a href="function.cubrid-lob2-export.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_export()</a> - Export the lob object to a file.</span></li>
   <li class="member"> <span class="function"><a href="function.cubrid-lob2-bind.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_bind()</a> - Bind a lob object or a string as a lob object to a prepared statement as parameters.</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.cubrid-lob2-export.html">cubrid_lob2_export</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.cubrid-lob2-new.html">cubrid_lob2_new</a></div>
 <div class="up"><a href="ref.cubrid.html">CUBRID Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>