cvs: phpdoc-es / translation.xml /reference/mysqli/functions mysqli-stmt-fetch.xml mysqli-stmt-free-result.xml mysqli-stmt-init.xml
mysqli-stmt-num-rows.xml mysqli-stmt-param-count.xml mysqli-stmt-prepare.xml mysqli-stmt-result-metadata.xml mysqli-stmt-send-long-data.xml
mysqli-stmt-sqlstate.xml mysqli-stmt-store-result.xml
| From: | Enrique Garcia Briones | Date: | Fri, 28 May 2004 17:06:01 +0000 |
| Subject: | cvs: phpdoc-es / translation.xml /reference/mysqli/functions mysqli-stmt-fetch.xml mysqli-stmt-free-result.xml mysqli-stmt-init.xml mysqli-stmt-num-rows.xml mysqli-stmt-param-count.xml mysqli-stmt-prepare.xml mysqli-stmt-result-metadata.xml mysqli-stmt-send-long-data.xml mysqli-stmt-sqlstate.xml mysqli-stmt-store-result.xml |
||
| Groups: | php.doc.es | ||
| Request: | Send a blank email to doc-es+get-603@lists.php.net to get a copy of this message | ||
baoengb Fri May 28 13:06:01 2004 EDT
Added files:
/phpdoc-es/reference/mysqli/functions mysqli-stmt-fetch.xml
mysqli-stmt-free-result.xml
mysqli-stmt-init.xml
mysqli-stmt-num-rows.xml
mysqli-stmt-param-count.xml
mysqli-stmt-prepare.xml
mysqli-stmt-result-metadata.xml
mysqli-stmt-send-long-data.xml
mysqli-stmt-sqlstate.xml
mysqli-stmt-store-result.xml
Modified files:
/phpdoc-es translation.xml
Log:
Traducciones
http://cvs.php.net/diff.php/phpdoc-es/translation.xml?r1=1.149&r2=1.150&ty=u Index: phpdoc-es/translation.xml diff -u phpdoc-es/translation.xml:1.149 phpdoc-es/translation.xml:1.150 --- phpdoc-es/translation.xml:1.149 Wed May 26 16:06:03 2004 +++ phpdoc-es/translation.xml Fri May 28 13:06:01 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.149 $ --> +<!-- $Revision: 1.150 $ --> <!DOCTYPE translation SYSTEM "../entities/translation.dtd"> <translation> @@ -148,35 +148,8 @@ <file name="reference/pdf/pdf-attach-file.xml" person="jtacon" type="translation" date="29.01.2004"/> - <file name="reference/mysqli/functions/mysqli-stmt-num-rows.xml" person="baoengb" - type="translation" date="02.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-sqlstate.xml" person="baoengb" - type="translation" date="02.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-store-result.xml" person="baoengb" - type="translation" date="02.03.2004"/> - <file name="language/types.xml" person="lboshell" type="review" date="15.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-fetch.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-init.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-param-count.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-prepare.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-result-metadata.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-send-long-data.xml" person="baoengb" - type="translation" date="16.03.2004"/> </work-in-progress> </translation> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-fetch"> <refnamediv> <refname>mysqli_stmt_fetch</refname> <refname>stmt->fetch</refname> <refpurpose> Obtiene el resultado de una sentencia SQL preparada en las variables enlazadas </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_fetch</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>fetch</methodname> <void /> </methodsynopsis> </classsynopsis> <para> <function>mysqli_stmt_fetch</function> regresa los datos de las filas usando las variables enlazadas por <function>mysqli_stmt_bind_result</function>. </para> <note> <para> Note que todas las columnas deben estar enlazadas por la aplicación antes de llamar <function>mysqli_stmt_fetch</function>. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <table> <title>Valores Regresados</title> <tgroup cols='2'> <thead> <row> <entry>Valor</entry> <entry>Descripción</entry> </row> </thead> <tbody> <row> <entry>&true;</entry> <entry>Exito. Los datos han sido obtenidos</entry> </row> <row> <entry>&false;</entry> <entry>Ocurrió un error</entry> </row> <row> <entry><literal>&null;</literal></entry> <entry>No existen más filas/datos</entry> </row> </tbody> </tgroup> </table> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_errno</function>, <function>mysqli_stmt_error</function>, <function>mysqli_stmt_bind_result</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, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = $mysqli->prepare($query)) { /* execute statement */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($name, $code); /* fetch values */ while ($stmt->fetch()) { printf ("%s (%s)\n", $name, $code); } /* close statement */ $stmt->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, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = mysqli_prepare($link, $query)) { /* execute statement */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $code); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf ("%s (%s)\n", $name, $code); } /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Rockford (USA) Tallahassee (USA) Salinas (USA) Santa Clarita (USA) Springfield (USA) ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-free-result"> <refnamediv> <refname>mysqli_stmt_free_result</refname> <refname>stmt->free_result</refname> <refpurpose>Libera la memoria donde se almacenó el resultado</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>void</type><methodname>mysqli_stmt_free_result</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>void</type> <methodname>free_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> La función <function>mysqli_stmt_free_result</function> libera la memoria del resultado asociado con la sentencia representada por el parámetro <parameter>stmt</parameter>, el cual fue asignado por <function>mysqli_stmt_store_result</function>. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> Esta función no regresa ningun valor. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_store_result</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-init"> <refnamediv> <refname>mysqli_stmt-init</refname> <refname>mysqli->stmt->init</refname> <refpurpose> Inicializa una sentencia y regresa un objeto para ser usado con mysqli_stmt_prepare </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos :</para> <methodsynopsis> <type>objeto</type><methodname>mysqli_stmt_init</methodname> <methodparam><type>objeto</type><parameter>identificador_de_enlace</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>mysqli</classname></ooclass> <methodsynopsis> <type>objeto</type> <methodname>stmt_init</methodname> <void/> </methodsynopsis> </classsynopsis> <para> Asigna e inicializa una objeto de sentencia conveniente para <function>mysqli_stmt_prepare</function>. </para> <note> <para> Cualquier llamada subsecuente a cualquier función mysqli_stmt fallará hasta que sea llamada <function>mysqli_stmt_prepare</function>. </para> </note> </refsect1> <refsect1> &reftitle.returnvalues; <para> Regresa un objeto. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_prepare</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-num-rows"> <refnamediv> <refname>mysqli_stmt_num_rows</refname> <refname>stmt->num_rows</refname> <refpurpose>Regresa el número de filas en un resultado de la sentencia.</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos :</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_num_rows</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>num_rows</varname></fieldsynopsis> </classsynopsis> <para> Regresa el número de filas en el resultado. El uso de <function>mysqli_stmt_num_rows</function> depende de que use <function>mysqli_stmt_store_result</function> para almacenar todo el resultado en el manejador de la sentencia. </para> <para> Si usa <function>mysqli_stmt_store_result</function>, <function>mysqli_stmt_num_rows</function> debe ser llamada inmediatamente. </para> </refsect1> <refsect1> <title>Valores regresados</title> <para> Un entero representando el número de filas en el resultado. </para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_stmt_affected_rows</function>, <function>mysqli_prepare</function>, <function>mysqli_stmt_store_result</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Number of rows: 20. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-param-count"> <refnamediv> <refname>mysqli_stmt_param_count</refname> <refname>stmt->param_count</refname> <refpurpose>Regresa el número de parámetros para la sentencia dada </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_param_count</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>param_count</varname></fieldsynopsis> </classsynopsis> <para> <function>mysqli_stmt_param_count</function> regresa el número de marcadores de parámetro presentes en la sentencia preparada. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> Regresa un entero representando el número de parámetros. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_prepare</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(); } if ($stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) { $marker = $stmt->param_count; printf("Statement has %d markers.\n", $marker); /* close statement */ $stmt->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(); } if ($stmt = mysqli_prepare($link, "SELECT Name FROM Country WHERE Name=? OR Code=?")) { $marker = mysqli_stmt_param_count($stmt); printf("Statement has %d markers.\n", $marker); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Statement has 2 markers. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-prepare"> <refnamediv> <refname>mysqli_stmt_prepare</refname> <refname>stmt->prepare</refname> <refpurpose> Prepara una sentencia SQL para su ejecución </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_prepare</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> <methodparam><type>cadena</type><parameter>query</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método)</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>prepare</methodname> <methodparam><type>cadena</type><parameter>query</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> <function>mysqli_stmt_prepare</function> prepara la consulta SQL apuntada por la cadena de consulta terminada en NULL. El objeto de la sentencia tiene que ser asignado por <function>mysqli_stmt_init</function>. La consulta debe consistir de una sentencia SQL sencilla. </para> <note> <para> No debe agregar al final el punto y coma o <literal>\g</literal> a la sentencia. </para> </note> <para> El parámetro <parameter>query</parameter> puede incluir uno o más marcadores de parámetro en la sentencia SQL, insertando el caracter interrogativo (<literal>?</literal>) en la posición apropiada. </para> <note> <para> Los marcadores son legales solo en ciertos lugares en la sentencia SQL. Por ejemplo, son permitidos en la lista VALUES() de una sentencia INSERT (para específicar calores de columnas para una fila), o en una comparación con una columna en una clausula WHERE para específicar un valor de comparación. </para> <para> Sin embargo, no son permitidos para identificadores (tales como nombres de tabla o columna), en el listado de los nombres de las columnas a ser regresadas por la sentencia SELECT, o para específicar operadores de resultado binario, tales como <literal>=</literal> el signo de igual. La última restricción es necesaria porque serí imposuble determinar el tipo de parámetro. En general, los marcadores de parámetro son legales solo en las sentencias del lenguaje de manipulación de datos (DML), y no en las sentencias del lenguaje de definición de datos (DDL). </para> </note> <para> Los marcadores de parámetro deben estar enlazados a variables de aplicación usando <function>mysqli_stmt_bind_param</function> y/o <function>mysqli_stmt_bind_result</function> antes de ejecutar la sentencia u obtener las filas del resultado. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_init</function>, <function>mysqli_stmt_execute</function>, <function>mysqli_stmt_fetch</function>, <function>mysqli_stmt_bind_param</function>, <function>mysqli_stmt_bind_result</function>, <function>mysqli_stmt_close</function> </para> </refsect1> <refsect1> <title>Ejmeplos</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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = $mysqli->stmt_init(); if ($stmt->prepare("SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ $stmt->bind_param("s", $city); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($district); /* fetch value */ $stmt->fetch(); printf("%s is in district %s\n", $city, $district); /* close statement */ $stmt->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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = mysqli_stmt_init(); if ($stmt = mysqli_stmt_prepare($stmt, "SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ mysqli_stmt_bind_param($stmt, "s", $city); /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $district); /* fetch value */ mysqli_stmt_fetch($stmt); printf("%s is in district %s\n", $city, $district); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Amersfoort is in district Utrecht ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-result-metadata"> <refnamediv> <refname>mysqli_stmt_result_metadata</refname> <refpurpose>Regresa metadatos del resultado de una sentencia preparada </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_result_metadata</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>result_metadata</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Si una sentencia pasada a <function>mysqli_prepare</function> es una que produce un resultado, <function>mysqli_stmt_result_metadata</function> regresa el objeto del resultado que puede ser usado para procesar los metadatos de información tales como el número total de campos e información del campo individual. </para> <note> <para> Este apuntador del resultado puede ser pasado como un argumento a cualquiera de las funciones basadas en campos que procesan los metadatos del resultado tales como: <itemizedlist> <listitem><para><function>mysqli_num_fields</function></para></listitem> <listitem><para><function>mysqli_fetch_field</function></para></listitem> <listitem><para><function>mysqli_fetch_field_direct</function></para></listitem> <listitem><para><function>mysqli_fetch_fields</function></para></listitem> <listitem><para><function>mysqli_field_count</function></para></listitem> <listitem><para><function>mysqli_field_seek</function></para></listitem> <listitem><para><function>mysqli_field_tell</function></para></listitem> <listitem><para><function>mysqli_free_result</function></para></listitem> </itemizedlist> </para> </note> <para> La estructura del resultado debe ser liberada cuando haya terminado con esta, lo cual puede hacer pasandola a <function>mysqli_free_result</function> </para> <note> <para> El resultado regresado por <function>mysqli_stmt_result_metadata</function> contiene solo metadatos. No contiene ninguna fila del resultado. Las filas son obtenidas usando el manejador de la sentencia con <function>mysqli_fetch</function>. </para> </note> </refsect1> <refsect1> &reftitle.returnvalues; <para> <function>mysqli_stmt_result_metadata</function> regresa un objeto del resultado o &false; si ocurrio un error. </para> </refsect1> <refsect1> <title>Vea también:</title> <para> <function>mysqli_prepare</function>, <function>mysqli_free_result</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <para> <example> <title>Estilo orientado a objetos</title> <programlisting role='php'> <![CDATA[ <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "test"); $mysqli->query("DROP TABLE IF EXISTS friends"); $mysqli->query("CREATE TABLE friends (id int, name varchar(20))"); $mysqli->query("INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = $mysqli->prepare("SELECT id, name FROM friends"); $stmt->execute(); /* get resultset for metadata */ $result = $stmt->result_metadata(); /* retrieve field information from metadata result set */ $field = $result->fetch_field(); printf("Fieldname: %s\n", $field->name); /* close resultset */ $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", "test"); mysqli_query($link, "DROP TABLE IF EXISTS friends"); mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))"); mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = mysqli_prepare($link, "SELECT id, name FROM friends"); mysqli_stmt_execute($stmt); /* get resultset for metadata */ $result = mysqli_stmt_result_metadata($stmt); /* retrieve field information from metadata result set */ $field = mysqli_fetch_field($result); printf("Fieldname: %s\n", $field->name); /* close resultset */ mysqli_free_result($result); /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-send-long-data"> <refnamediv> <refname>mysqli_stmt_send_long_data</refname> <refname>stmt->send_long_data</refname> <refpurpose>Envía los datos en bloques</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_send_long_data</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>cadena</type><parameter>data</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método)</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>stmt_send_long_data</methodname> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>cadena</type><parameter>data</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Permite enviar datos de parámetro al servidor en piezas (o pedazos) ej. si el tamaño de un dato BLOB excede el tamaño de <literal>max_allowed_packet</literal>. Esta función puede ser llamada multiples veces para enviar las partes de un caracter o valor de datos binario de una columna, la cual debe ser uno de los tipos de datos TEXT o BLOB. </para> <para> <parameter>param_nr</parameter> indica cual parámetro asociar con los datos. Los parámetros son numerados empezando desde cero. <parameter>data</parameter> es una cadena conteniendo los datos a ser enviados. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para>&return.success;</para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_bind_param</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-sqlstate"> <refnamediv> <refname>mysqli_stmt_sqlstate</refname> <refpurpose>Regresa el error SQLSTATE de la operación con sentencias previa</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <methodsynopsis> <type>cadena</type><methodname>mysqli_stmt_sqlstate</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para> Regresa una cadena conteniendo el código de error SQLSTATE para la sentencia preparada más recientemente invocada que pudo ser exitosa o fallar. El código de error consiste de cinco caracteres. <literal>'00000'</literal> significa que no hubo error. Los valores son específicados por ANSI SQL y ODBC. Para una lista de los posibles valores vea <ulink url="&url.mysql.docs.error;">&url.mysql.docs.error;</ulink>. </para> <note> <para> Note que no todos los errores de MySQL tienen un correspondiente en SQLSTATE. El valor <literal>HY000</literal> (error general) es usado para errores que no tienen ese correspondiente. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <para> Regresa una candena conteniendo el código de error SQLSTATE para el último error. El código de error consiste de cinco caracteres. <literal>'00000'</literal> significa que no hubo error. </para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_stmt_errno</function>, <function>mysqli_stmt_error</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); printf("Error: %s.\n", $stmt->sqlstate); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %s.\n", mysqli_stmt_sqlstate($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Error: 42S02. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.6 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-store-result"> <refnamediv> <refname>mysqli_stmt_store_result</refname> <refname>mysqli_stmt->store_result</refname> <refpurpose>Transfiere un resultado de una sentencia preparada</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_store_result</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>store_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Se debe llamar <function>mysql_stmt_store_result</function> para cada consulta que exitosamente produce un resultado (<literal>SELECT, SHOW, DESCRIBE, EXPLAIN</literal>), y solo si quiere almacenar el resultado completo en el lado del cliente, asi que las subsecuentes llamadas <function>mysql_fetch</function> regresarán los datos almacenados en la memoria intermedia (BUFFER). </para> <note> <para> Es inecesario llamar <function>mysql_stmt_store_result</function> para otras consultas, pero si lo hace, no dañará o causará cualquier cambio en el desempeño en cualquier caso. Puede detectar si la consulta produjo un resultado checando si <function>mysql_stmt_result_metadata</function> regresa NULL. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <para>&return.success;</para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_result_metadata</function>, <function>mysqli_fetch</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* free result */ $stmt->free_result(); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* free result */ mysqli_stmt_free_result($stmt); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Number of rows: 20. ]]> </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 -->
http://cvs.php.net/diff.php/phpdoc-es/translation.xml?r1=1.149&r2=1.150&ty=u Index: phpdoc-es/translation.xml diff -u phpdoc-es/translation.xml:1.149 phpdoc-es/translation.xml:1.150 --- phpdoc-es/translation.xml:1.149 Wed May 26 16:06:03 2004 +++ phpdoc-es/translation.xml Fri May 28 13:06:01 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.149 $ --> +<!-- $Revision: 1.150 $ --> <!DOCTYPE translation SYSTEM "../entities/translation.dtd"> <translation> @@ -148,35 +148,8 @@ <file name="reference/pdf/pdf-attach-file.xml" person="jtacon" type="translation" date="29.01.2004"/> - <file name="reference/mysqli/functions/mysqli-stmt-num-rows.xml" person="baoengb" - type="translation" date="02.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-sqlstate.xml" person="baoengb" - type="translation" date="02.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-store-result.xml" person="baoengb" - type="translation" date="02.03.2004"/> - <file name="language/types.xml" person="lboshell" type="review" date="15.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-fetch.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-init.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-param-count.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-prepare.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-result-metadata.xml" person="baoengb" - type="translation" date="16.03.2004"/> - - <file name="reference/mysqli/functions/mysqli-stmt-send-long-data.xml" person="baoengb" - type="translation" date="16.03.2004"/> </work-in-progress> </translation> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-fetch.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-fetch"> <refnamediv> <refname>mysqli_stmt_fetch</refname> <refname>stmt->fetch</refname> <refpurpose> Obtiene el resultado de una sentencia SQL preparada en las variables enlazadas </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_fetch</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>fetch</methodname> <void /> </methodsynopsis> </classsynopsis> <para> <function>mysqli_stmt_fetch</function> regresa los datos de las filas usando las variables enlazadas por <function>mysqli_stmt_bind_result</function>. </para> <note> <para> Note que todas las columnas deben estar enlazadas por la aplicación antes de llamar <function>mysqli_stmt_fetch</function>. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <table> <title>Valores Regresados</title> <tgroup cols='2'> <thead> <row> <entry>Valor</entry> <entry>Descripción</entry> </row> </thead> <tbody> <row> <entry>&true;</entry> <entry>Exito. Los datos han sido obtenidos</entry> </row> <row> <entry>&false;</entry> <entry>Ocurrió un error</entry> </row> <row> <entry><literal>&null;</literal></entry> <entry>No existen más filas/datos</entry> </row> </tbody> </tgroup> </table> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_errno</function>, <function>mysqli_stmt_error</function>, <function>mysqli_stmt_bind_result</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, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = $mysqli->prepare($query)) { /* execute statement */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($name, $code); /* fetch values */ while ($stmt->fetch()) { printf ("%s (%s)\n", $name, $code); } /* close statement */ $stmt->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, CountryCode FROM City ORDER by ID DESC LIMIT 150,5"; if ($stmt = mysqli_prepare($link, $query)) { /* execute statement */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $name, $code); /* fetch values */ while (mysqli_stmt_fetch($stmt)) { printf ("%s (%s)\n", $name, $code); } /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Rockford (USA) Tallahassee (USA) Salinas (USA) Santa Clarita (USA) Springfield (USA) ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-free-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-free-result"> <refnamediv> <refname>mysqli_stmt_free_result</refname> <refname>stmt->free_result</refname> <refpurpose>Libera la memoria donde se almacenó el resultado</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>void</type><methodname>mysqli_stmt_free_result</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>void</type> <methodname>free_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> La función <function>mysqli_stmt_free_result</function> libera la memoria del resultado asociado con la sentencia representada por el parámetro <parameter>stmt</parameter>, el cual fue asignado por <function>mysqli_stmt_store_result</function>. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> Esta función no regresa ningun valor. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_store_result</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-init.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-init"> <refnamediv> <refname>mysqli_stmt-init</refname> <refname>mysqli->stmt->init</refname> <refpurpose> Inicializa una sentencia y regresa un objeto para ser usado con mysqli_stmt_prepare </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos :</para> <methodsynopsis> <type>objeto</type><methodname>mysqli_stmt_init</methodname> <methodparam><type>objeto</type><parameter>identificador_de_enlace</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>mysqli</classname></ooclass> <methodsynopsis> <type>objeto</type> <methodname>stmt_init</methodname> <void/> </methodsynopsis> </classsynopsis> <para> Asigna e inicializa una objeto de sentencia conveniente para <function>mysqli_stmt_prepare</function>. </para> <note> <para> Cualquier llamada subsecuente a cualquier función mysqli_stmt fallará hasta que sea llamada <function>mysqli_stmt_prepare</function>. </para> </note> </refsect1> <refsect1> &reftitle.returnvalues; <para> Regresa un objeto. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_prepare</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-num-rows.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-num-rows"> <refnamediv> <refname>mysqli_stmt_num_rows</refname> <refname>stmt->num_rows</refname> <refpurpose>Regresa el número de filas en un resultado de la sentencia.</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos :</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_num_rows</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>num_rows</varname></fieldsynopsis> </classsynopsis> <para> Regresa el número de filas en el resultado. El uso de <function>mysqli_stmt_num_rows</function> depende de que use <function>mysqli_stmt_store_result</function> para almacenar todo el resultado en el manejador de la sentencia. </para> <para> Si usa <function>mysqli_stmt_store_result</function>, <function>mysqli_stmt_num_rows</function> debe ser llamada inmediatamente. </para> </refsect1> <refsect1> <title>Valores regresados</title> <para> Un entero representando el número de filas en el resultado. </para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_stmt_affected_rows</function>, <function>mysqli_prepare</function>, <function>mysqli_stmt_store_result</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Number of rows: 20. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-param-count.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-param-count"> <refnamediv> <refname>mysqli_stmt_param_count</refname> <refname>stmt->param_count</refname> <refpurpose>Regresa el número de parámetros para la sentencia dada </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>int</type><methodname>mysqli_stmt_param_count</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (propiedad):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <fieldsynopsis><type>int</type><varname>param_count</varname></fieldsynopsis> </classsynopsis> <para> <function>mysqli_stmt_param_count</function> regresa el número de marcadores de parámetro presentes en la sentencia preparada. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> Regresa un entero representando el número de parámetros. </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_prepare</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(); } if ($stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) { $marker = $stmt->param_count; printf("Statement has %d markers.\n", $marker); /* close statement */ $stmt->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(); } if ($stmt = mysqli_prepare($link, "SELECT Name FROM Country WHERE Name=? OR Code=?")) { $marker = mysqli_stmt_param_count($stmt); printf("Statement has %d markers.\n", $marker); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Statement has 2 markers. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-prepare.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-prepare"> <refnamediv> <refname>mysqli_stmt_prepare</refname> <refname>stmt->prepare</refname> <refpurpose> Prepara una sentencia SQL para su ejecución </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_prepare</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> <methodparam><type>cadena</type><parameter>query</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método)</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>prepare</methodname> <methodparam><type>cadena</type><parameter>query</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> <function>mysqli_stmt_prepare</function> prepara la consulta SQL apuntada por la cadena de consulta terminada en NULL. El objeto de la sentencia tiene que ser asignado por <function>mysqli_stmt_init</function>. La consulta debe consistir de una sentencia SQL sencilla. </para> <note> <para> No debe agregar al final el punto y coma o <literal>\g</literal> a la sentencia. </para> </note> <para> El parámetro <parameter>query</parameter> puede incluir uno o más marcadores de parámetro en la sentencia SQL, insertando el caracter interrogativo (<literal>?</literal>) en la posición apropiada. </para> <note> <para> Los marcadores son legales solo en ciertos lugares en la sentencia SQL. Por ejemplo, son permitidos en la lista VALUES() de una sentencia INSERT (para específicar calores de columnas para una fila), o en una comparación con una columna en una clausula WHERE para específicar un valor de comparación. </para> <para> Sin embargo, no son permitidos para identificadores (tales como nombres de tabla o columna), en el listado de los nombres de las columnas a ser regresadas por la sentencia SELECT, o para específicar operadores de resultado binario, tales como <literal>=</literal> el signo de igual. La última restricción es necesaria porque serí imposuble determinar el tipo de parámetro. En general, los marcadores de parámetro son legales solo en las sentencias del lenguaje de manipulación de datos (DML), y no en las sentencias del lenguaje de definición de datos (DDL). </para> </note> <para> Los marcadores de parámetro deben estar enlazados a variables de aplicación usando <function>mysqli_stmt_bind_param</function> y/o <function>mysqli_stmt_bind_result</function> antes de ejecutar la sentencia u obtener las filas del resultado. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para> &return.success; </para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_stmt_init</function>, <function>mysqli_stmt_execute</function>, <function>mysqli_stmt_fetch</function>, <function>mysqli_stmt_bind_param</function>, <function>mysqli_stmt_bind_result</function>, <function>mysqli_stmt_close</function> </para> </refsect1> <refsect1> <title>Ejmeplos</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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = $mysqli->stmt_init(); if ($stmt->prepare("SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ $stmt->bind_param("s", $city); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($district); /* fetch value */ $stmt->fetch(); printf("%s is in district %s\n", $city, $district); /* close statement */ $stmt->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(); } $city = "Amersfoort"; /* create a prepared statement */ $stmt = mysqli_stmt_init(); if ($stmt = mysqli_stmt_prepare($stmt, "SELECT District FROM City WHERE Name=?")) { /* bind parameters for markers */ mysqli_stmt_bind_param($stmt, "s", $city); /* execute query */ mysqli_stmt_execute($stmt); /* bind result variables */ mysqli_stmt_bind_result($stmt, $district); /* fetch value */ mysqli_stmt_fetch($stmt); printf("%s is in district %s\n", $city, $district); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Amersfoort is in district Utrecht ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-result-metadata.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-result-metadata"> <refnamediv> <refname>mysqli_stmt_result_metadata</refname> <refpurpose>Regresa metadatos del resultado de una sentencia preparada </refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>mixto</type><methodname>mysqli_stmt_result_metadata</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>mixto</type> <methodname>result_metadata</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Si una sentencia pasada a <function>mysqli_prepare</function> es una que produce un resultado, <function>mysqli_stmt_result_metadata</function> regresa el objeto del resultado que puede ser usado para procesar los metadatos de información tales como el número total de campos e información del campo individual. </para> <note> <para> Este apuntador del resultado puede ser pasado como un argumento a cualquiera de las funciones basadas en campos que procesan los metadatos del resultado tales como: <itemizedlist> <listitem><para><function>mysqli_num_fields</function></para></listitem> <listitem><para><function>mysqli_fetch_field</function></para></listitem> <listitem><para><function>mysqli_fetch_field_direct</function></para></listitem> <listitem><para><function>mysqli_fetch_fields</function></para></listitem> <listitem><para><function>mysqli_field_count</function></para></listitem> <listitem><para><function>mysqli_field_seek</function></para></listitem> <listitem><para><function>mysqli_field_tell</function></para></listitem> <listitem><para><function>mysqli_free_result</function></para></listitem> </itemizedlist> </para> </note> <para> La estructura del resultado debe ser liberada cuando haya terminado con esta, lo cual puede hacer pasandola a <function>mysqli_free_result</function> </para> <note> <para> El resultado regresado por <function>mysqli_stmt_result_metadata</function> contiene solo metadatos. No contiene ninguna fila del resultado. Las filas son obtenidas usando el manejador de la sentencia con <function>mysqli_fetch</function>. </para> </note> </refsect1> <refsect1> &reftitle.returnvalues; <para> <function>mysqli_stmt_result_metadata</function> regresa un objeto del resultado o &false; si ocurrio un error. </para> </refsect1> <refsect1> <title>Vea también:</title> <para> <function>mysqli_prepare</function>, <function>mysqli_free_result</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <para> <example> <title>Estilo orientado a objetos</title> <programlisting role='php'> <![CDATA[ <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "test"); $mysqli->query("DROP TABLE IF EXISTS friends"); $mysqli->query("CREATE TABLE friends (id int, name varchar(20))"); $mysqli->query("INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = $mysqli->prepare("SELECT id, name FROM friends"); $stmt->execute(); /* get resultset for metadata */ $result = $stmt->result_metadata(); /* retrieve field information from metadata result set */ $field = $result->fetch_field(); printf("Fieldname: %s\n", $field->name); /* close resultset */ $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", "test"); mysqli_query($link, "DROP TABLE IF EXISTS friends"); mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))"); mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = mysqli_prepare($link, "SELECT id, name FROM friends"); mysqli_stmt_execute($stmt); /* get resultset for metadata */ $result = mysqli_stmt_result_metadata($stmt); /* retrieve field information from metadata result set */ $field = mysqli_fetch_field($result); printf("Fieldname: %s\n", $field->name); /* close resultset */ mysqli_free_result($result); /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-send-long-data.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-send-long-data"> <refnamediv> <refname>mysqli_stmt_send_long_data</refname> <refname>stmt->send_long_data</refname> <refpurpose>Envía los datos en bloques</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_send_long_data</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>cadena</type><parameter>data</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método)</para> <classsynopsis> <ooclass><classname>stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>stmt_send_long_data</methodname> <methodparam><type>int</type><parameter>param_nr</parameter></methodparam> <methodparam><type>cadena</type><parameter>data</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Permite enviar datos de parámetro al servidor en piezas (o pedazos) ej. si el tamaño de un dato BLOB excede el tamaño de <literal>max_allowed_packet</literal>. Esta función puede ser llamada multiples veces para enviar las partes de un caracter o valor de datos binario de una columna, la cual debe ser uno de los tipos de datos TEXT o BLOB. </para> <para> <parameter>param_nr</parameter> indica cual parámetro asociar con los datos. Los parámetros son numerados empezando desde cero. <parameter>data</parameter> es una cadena conteniendo los datos a ser enviados. </para> </refsect1> <refsect1> &reftitle.returnvalues; <para>&return.success;</para> </refsect1> <refsect1> &reftitle.seealso; <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_bind_param</function> </para> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-sqlstate.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-sqlstate"> <refnamediv> <refname>mysqli_stmt_sqlstate</refname> <refpurpose>Regresa el error SQLSTATE de la operación con sentencias previa</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <methodsynopsis> <type>cadena</type><methodname>mysqli_stmt_sqlstate</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para> Regresa una cadena conteniendo el código de error SQLSTATE para la sentencia preparada más recientemente invocada que pudo ser exitosa o fallar. El código de error consiste de cinco caracteres. <literal>'00000'</literal> significa que no hubo error. Los valores son específicados por ANSI SQL y ODBC. Para una lista de los posibles valores vea <ulink url="&url.mysql.docs.error;">&url.mysql.docs.error;</ulink>. </para> <note> <para> Note que no todos los errores de MySQL tienen un correspondiente en SQLSTATE. El valor <literal>HY000</literal> (error general) es usado para errores que no tienen ese correspondiente. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <para> Regresa una candena conteniendo el código de error SQLSTATE para el último error. El código de error consiste de cinco caracteres. <literal>'00000'</literal> significa que no hubo error. </para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_stmt_errno</function>, <function>mysqli_stmt_error</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE myCountry LIKE Country"); $mysqli->query("INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = $mysqli->prepare($query)) { /* drop table */ $mysqli->query("DROP TABLE myCountry"); /* execute query */ $stmt->execute(); printf("Error: %s.\n", $stmt->sqlstate); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %s.\n", mysqli_stmt_sqlstate($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Error: 42S02. ]]> </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 --> http://cvs.php.net/co.php/phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml?r=1.1&p=1 Index: phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml +++ phpdoc-es/reference/mysqli/functions/mysqli-stmt-store-result.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.6 Maintainer: baoengb Status: ready --> <refentry id="function.mysqli-stmt-store-result"> <refnamediv> <refname>mysqli_stmt_store_result</refname> <refname>mysqli_stmt->store_result</refname> <refpurpose>Transfiere un resultado de una sentencia preparada</refpurpose> </refnamediv> <refsect1> <title>Descripción</title> <para>Estilo por procedimientos:</para> <methodsynopsis> <type>bool</type><methodname>mysqli_stmt_store_result</methodname> <methodparam><type>objeto</type><parameter>stmt</parameter></methodparam> </methodsynopsis> <para>Estilo orientado a objetos (método):</para> <classsynopsis> <ooclass><classname>mysqli_stmt</classname></ooclass> <methodsynopsis> <type>bool</type><methodname>store_result</methodname> <void /> </methodsynopsis> </classsynopsis> <para> Se debe llamar <function>mysql_stmt_store_result</function> para cada consulta que exitosamente produce un resultado (<literal>SELECT, SHOW, DESCRIBE, EXPLAIN</literal>), y solo si quiere almacenar el resultado completo en el lado del cliente, asi que las subsecuentes llamadas <function>mysql_fetch</function> regresarán los datos almacenados en la memoria intermedia (BUFFER). </para> <note> <para> Es inecesario llamar <function>mysql_stmt_store_result</function> para otras consultas, pero si lo hace, no dañará o causará cualquier cambio en el desempeño en cualquier caso. Puede detectar si la consulta produjo un resultado checando si <function>mysql_stmt_result_metadata</function> regresa NULL. </para> </note> </refsect1> <refsect1> <title>Valores regresados</title> <para>&return.success;</para> </refsect1> <refsect1> <title>Vea también</title> <para> <function>mysqli_prepare</function>, <function>mysqli_stmt_result_metadata</function>, <function>mysqli_fetch</function> </para> </refsect1> <refsect1> <title>Ejemplos</title> <example> <title>Estilo orientado a objetos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = $mysqli->prepare($query)) { /* execute query */ $stmt->execute(); /* store result */ $stmt->store_result(); printf("Number of rows: %d.\n", $stmt->num_rows); /* free result */ $stmt->free_result(); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> ]]> </programlisting> </example> <example> <title>Estilo por procedimientos</title> <programlisting role="php"> <![CDATA[ <?php /* Open a connection */ $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, CountryCode FROM City ORDER BY Name LIMIT 20"; if ($stmt = mysqli_prepare($link, $query)) { /* execute query */ mysqli_stmt_execute($stmt); /* store result */ mysqli_stmt_store_result($stmt); printf("Number of rows: %d.\n", mysqli_stmt_num_rows($stmt)); /* free result */ mysqli_stmt_free_result($stmt); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link); ?> ]]> </programlisting> </example> <para> Los ejemplos anteriores producirán la siguiente salida: </para> <screen> <![CDATA[ Number of rows: 20. ]]> </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 -->