<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.pg-field-table.php',
    1 => 'pg_field_table',
    2 => 'Devuelve el nombre o el oid de una tabla',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'Funciones de PostgreSQL',
  ),
  'prev' => 
  array (
    0 => 'function.pg-field-size.php',
    1 => 'pg_field_size',
  ),
  'next' => 
  array (
    0 => 'function.pg-field-type.php',
    1 => 'pg_field_type',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/pgsql/functions/pg-field-table.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pg-field-table" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pg_field_table</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pg_field_table</span> &mdash; <span class="dc-title">Devuelve el nombre o el oid de una tabla</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.pg-field-table-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pg_field_table</strong></span>(<span class="methodparam"><span class="type"><a href="class.pgsql-result.php" class="type PgSql\Result">PgSql\Result</a></span> <code class="parameter">$result</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$field</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$oid_only</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.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</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_field_table()</strong></span> devuelve el nombre de la tabla a la que
   pertenece el campo o el oid de la tabla si el parámetro
   <code class="parameter">oid_only</code> vale <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-field-table-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">result</code></dt>
     <dd>
      <p class="para">
 Una instancia <span class="classname"><a href="class.pgsql-result.php" class="classname">PgSql\Result</a></span>, devuelta por <span class="function"><a href="function.pg-query.php" class="function">pg_query()</a></span>,
 <span class="function"><a href="function.pg-query-params.php" class="function">pg_query_params()</a></span>, o <span class="function"><a href="function.pg-execute.php" class="function">pg_execute()</a></span> (entre otros).
</p>
     </dd>
    
    
     <dt><code class="parameter">field</code></dt>
      <dd>
       <p class="para">
        Número del campo, comenzando en 0.
       </p>
     </dd>
    
    
     <dt><code class="parameter">oid_only</code></dt>
      <dd>
       <p class="para">
        Por omisión, se devuelve el nombre de la tabla a la que pertenece el campo, pero
        si el parámetro <code class="parameter">oid_only</code> se define como <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, entonces,
        se devolverá el oid.
       </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-field-table-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   En caso de éxito, el nombre de la tabla o el oid,  o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si ocurre un error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pg-field-table-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  El parámetro <code class="parameter">result</code> ahora espera una instancia de
  <span class="classname"><a href="class.pgsql-result.php" class="classname">PgSql\Result</a></span> ; anteriormente, se esperaba un <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.pg-field-table-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Recuperación de información de una tabla a partir de un campo</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">"Conexión imposible"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$res </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">, </span><span style="color: #DD0000">"SELECT bar FROM foo"</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">pg_field_table</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">pg_field_table</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$res </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">, </span><span style="color: #DD0000">"SELECT version()"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">pg_field_table</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Resultado del ejemplo anterior es similar a:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">foo
14379580

bool(false)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.pg-field-table-notes">
  <h3 class="title">Notas</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Devolver el oid es más rápido que devolver el nombre de la tabla, ya que
    la recuperación del nombre de la tabla requiere una consulta a la tabla del sistema
    de la base de datos.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pg-field-table-seealso">
  <h3 class="title">Ver también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.pg-field-name.php" class="function" rel="rdfs-seeAlso">pg_field_name()</a> - Devuelve el nombre de un campo PostgreSQL</span></li>
    <li><span class="function"><a href="function.pg-field-type.php" class="function" rel="rdfs-seeAlso">pg_field_type()</a> - Devuelve el tipo de un campo PostgreSQL dado por &iacute;ndice</span></li>
   </ul>
  </p>
 </div>

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