<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.dbase.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.dbase-create.php',
    1 => 'dbase_create',
    2 => 'Cr&eacute;e une base de donn&eacute;es dBase',
  ),
  'up' => 
  array (
    0 => 'ref.dbase.php',
    1 => 'Fonctions dBase',
  ),
  'prev' => 
  array (
    0 => 'function.dbase-close.php',
    1 => 'dbase_close',
  ),
  'next' => 
  array (
    0 => 'function.dbase-delete-record.php',
    1 => 'dbase_delete_record',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/dbase/functions/dbase-create.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.dbase-create" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">dbase_create</h1>
  <p class="verinfo">(PHP 5 &lt; 5.3.0, dbase 5, dbase 7)</p><p class="refpurpose"><span class="refname">dbase_create</span> &mdash; <span class="dc-title">Crée une base de données dBase</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.dbase-create-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>dbase_create</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$fields</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$type</code><span class="initializer"> = DBASE_TYPE_DBASE</span></span>): <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>dbase_create()</strong></span> crée une base de 
   données dBase avec la définition fournie.
   Si le fichier existe déjà, il n&#039;est pas tronqué.
   <span class="function"><a href="function.dbase-pack.php" class="function">dbase_pack()</a></span> peut être appelé pour forcer une troncature.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">Cette fonction est affectée par
    la directive de configuration <a href="ini.core.php#ini.open-basedir" class="link">open_basedir</a>.</p></p></blockquote>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.dbase-create-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       Le chemin vers la base de données. Il peut être un chemin relatif ou absolu
       vers le fichier où dBase stockera les données.
      </p>
     </dd>
    
    
     <dt><code class="parameter">fields</code></dt>
     <dd>
      <p class="para">
       Un tableau de tableaux, chaque tableau décrit le format d&#039;un champ de la
       base de données. Chaque champ est constitué d&#039;un nom, d&#039;un caractère 
       indiquant le type du champ et optionnellement, une longueur, une précision
       et un drapeau nullable.
       Les champs supportés sont énumérés dans la
       <a href="book.dbase.php#intro.dbase" class="link">section d&#039;introduction</a>.
      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: 
       <p class="para">
        Les noms des champs sont limités en longueur et ne doivent
        pas excéder 10 caractères.
       </p>
      </p></blockquote>
     </dd>
    
    
     <dt><code class="parameter">type</code></dt>
     <dd>
      <p class="para">
       Le type de base de données à créer. Soit
       <strong><code><a href="dbase.constants.php#constant.dbase-type-dbase">DBASE_TYPE_DBASE</a></code></strong> ou
       <strong><code><a href="dbase.constants.php#constant.dbase-type-foxpro">DBASE_TYPE_FOXPRO</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.dbase-create-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une ressource de base de données si la base de données
   a été créée avec succès, ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.dbase-create-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>PECL dbase 7.0.0</td>
      <td>
       Le paramètre <code class="parameter">type</code> a été ajouté.
      </td>
     </tr>

     <tr>
      <td>PECL dbase 7.0.0</td>
      <td>
       Le type de retour de <code class="parameter">dbase_identifier</code> est
       désormais une <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> au lieu d&#039;un <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.dbase-create-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Création d&#039;un fichier de base de données dBase</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />                   <br /></span><span style="color: #FF8000">// Base de données "definition"<br /></span><span style="color: #0000BB">$def </span><span style="color: #007700">= array(<br />  array(</span><span style="color: #DD0000">"date"</span><span style="color: #007700">,     </span><span style="color: #DD0000">"D"</span><span style="color: #007700">),<br />  array(</span><span style="color: #DD0000">"name"</span><span style="color: #007700">,     </span><span style="color: #DD0000">"C"</span><span style="color: #007700">,  </span><span style="color: #0000BB">50</span><span style="color: #007700">),<br />  array(</span><span style="color: #DD0000">"age"</span><span style="color: #007700">,      </span><span style="color: #DD0000">"N"</span><span style="color: #007700">,   </span><span style="color: #0000BB">3</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">),<br />  array(</span><span style="color: #DD0000">"email"</span><span style="color: #007700">,    </span><span style="color: #DD0000">"C"</span><span style="color: #007700">, </span><span style="color: #0000BB">128</span><span style="color: #007700">),<br />  array(</span><span style="color: #DD0000">"ismember"</span><span style="color: #007700">, </span><span style="color: #DD0000">"L"</span><span style="color: #007700">)<br />);<br />                   <br /></span><span style="color: #FF8000">// Création<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">dbase_create</span><span style="color: #007700">(</span><span style="color: #DD0000">'/tmp/test.dbf'</span><span style="color: #007700">, </span><span style="color: #0000BB">$def</span><span style="color: #007700">)) {<br />  echo </span><span style="color: #DD0000">"Erreur, impossible de créer la base de données\n"</span><span style="color: #007700">;<br />}<br />                   <br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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

 <div class="refsect1 seealso" id="refsect1-function.dbase-create-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.dbase-open.php" class="function" rel="rdfs-seeAlso">dbase_open()</a> - Ouvre une base dBase</span></li>
    <li><span class="function"><a href="function.dbase-close.php" class="function" rel="rdfs-seeAlso">dbase_close()</a> - Ferme une base dBase</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>