<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pgsql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'function.pg-meta-data.php',
    1 => 'pg_meta_data',
    2 => 'Obt&eacute;m metadados para tabela',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'Fun&ccedil;&otilde;es PostgreSQL',
  ),
  'prev' => 
  array (
    0 => 'function.pg-lo-write.php',
    1 => 'pg_lo_write',
  ),
  'next' => 
  array (
    0 => 'function.pg-num-fields.php',
    1 => 'pg_num_fields',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/pgsql/functions/pg-meta-data.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pg-meta-data" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pg_meta_data</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pg_meta_data</span> &mdash; <span class="dc-title">
   Obtém metadados para tabela
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.pg-meta-data-description">
  <h3 class="title">Descrição</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pg_meta_data</strong></span>(<span class="methodparam"><span class="type"><a href="class.pgsql-connection.php" class="type PgSql\Connection">PgSql\Connection</a></span> <code class="parameter">$connection</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$table_name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$extended</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>pg_meta_data()</strong></span> retorna a definição de tabela para
   <code class="literal">table_name</code> como um array.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-meta-data-parameters">
  <h3 class="title">Parâmetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">connection</code></dt>
     <dd>
      <p class="para">Uma instância de <span class="classname"><a href="class.pgsql-connection.php" class="classname">PgSql\Connection</a></span>.</p>
     </dd>
    
    
     <dt><code class="parameter">table_name</code></dt>
     <dd>
      <p class="para">
       O nome da tabela.
      </p>
     </dd>
    
    
     <dt><code class="parameter">extended</code></dt>
     <dd>
      <p class="para">
       Opção para retornar metadados estendidos. O padrão é <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-meta-data-returnvalues">
  <h3 class="title">Valor Retornado</h3>
  <p class="para">
   Um <span class="type"><a href="language.types.array.php" class="type array">array</a></span> da definição da tabela,  ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> em caso de falha.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pg-meta-data-changelog">
  <h3 class="title">Registro de Alterações</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versão</th>
      <th>Descrição</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  O parâmetro <code class="parameter">connection</code> agora espera uma instância de <span class="classname"><a href="class.pgsql-connection.php" class="classname">PgSql\Connection</a></span>;
  anteriormente, um <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> era esperado.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.pg-meta-data-examples">
  <h3 class="title">Exemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemplo #1 Obtendo metadados da tabela</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />  $dbconn </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=publisher"</span><span style="color: #007700">) or die(</span><span style="color: #DD0000">"Não foi possível conectar"</span><span style="color: #007700">);<br /><br />  </span><span style="color: #0000BB">$meta </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_meta_data</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">, </span><span style="color: #DD0000">'authors'</span><span style="color: #007700">);<br />  if (</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$meta</span><span style="color: #007700">)) {<br />      echo </span><span style="color: #DD0000">'&lt;pre&gt;'</span><span style="color: #007700">;<br />      </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$meta</span><span style="color: #007700">);<br />      echo </span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;<br />  }<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>O exemplo acima produzirá:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(3) {
[&quot;author&quot;]=&gt;
array(5) {
  [&quot;num&quot;]=&gt;
  int(1)
  [&quot;type&quot;]=&gt;
  string(7) &quot;varchar&quot;
  [&quot;len&quot;]=&gt;
  int(-1)
  [&quot;not null&quot;]=&gt;
  bool(false)
  [&quot;has default&quot;]=&gt;
  bool(false)
}
[&quot;year&quot;]=&gt;
array(5) {
  [&quot;num&quot;]=&gt;
  int(2)
  [&quot;type&quot;]=&gt;
  string(4) &quot;int2&quot;
  [&quot;len&quot;]=&gt;
  int(2)
  [&quot;not null&quot;]=&gt;
  bool(false)
  [&quot;has default&quot;]=&gt;
  bool(false)
}
[&quot;title&quot;]=&gt;
array(5) {
  [&quot;num&quot;]=&gt;
  int(3)
  [&quot;type&quot;]=&gt;
  string(7) &quot;varchar&quot;
  [&quot;len&quot;]=&gt;
  int(-1)
  [&quot;not null&quot;]=&gt;
  bool(false)
  [&quot;has default&quot;]=&gt;
  bool(false)
}
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pg-meta-data-seealso">
  <h3 class="title">Veja Também</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.pg-convert.php" class="function" rel="rdfs-seeAlso">pg_convert()</a> - Converte valores de array associativo em formas adequadas para instru&ccedil;&otilde;es SQL</span></li>
   </ul>
  </p>
 </div>

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