php-doc-en/reference/mysqli/functions/mysqli-fetch-field-direct.xml
Enrique Garcia Briones 038005e811 Traducido al espaniol
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@153793 c90b9560-bf6c-de11-be94-00142212c4b1
2004-03-16 15:26:37 +00:00

209 lines
5.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- EN-Revision: 1.6 Maintainer: baoengb Status: ready -->
<refentry id="function.mysqli-fetch-field-direct">
<refnamediv>
<refname>mysqli_fetch_field_direct</refname>
<refname>result->fetch_field_direct</refname>
<refpurpose>
Obtiene los metadatos de un campo
</refpurpose>
</refnamediv>
<refsect1>
<title>Descripci&oacute;n</title>
<para>Estilo por procedimientos:</para>
<methodsynopsis>
<type>mixto</type><methodname>mysqli_fetch_field_direct</methodname>
<methodparam><type>objeto</type><parameter>resultado</parameter></methodparam>
<methodparam><type>int</type><parameter>indice_de_campo</parameter></methodparam>
</methodsynopsis>
<para>Estilo orientado a objetos (m&eacute;todo):</para>
<classsynopsis>
<ooclass><classname>resultado</classname></ooclass>
<methodsynopsis>
<type>mixto</type>
<methodname>fetch_field_direct</methodname>
<methodparam><type>int</type><parameter>indice_de_campo</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
La funci&oacute;n <function>mysqli_fetch_field_direct</function> regresa un
objeto el cu&aacute;l contiene informaci&oacute;n de la definici&oacute;n del
campo del resultado espec&iacute;ficado. El valor de indice_de_campo debe estar
en el rango de <literal>0</literal> a <literal>n&uacute;mero de campos -1</literal>.
</para>
</refsect1>
<refsect1>
<title>Valores regresados</title>
<para>
Regresa un objeto el cual contiene informaci&oacute;n de la definici&oacute;n del
campo o &false; si no hay informaci&oacute;n para el <literal>indice_de_campo</literal>
espec&iacute;ficado.
</para>
<para>
<table>
<title>Atributos del objeto</title>
<tgroup cols='2'>
<thead>
<row>
<entry>Atributo</entry>
<entry>Descripci&oacute;n</entry>
</row>
</thead>
<tbody>
<row>
<entry>name</entry>
<entry>Nombre de la columna</entry>
</row>
<row>
<entry>orgname</entry>
<entry>Nombre original de la columna si se di&oacute; un alias</entry>
</row>
<row>
<entry>table</entry>
<entry>Nombre de la tabla a la que pertenece el campo</entry>
</row>
<row>
<entry>orgtable</entry>
<entry>Nombre original de la tabla si se di&oacute; un alias</entry>
</row>
<row>
<entry>def</entry>
<entry>El valor por defecto para este campo, representado como una cadena</entry>
</row>
<row>
<entry>max_length</entry>
<entry>La amplitud m&aacute;xima de campo de el campo para el resultado</entry>
</row>
<row>
<entry>flags</entry>
<entry>Un entero que representa los bit bandera para el campo</entry>
</row>
<row>
<entry>type</entry>
<entry>Tipo de dato utilizado para este campo</entry>
</row>
<row>
<entry>decimals</entry>
<entry>N&uacute;mero de decimales usadas (para campos entero)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1>
<title>Vea tambi&eacute;n</title>
<para>
<function>mysqli_num_fields</function>
<function>mysqli_fetch_field</function>
<function>mysqli_fetch_fields</function>
</para>
</refsect1>
<refsect1>
<title>Ejemplos</title>
<example>
<title>Estilo orientado a objetos</title>
<programlisting role="php">
<![CDATA[
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for column 'SurfaceArea' */
$finfo = $result->fetch_field_direct(1);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n", $finfo->type);
$result->close();
}
/* close connection */
$mysqli->close();
?>
]]>
</programlisting>
</example>
<example>
<title>Estilo por procedimientos</title>
<programlisting role="php">
<![CDATA[
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for column 'SurfaceArea' */
$finfo = mysqli_fetch_field_direct($result, 1);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n", $finfo->type);
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
]]>
</programlisting>
</example>
<para>
Los ejemplos anteriores producir&aacute;n la siguiente salida:
</para>
<screen>
<![CDATA[
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
]]>
</screen>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->