Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5560

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>Create a new paradox database</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.px-close.html">px_close</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.px-date2string.html">px_date2string</a></div>
 <div class="up"><a href="ref.paradox.html">Paradox Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.px-create-fp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">px_create_fp</h1>
  <p class="verinfo">(PECL paradox &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">px_create_fp</span> &mdash; <span class="dc-title">Create a new paradox database</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.px-create-fp-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>px_create_fp</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$pxdoc</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$file</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$fielddesc</code></span>
   )</div>

  <p class="para rdfs-comment">
   Create a new paradox database file. The actual file has to be opened before
   with  <span class="function"><a href="function.fopen.html" class="function">fopen()</a></span>. Make sure the file is writable.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">Calling this functions issues a warning about an empty tablename which
    can be safely ignored. Just set the tablename afterwards with
     <span class="function"><a href="function.px-set-parameter.html" class="function">px_set_parameter()</a></span>.</p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">This function is highly experimental, due to insufficient
    documentation of the paradox file format. Database files created with this
    function can be opened by  <span class="function"><a href="function.px-open-fp.html" class="function">px_open_fp()</a></span> and has been
    successfully opened by the Paradox software, but your milage may vary.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.px-create-fp-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

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

      <p class="para">
       Resource identifier of the paradox database
       as returned by  <span class="function"><a href="function.px-new.html" class="function">px_new()</a></span>.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">File handle as returned by  <span class="function"><a href="function.fopen.html" class="function">fopen()</a></span>.
      </p>
     </dd>

    </dt>

    <dt>

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

      <p class="para">
       <strong class="option unknown">fielddesc</strong>
 is an array containing one element for each
       field specification. A field specification is an array itself with
       either two or three elements.The first element is always a string value
       used as the name of the field. It may not be larger than ten
       characters. The second element contains the field type which is one of
       the constants listed in the table <a href="paradox.constants.html#paradox.table-fieldtypes" class="link">Constants for field types</a>.
       In the case of a character field or bcd field, you will have to provide
       a third element specifying the length respectively the precesion of the
       field. If your field specification contains blob fields, you will have
       to make sure to either make the field large enough for all field values
       to fit or specify a blob file with
        <span class="function"><a href="function.px-set-blob-file.html" class="function">px_set_blob_file()</a></span> for storing the blobs. If this is
       not done the field data is truncated.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.px-create-fp-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.px-create-fp-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2038">
    <p><strong>Example #1 Creating a Paradox database with two fields</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if(!</span><span style="color: #0000BB">$pxdoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">px_new</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Error&nbsp;handling&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"w+"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fields&nbsp;</span><span style="color: #007700">=&nbsp;array(array(</span><span style="color: #DD0000">"col1"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"S"</span><span style="color: #007700">),&nbsp;array(</span><span style="color: #DD0000">"col2"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"I"</span><span style="color: #007700">));<br />if(!</span><span style="color: #0000BB">px_create_fp</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fields</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Error&nbsp;handling&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">px_set_parameter</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"tablename"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"testtable"</span><span style="color: #007700">);<br />for(</span><span style="color: #0000BB">$i</span><span style="color: #007700">=-</span><span style="color: #0000BB">50</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">50</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$rec&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #0000BB">$i</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">px_put_record</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$rec</span><span style="color: #007700">);<br />}&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">px_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">px_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.px-create-fp-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.px-new.html" class="function" rel="rdfs-seeAlso">px_new()</a> - Create a new paradox object</span></li>
    <li class="member"> <span class="function"><a href="function.px-put-record.html" class="function" rel="rdfs-seeAlso">px_put_record()</a> - Stores record into paradox database</span></li>
    <li class="member"> <span class="function"><a href="function.fopen.html" class="function" rel="rdfs-seeAlso">fopen()</a> - Opens file or URL</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.px-close.html">px_close</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.px-date2string.html">px_date2string</a></div>
 <div class="up"><a href="ref.paradox.html">Paradox Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>