svn: /phpdoc/es/trunk/reference/mysqli/mysqli/ change-user.xml
| From: | Juan M Rivas | Date: | Wed, 24 Nov 2010 20:53:10 +0000 |
| Subject: | svn: /phpdoc/es/trunk/reference/mysqli/mysqli/ change-user.xml | ||
| Groups: | php.doc.es | ||
| Request: | Send a blank email to doc-es+get-3789@lists.php.net to get a copy of this message | ||
juanmi Wed, 24 Nov 2010 20:53:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=305727
Log:
24/11/2010 - Primera traduccion del fichero - First translation of this file.
Changed paths:
A phpdoc/es/trunk/reference/mysqli/mysqli/change-user.xml
Added: phpdoc/es/trunk/reference/mysqli/mysqli/change-user.xml
===================================================================
--- phpdoc/es/trunk/reference/mysqli/mysqli/change-user.xml (rev 0)
+++ phpdoc/es/trunk/reference/mysqli/mysqli/change-user.xml 2010-11-24 20:53:10 UTC (rev 305727)
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<!-- EN-Revision: 299196 Maintainer: juanmi Status: ready -->
+<!-- Reviewed: yes -->
+<refentry xml:id="mysqli.change-user" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>mysqli::change_user</refname>
+ <refname>mysqli_change_user</refname>
+ <refpurpose>Cambia el usuario de la conexión de bases de datos
especificada.</refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <para>&style.oop;</para>
+ <methodsynopsis>
+ <type>bool</type><methodname>mysqli::change_user</methodname>
+
<methodparam><type>string</type><parameter>user</parameter></methodparam>
+
<methodparam><type>string</type><parameter>password</parameter></methodparam>
+
<methodparam><type>string</type><parameter>database</parameter></methodparam>
+ </methodsynopsis>
+ <para>&style.procedural;</para>
+ <methodsynopsis>
+ <type>bool</type><methodname>mysqli_change_user</methodname>
+
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
+
<methodparam><type>string</type><parameter>user</parameter></methodparam>
+
<methodparam><type>string</type><parameter>password</parameter></methodparam>
+
<methodparam><type>string</type><parameter>database</parameter></methodparam>
+ </methodsynopsis>
+ <para>
+ Cambia el usuario de la conexión de base de datos especificada y establece
+ la base de datos actual.
+ </para>
+ <para>
+ Para realizar con éxito el cambio de usuarios, un <parameter>username</parameter> y
+ <parameter>password</parameter> válidos deben ser indicados y ese usuario debe
tener
+ suficientes permisos para acceder a la base de datos deseada. Si por cualquier razón la
autorización
+ falla, se mantendrá la autenticación de usuario existente.
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ &mysqli.link.description;
+ <varlistentry>
+ <term><parameter>user</parameter></term>
+ <listitem>
+ <para>
+ Nombre de usuario de MySQL.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>password</parameter></term>
+ <listitem>
+ <para>
+ Contraseña de MySQL.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>database</parameter></term>
+ <listitem>
+ <para>
+ La base de datos a la que quiero cambiar.
+ </para>
+ <para>
+ Si se desea, se puede parar el valor &null; de modo que solo cambiará
+ el usuario y no se seleccionará una base de datos. Para seleccionar una
+ base de datos en este caso, utilice la función
<function>mysqli_select_db</function>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ &return.success;
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ El uso de este comando siempre causará que la conexión a la base de datos actual
+ se comporte como una conexión completamente nueva, independientemente de si
+ la operación se ha completado con éxito. Este reinicio incluye la realización
+ de un "rollback" a cualquier transacción activa, cerrando todas las tablas
temporales,
+ y desbloqueando todas las tablas bloqueadas.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <example>
+ <title>Ejemplo del método
<methodname>mysqli::change_user</methodname></title>
+ <para>&style.oop;</para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+/* connect database test */
+$mysqli = new mysqli("localhost", "mi_usuario", "mi_contraseña",
"test");
+
+/* check connection */
+if (mysqli_connect_errno()) {
+ printf("Error de conexión: %s\n", mysqli_connect_error());
+ exit();
+}
+
+/* Set Variable a */
+$mysqli->query("SET @a:=1");
+
+/* reiniciando todo, y realizando una nueva conexión a base de datos */
+$mysqli->change_user("my_user", "my_password", "world");
+
+if ($result = $mysqli->query("SELECT DATABASE()")) {
+ $row = $result->fetch_row();
+ printf("Base de datos predeterminada: %s\n", $row[0]);
+ $result->close();
+}
+
+if ($result = $mysqli->query("SELECT @a")) {
+ $row = $result->fetch_row();
+ if ($row[0] === NULL) {
+ printf("Value of variable a is NULL\n");
+ }
+ $result->close();
+}
+
+/* close connection */
+$mysqli->close();
+?>
+]]>
+ </programlisting>
+ <para>&style.procedural;</para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+/* connect database test */
+$link = mysqli_connect("localhost", "mi_usuario", "mi_contraseña",
"test");
+
+/* check connection */
+if (!$link) {
+ printf("Error de conexión: %s\n", mysqli_connect_error());
+ exit();
+}
+
+/* Set Variable a */
+mysqli_query($link, "SET @a:=1");
+
+/* reinciando todo y realizando una nueva conexión a base de datos. */
+mysqli_change_user($link, "my_user", "my_password", "world");
+
+if ($result = mysqli_query($link, "SELECT DATABASE()")) {
+ $row = mysqli_fetch_row($result);
+ printf("Default database: %s\n", $row[0]);
+ mysqli_free_result($result);
+}
+
+if ($result = mysqli_query($link, "SELECT @a")) {
+ $row = mysqli_fetch_row($result);
+ if ($row[0] === NULL) {
+ printf("Value of variable a is NULL\n");
+ }
+ mysqli_free_result($result);
+}
+
+/* Cerrar conexión */
+mysqli_close($link);
+?>
+]]>
+ </programlisting>
+ &examples.outputs;
+ <screen>
+<![CDATA[
+Default database: world
+Value of variable a is NULL
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>mysqli_connect</function></member>
+ <member><function>mysqli_select_db</function></member>
+ </simplelist>
+ </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:"~/.phpdoc/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
+-->
Property changes on: phpdoc/es/trunk/reference/mysqli/mysqli/change-user.xml
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Added: svn:eol-style
+ native