mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
Translation/Update by @marcosmarcolin
* Ajustar link de novos recursos e incompatibilidades da migração do 7.0 para 7.1. * docs: missing translation of reference/mysqli. * docs: missing translation of reference/mysqli/functions. * docs: missing translation of reference/mysqli/mysqli * docs: remove english text. Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
This commit is contained in:
43
reference/mysqli/functions/mysqli-connect.xml
Normal file
43
reference/mysqli/functions/mysqli-connect.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: be526864c9777106cd78a517628847b60743e2d4 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="function.mysqli-connect" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli_connect</refname>
|
||||
<refpurpose>&Alias; <methodname>mysqli::__construct</methodname></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
&info.function.alias; <methodname>mysqli::__construct</methodname>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Se o modo de exceção mysqli não estiver habilitado e uma conexão falhar,
|
||||
então <function>mysqli_connect</function> retornará &false; ao invés de um objeto.
|
||||
A função <function>mysqli_connect_error</function> pode ser usada para buscar o erro de conexão.
|
||||
</para>
|
||||
</note>
|
||||
</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
|
||||
-->
|
||||
210
reference/mysqli/functions/mysqli-get-client-stats.xml
Normal file
210
reference/mysqli/functions/mysqli-get-client-stats.xml
Normal file
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 473b5ab2c14369c0bc9f17a7f122c9669718c3e3 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="function.mysqli-get-client-stats" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli_get_client_stats</refname>
|
||||
<refpurpose>Retorna as estatísticas do cliente por processo</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>mysqli_get_client_stats</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna as estatísticas do cliente por processo.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
&mysqli.available.mysqlnd;
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna uma matriz com estatísticas do cliente.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysqli_get_client_stats</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect();
|
||||
print_r(mysqli_get_client_stats());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[bytes_sent] => 43
|
||||
[bytes_received] => 80
|
||||
[packets_sent] => 1
|
||||
[packets_received] => 2
|
||||
[protocol_overhead_in] => 8
|
||||
[protocol_overhead_out] => 4
|
||||
[bytes_received_ok_packet] => 11
|
||||
[bytes_received_eof_packet] => 0
|
||||
[bytes_received_rset_header_packet] => 0
|
||||
[bytes_received_rset_field_meta_packet] => 0
|
||||
[bytes_received_rset_row_packet] => 0
|
||||
[bytes_received_prepare_response_packet] => 0
|
||||
[bytes_received_change_user_packet] => 0
|
||||
[packets_sent_command] => 0
|
||||
[packets_received_ok] => 1
|
||||
[packets_received_eof] => 0
|
||||
[packets_received_rset_header] => 0
|
||||
[packets_received_rset_field_meta] => 0
|
||||
[packets_received_rset_row] => 0
|
||||
[packets_received_prepare_response] => 0
|
||||
[packets_received_change_user] => 0
|
||||
[result_set_queries] => 0
|
||||
[non_result_set_queries] => 0
|
||||
[no_index_used] => 0
|
||||
[bad_index_used] => 0
|
||||
[slow_queries] => 0
|
||||
[buffered_sets] => 0
|
||||
[unbuffered_sets] => 0
|
||||
[ps_buffered_sets] => 0
|
||||
[ps_unbuffered_sets] => 0
|
||||
[flushed_normal_sets] => 0
|
||||
[flushed_ps_sets] => 0
|
||||
[ps_prepared_never_executed] => 0
|
||||
[ps_prepared_once_executed] => 0
|
||||
[rows_fetched_from_server_normal] => 0
|
||||
[rows_fetched_from_server_ps] => 0
|
||||
[rows_buffered_from_client_normal] => 0
|
||||
[rows_buffered_from_client_ps] => 0
|
||||
[rows_fetched_from_client_normal_buffered] => 0
|
||||
[rows_fetched_from_client_normal_unbuffered] => 0
|
||||
[rows_fetched_from_client_ps_buffered] => 0
|
||||
[rows_fetched_from_client_ps_unbuffered] => 0
|
||||
[rows_fetched_from_client_ps_cursor] => 0
|
||||
[rows_skipped_normal] => 0
|
||||
[rows_skipped_ps] => 0
|
||||
[copy_on_write_saved] => 0
|
||||
[copy_on_write_performed] => 0
|
||||
[command_buffer_too_small] => 0
|
||||
[connect_success] => 1
|
||||
[connect_failure] => 0
|
||||
[connection_reused] => 0
|
||||
[reconnect] => 0
|
||||
[pconnect_success] => 0
|
||||
[active_connections] => 1
|
||||
[active_persistent_connections] => 0
|
||||
[explicit_close] => 0
|
||||
[implicit_close] => 0
|
||||
[disconnect_close] => 0
|
||||
[in_middle_of_command_close] => 0
|
||||
[explicit_free_result] => 0
|
||||
[implicit_free_result] => 0
|
||||
[explicit_stmt_close] => 0
|
||||
[implicit_stmt_close] => 0
|
||||
[mem_emalloc_count] => 0
|
||||
[mem_emalloc_ammount] => 0
|
||||
[mem_ecalloc_count] => 0
|
||||
[mem_ecalloc_ammount] => 0
|
||||
[mem_erealloc_count] => 0
|
||||
[mem_erealloc_ammount] => 0
|
||||
[mem_efree_count] => 0
|
||||
[mem_malloc_count] => 0
|
||||
[mem_malloc_ammount] => 0
|
||||
[mem_calloc_count] => 0
|
||||
[mem_calloc_ammount] => 0
|
||||
[mem_realloc_count] => 0
|
||||
[mem_realloc_ammount] => 0
|
||||
[mem_free_count] => 0
|
||||
[proto_text_fetched_null] => 0
|
||||
[proto_text_fetched_bit] => 0
|
||||
[proto_text_fetched_tinyint] => 0
|
||||
[proto_text_fetched_short] => 0
|
||||
[proto_text_fetched_int24] => 0
|
||||
[proto_text_fetched_int] => 0
|
||||
[proto_text_fetched_bigint] => 0
|
||||
[proto_text_fetched_decimal] => 0
|
||||
[proto_text_fetched_float] => 0
|
||||
[proto_text_fetched_double] => 0
|
||||
[proto_text_fetched_date] => 0
|
||||
[proto_text_fetched_year] => 0
|
||||
[proto_text_fetched_time] => 0
|
||||
[proto_text_fetched_datetime] => 0
|
||||
[proto_text_fetched_timestamp] => 0
|
||||
[proto_text_fetched_string] => 0
|
||||
[proto_text_fetched_blob] => 0
|
||||
[proto_text_fetched_enum] => 0
|
||||
[proto_text_fetched_set] => 0
|
||||
[proto_text_fetched_geometry] => 0
|
||||
[proto_text_fetched_other] => 0
|
||||
[proto_binary_fetched_null] => 0
|
||||
[proto_binary_fetched_bit] => 0
|
||||
[proto_binary_fetched_tinyint] => 0
|
||||
[proto_binary_fetched_short] => 0
|
||||
[proto_binary_fetched_int24] => 0
|
||||
[proto_binary_fetched_int] => 0
|
||||
[proto_binary_fetched_bigint] => 0
|
||||
[proto_binary_fetched_decimal] => 0
|
||||
[proto_binary_fetched_float] => 0
|
||||
[proto_binary_fetched_double] => 0
|
||||
[proto_binary_fetched_date] => 0
|
||||
[proto_binary_fetched_year] => 0
|
||||
[proto_binary_fetched_time] => 0
|
||||
[proto_binary_fetched_datetime] => 0
|
||||
[proto_binary_fetched_timestamp] => 0
|
||||
[proto_binary_fetched_string] => 0
|
||||
[proto_binary_fetched_blob] => 0
|
||||
[proto_binary_fetched_enum] => 0
|
||||
[proto_binary_fetched_set] => 0
|
||||
[proto_binary_fetched_geometry] => 0
|
||||
[proto_binary_fetched_other] => 0
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="mysqlnd.stats">Descrição das estatísticas</link></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
|
||||
-->
|
||||
84
reference/mysqli/functions/mysqli-get-links-stats.xml
Normal file
84
reference/mysqli/functions/mysqli-get-links-stats.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 86e6094e86b84a51d00ab217ac50ce8dde33d82a Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
|
||||
<refentry xml:id="function.mysqli-get-links-stats" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli_get_links_stats</refname>
|
||||
<refpurpose>Retorna informações sobre links abertos e em cache</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>mysqli_get_links_stats</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>mysqli_get_links_stats</function> retorna informações sobre links MySQL
|
||||
abertos e em cache.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>mysqli_get_links_stats</function> retorna um array associativo
|
||||
com três elementos, digitados da seguinte forma:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>total</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Um <type>int</type> que indica o número total de links abertos em
|
||||
qualquer estado.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>active_plinks</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Um <type>int</type> representando o número de conexões persistentes
|
||||
ativas.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>cached_plinks</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Um <type>int</type> representando o número de conexões persistentes
|
||||
inativas.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</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
|
||||
-->
|
||||
234
reference/mysqli/mysqli/begin-transaction.xml
Normal file
234
reference/mysqli/mysqli/begin-transaction.xml
Normal file
@@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.begin-transaction" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli::begin_transaction</refname>
|
||||
<refname>mysqli_begin_transaction</refname>
|
||||
<refpurpose>Inicia uma transação</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::begin_transaction</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_begin_transaction</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Inicia uma transação. Requer o mecanismo InnoDB
|
||||
(é ativado por padrão). Para detalhes adicionais sobre como as transações do MySQL
|
||||
funcionam, consulte <link xlink:href="&url.mysql.docs.commit;">&url.mysql.docs.commit;</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
As flags válidas são:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<constant>MYSQLI_TRANS_START_READ_ONLY</constant>:
|
||||
Inicia a transação como "START TRANSACTION READ ONLY".
|
||||
Requer MySQL 5.6 e superior.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<constant>MYSQLI_TRANS_START_READ_WRITE</constant>:
|
||||
Inicia a transação como "START TRANSACTION READ WRITE".
|
||||
Requer MySQL 5.6 e superior.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<constant>MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT</constant>:
|
||||
Inicia a transação como "START TRANSACTION WITH CONSISTENT SNAPSHOT".
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Nome do ponto de salvamento para a transação.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>8.0.0</entry>
|
||||
<entry>
|
||||
<parameter>name</parameter> agora é anulável.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example xml:id="mysqli.begin-transaction.example.basic">
|
||||
<title><methodname>mysqli::begin_transaction</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* Diga ao mysqli para lançar uma exceção se ocorrer um erro */
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* O mecanismo de tabela deve suportar transações */
|
||||
$mysqli->query("CREATE TABLE IF NOT EXISTS language (
|
||||
Code text NOT NULL,
|
||||
Speakers int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||
|
||||
/* Inicia transação */
|
||||
$mysqli->begin_transaction();
|
||||
|
||||
try {
|
||||
/* Insira alguns valores */
|
||||
$mysqli->query("INSERT INTO language(Code, Speakers) VALUES ('DE', 42000123)");
|
||||
|
||||
/* Tente inserir valores inválidos */
|
||||
$language_code = 'FR';
|
||||
$native_speakers = 'Unknown';
|
||||
$stmt = $mysqli->prepare('INSERT INTO language(Code, Speakers) VALUES (?,?)');
|
||||
$stmt->bind_param('ss', $language_code, $native_speakers);
|
||||
$stmt->execute();
|
||||
|
||||
/* Se o código atingir esse ponto sem erros, confirme os dados no banco de dados */
|
||||
$mysqli->commit();
|
||||
} catch (mysqli_sql_exception $exception) {
|
||||
$mysqli->rollback();
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* Diga ao mysqli para lançar uma exceção se ocorrer um erro */
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* O mecanismo de tabela deve suportar transações */
|
||||
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS language (
|
||||
Code text NOT NULL,
|
||||
Speakers int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
|
||||
|
||||
/* Inicia transação */
|
||||
mysqli_begin_transaction($mysqli);
|
||||
|
||||
try {
|
||||
/* Insira alguns valores */
|
||||
mysqli_query($mysqli, "INSERT INTO language(Code, Speakers) VALUES ('DE', 42000123)");
|
||||
|
||||
/* Tente inserir valores inválidos */
|
||||
$language_code = 'FR';
|
||||
$native_speakers = 'Unknown';
|
||||
$stmt = mysqli_prepare($mysqli, 'INSERT INTO language(Code, Speakers) VALUES (?,?)');
|
||||
mysqli_stmt_bind_param($stmt, 'ss', $language_code, $native_speakers);
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
/* Se o código atingir esse ponto sem erros, confirme os dados no banco de dados */
|
||||
mysqli_commit($mysqli);
|
||||
} catch (mysqli_sql_exception $exception) {
|
||||
mysqli_rollback($mysqli);
|
||||
|
||||
throw $exception;
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Esta função não funciona com tipos de tabelas não transacionais (como
|
||||
MyISAM ou ISAM).
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_autocommit</function></member>
|
||||
<member><function>mysqli_commit</function></member>
|
||||
<member><function>mysqli_rollback</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
|
||||
-->
|
||||
318
reference/mysqli/mysqli/construct.xml
Normal file
318
reference/mysqli/mysqli/construct.xml
Normal file
@@ -0,0 +1,318 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.construct" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::__construct</refname>
|
||||
<refname>mysqli::connect</refname>
|
||||
<refname>mysqli_connect</refname>
|
||||
<refpurpose>Abre uma nova conexão com o servidor MySQL</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<constructorsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <methodname>mysqli::__construct</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>hostname</parameter><initializer>ini_get("mysqli.default_host")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>username</parameter><initializer>ini_get("mysqli.default_user")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>ini_get("mysqli.default_pw")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>database</parameter><initializer>""</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>ini_get("mysqli.default_port")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>socket</parameter><initializer>ini_get("mysqli.default_socket")</initializer></methodparam>
|
||||
</constructorsynopsis>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>void</type><methodname>mysqli::connect</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>hostname</parameter><initializer>ini_get("mysqli.default_host")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>username</parameter><initializer>ini_get("mysqli.default_user")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>ini_get("mysqli.default_pw")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>database</parameter><initializer>""</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>ini_get("mysqli.default_port")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>socket</parameter><initializer>ini_get("mysqli.default_socket")</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>mysqli</type><type>false</type></type><methodname>mysqli_connect</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>hostname</parameter><initializer>ini_get("mysqli.default_host")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>username</parameter><initializer>ini_get("mysqli.default_user")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>password</parameter><initializer>ini_get("mysqli.default_pw")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>database</parameter><initializer>""</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>ini_get("mysqli.default_port")</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>socket</parameter><initializer>ini_get("mysqli.default_socket")</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Abre uma conexão com o servidor MySQL.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>hostname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Pode ser um nome de host ou um endereço IP. O host local é
|
||||
assumido ao passar o valor &null; ou a string "localhost" para este parâmetro.
|
||||
Quando possível, serão usados pipes em vez do protocolo TCP/IP.
|
||||
O protocolo TCP/IP é usado se um nome de host e um número de porta forem fornecidos juntos, por ex. <literal>localhost:3308</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Prepender host por <literal>p:</literal> abre uma conexão persistente.
|
||||
<function>mysqli_change_user</function> é chamado automaticamente em
|
||||
conexões abertas a partir do pool de conexões.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>username</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O nome de usuário do MySQL.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>password</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Se não for fornecido ou for &null;, o servidor MySQL tentará autenticar
|
||||
o usuário apenas nos registros de usuário que não possuem senha. Isso
|
||||
permite que um nome de usuário seja usado com diferentes permissões (dependendo
|
||||
se uma senha é fornecida ou não).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>database</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Se fornecido, especificará o banco de dados padrão a ser usado ao
|
||||
realizar consultas.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>port</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Especifica o número da porta para tentar se conectar ao servidor MySQL.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>socket</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Especifica o socket ou pipe nomeado que deve ser usado.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
A especificação do parâmetro <parameter>socket</parameter> não determinará
|
||||
explicitamente o tipo de conexão a ser usada ao conectar-se
|
||||
ao servidor MySQL. Como a conexão é feita com o banco de
|
||||
dados MySQL é determinado pelo parâmetro
|
||||
<parameter>hostname</parameter>.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<methodname>mysqli::__construct</methodname> sempre retorna um objeto que representa a conexão com um servidor MySQL,
|
||||
independente de ter sucesso ou não.
|
||||
</para>
|
||||
<para>
|
||||
<function>mysqli_connect</function> retorna um objeto que representa a conexão com um servidor MySQL,
|
||||
&return.falseforfailure;.
|
||||
</para>
|
||||
<para>
|
||||
<methodname>mysqli::connect</methodname> retorna &null; no sucesso &return.falseforfailure;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Se <constant>MYSQLI_REPORT_STRICT</constant> estiver ativado e a tentativa de conexão
|
||||
com o banco de dados solicitado falhar, uma <classname>mysqli_sql_exception</classname> será lançada.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::__construct</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* Você deve ativar o relatório de erros para mysqli antes de tentar fazer uma conexão */
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
|
||||
|
||||
/* Defina o conjunto de caracteres desejado após estabelecer uma conexão */
|
||||
$mysqli->set_charset('utf8mb4');
|
||||
|
||||
printf("Success... %s\n", $mysqli->host_info);
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* Você deve ativar o relatório de erros para mysqli antes de tentar fazer uma conexão */
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
|
||||
|
||||
/* Defina o conjunto de caracteres desejado após estabelecer uma conexão */
|
||||
mysqli_set_charset($mysqli, 'utf8mb4');
|
||||
|
||||
printf("Success... %s\n", mysqli_get_host_info($mysqli));
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Sucesso... localhost via TCP/IP
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>Estendendo a classe mysqli</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class FooMysqli extends mysqli {
|
||||
public function __construct($host, $user, $pass, $db, $port, $socket, $charset) {
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
parent::__construct($host, $user, $pass, $db, $port, $socket);
|
||||
$this->set_charset($charset);
|
||||
}
|
||||
}
|
||||
|
||||
$db = new FooMysqli('localhost', 'my_user', 'my_password', 'my_db', 3306, null, 'utf8mb4');
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Tratamento manual de erros</title>
|
||||
<para>Se o relatório de erros estiver desabilitado, o desenvolvedor é responsável por verificar e tratar as falhas</para>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
error_reporting(0);
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
|
||||
if ($mysqli->connect_errno) {
|
||||
throw new RuntimeException('mysqli connection error: ' . $mysqli->connect_error);
|
||||
}
|
||||
|
||||
/* Defina o conjunto de caracteres desejado após estabelecer uma conexão */
|
||||
$mysqli->set_charset('utf8mb4');
|
||||
if ($mysqli->errno) {
|
||||
throw new RuntimeException('mysqli error: ' . $mysqli->error);
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
error_reporting(0);
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
$mysqli = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
|
||||
if (mysqli_connect_errno()) {
|
||||
throw new RuntimeException('mysqli connection error: ' . mysqli_connect_error());
|
||||
}
|
||||
|
||||
/* Defina o conjunto de caracteres desejado após estabelecer uma conexão */
|
||||
mysqli_set_charset($mysqli, 'utf8mb4');
|
||||
if (mysqli_errno($mysqli)) {
|
||||
throw new RuntimeException('mysqli error: ' . mysqli_error($mysqli));
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
&mysqli.charset.note;
|
||||
<note>
|
||||
<para>
|
||||
&style.oop; apenas: Se a conexão falhar, um objeto ainda será retornado. Para verificar
|
||||
se a conexão falhou, use a função
|
||||
<function>mysqli_connect_error</function> ou a propriedade <link linkend="mysqli.connect-error">mysqli->connect_error</link>
|
||||
como nos exemplos anteriores.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Se for necessário definir opções, como o tempo limite de conexão,
|
||||
<function>mysqli_real_connect</function> deve ser usado.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
Chamar o construtor sem parâmetros é o mesmo que chamar
|
||||
<function>mysqli_init</function>.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
O erro "Can't create TCP/IP socket (10106)" geralmente significa que a diretiva <link linkend="ini.variables-order">variables_order</link> configure
|
||||
não contém o caractere <literal>E</literal>. No Windows, se o
|
||||
ambiente não for copiado, a variável de ambiente <literal>SYSTEMROOT</literal>
|
||||
não estará disponível e o PHP terá problemas ao carregar o Winsock.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_real_connect</function></member>
|
||||
<member><function>mysqli_options</function></member>
|
||||
<member><function>mysqli_connect_errno</function></member>
|
||||
<member><function>mysqli_connect_error</function></member>
|
||||
<member><function>mysqli_close</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
|
||||
-->
|
||||
138
reference/mysqli/mysqli/error-list.xml
Normal file
138
reference/mysqli/mysqli/error-list.xml
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 7e5d0d1bb69180c9de1992edf9613215c975fa57 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.error-list" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::$error_list</refname>
|
||||
<refname>mysqli_error_list</refname>
|
||||
<refpurpose>Retorna uma lista de erros do último comando executado</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<fieldsynopsis><type>array</type><varname linkend="mysqli.error-list">mysqli->error_list</varname></fieldsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>mysqli_error_list</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna uma matriz de erros para a chamada de função MySQLi mais recente
|
||||
que pode ser bem-sucedida ou falhar.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Uma lista de erros, cada um como um <type>array</type> associativo
|
||||
contendo errno, error e sqlstate.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><varname>$mysqli->error_list</varname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mysqli = new mysqli("localhost", "nobody", "");
|
||||
|
||||
/* verifica a conexão */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!$mysqli->query("SET a=1")) {
|
||||
print_r($mysqli->error_list);
|
||||
}
|
||||
|
||||
/* fecha a conexão */
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* verifica a conexão */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Connect failed: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!mysqli_query($link, "SET a=1")) {
|
||||
print_r(mysqli_error_list($link));
|
||||
}
|
||||
|
||||
/* fecha a conexão */
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[errno] => 1193
|
||||
[sqlstate] => HY000
|
||||
[error] => Unknown system variable 'a'
|
||||
)
|
||||
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_connect_errno</function></member>
|
||||
<member><function>mysqli_connect_error</function></member>
|
||||
<member><function>mysqli_error</function></member>
|
||||
<member><function>mysqli_sqlstate</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
|
||||
-->
|
||||
205
reference/mysqli/mysqli/execute-query.xml
Normal file
205
reference/mysqli/mysqli/execute-query.xml
Normal file
@@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.execute-query" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::execute_query</refname>
|
||||
<refname>mysqli_execute_query</refname>
|
||||
<refpurpose>Prepara, vincula parâmetros e executa a instrução SQL</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli::execute_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>params</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli_execute_query</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>params</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Prepara a consulta SQL, associa parâmetros e a executa.
|
||||
O método <methodname>mysqli::execute_query</methodname> é um atalho para
|
||||
<methodname>mysqli::prepare</methodname>,
|
||||
<methodname>mysqli_stmt::bind_param</methodname>,
|
||||
<methodname>mysqli_stmt::execute</methodname>
|
||||
e <methodname>mysqli_stmt::get_result</methodname>.
|
||||
</para>
|
||||
<para>
|
||||
O modelo de instrução pode conter zero ou mais marcadores de parâmetro de
|
||||
ponto de interrogação (<literal>?</literal>) também chamados de espaços reservados.
|
||||
Os valores dos parâmetros devem ser fornecidos como um &array; usando o
|
||||
parâmetro <parameter>params</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
Uma instrução preparada é criada, mas nunca é exposta fora
|
||||
da função. É impossível acessar as propriedades da instrução como
|
||||
faria com o objeto <classname>mysqli_stmt</classname>.
|
||||
Devido a essa limitação, as informações de status são copiadas para o objeto
|
||||
<classname>mysqli</classname> e estão disponíveis usando seus métodos, por exemplo
|
||||
<function>mysqli_affected_rows</function> ou <function>mysqli_error</function>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
No caso em que uma instrução é passada para
|
||||
<function>mysqli_execute_query</function> que é maior que
|
||||
<literal>max_allowed_packet</literal> do servidor, os códigos
|
||||
de erro retornados são diferentes dependendo do sistema operacional.
|
||||
O comportamento é o seguinte:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
No Linux retorna um código de erro de 1153.
|
||||
A mensagem de erro significa <quote>que o pacote é maior que
|
||||
<literal>max_allowed_packet</literal> bytes.</quote>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
No Windows retorna um código de erro 2006.
|
||||
Essa mensagem de erro significa <quote>que o servidor foi desativado</quote>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A consulta, como uma string. Deve consistir em uma única instrução SQL.
|
||||
</para>
|
||||
<para>
|
||||
A instrução SQL pode conter zero ou mais marcadores de parâmetro
|
||||
representados por caracteres de ponto de interrogação (<literal>?</literal>)
|
||||
nas posições apropriadas.
|
||||
</para>
|
||||
<note>
|
||||
<!-- Copied from https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-prepare.html -->
|
||||
<para>
|
||||
Os marcadores são válidos apenas em determinados locais nas instruções SQL.
|
||||
Por exemplo, eles são permitidos na lista <literal>VALUES()</literal>
|
||||
de uma instrução <literal>INSERT</literal> (para especificar valores
|
||||
de coluna para uma linha) ou em uma comparação com uma coluna em uma
|
||||
cláusula <literal>WHERE</literal> para especificar um valor de comparação.
|
||||
No entanto, eles não são permitidos para identificadores (como nomes de tabelas
|
||||
ou colunas).
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>params</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Uma matriz de lista opcional com tantos elementos quantos forem os parâmetros vinculados na instrução SQL que está sendo executada. Cada valor é tratado como uma &string;.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna &false; em caso de falha. Para consultas bem-sucedidas que produzem
|
||||
um conjunto de resultados, como <literal>SELECT, SHOW, DESCRIBE</literal> ou
|
||||
<literal>EXPLAIN</literal>, retorna um objeto
|
||||
<classname>mysqli_result</classname>. Para outras consultas bem-sucedidas,
|
||||
retorna &true;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::execute_query</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'world');
|
||||
|
||||
$query = 'SELECT Name, District FROM City WHERE CountryCode=? ORDER BY Name LIMIT 5';
|
||||
$result = $mysqli->execute_query($query, ['DEU']);
|
||||
foreach ($result as $row) {
|
||||
printf("%s (%s)\n", $row["Name"], $row["District"]);
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
$query = 'SELECT Name, District FROM City WHERE CountryCode=? ORDER BY Name LIMIT 5';
|
||||
$result = mysqli_execute_query($link, $query, ['DEU']);
|
||||
foreach ($result as $row) {
|
||||
printf("%s (%s)\n", $row["Name"], $row["District"]);
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Aachen (Nordrhein-Westfalen)
|
||||
Augsburg (Baijeri)
|
||||
Bergisch Gladbach (Nordrhein-Westfalen)
|
||||
Berlin (Berliini)
|
||||
Bielefeld (Nordrhein-Westfalen)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_prepare</function></member>
|
||||
<member><function>mysqli_stmt_execute</function></member>
|
||||
<member><function>mysqli_stmt_bind_param</function></member>
|
||||
<member><function>mysqli_stmt_get_result</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
|
||||
-->
|
||||
154
reference/mysqli/mysqli/get-charset.xml
Normal file
154
reference/mysqli/mysqli/get-charset.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.get-charset" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::get_charset</refname>
|
||||
<refname>mysqli_get_charset</refname>
|
||||
<refpurpose>Retorna um objeto de conjunto de caracteres</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type class="union"><type>object</type><type>null</type></type><methodname>mysqli::get_charset</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>object</type><type>null</type></type><methodname>mysqli_get_charset</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Retorna um objeto de conjunto de caracteres fornecendo várias propriedades
|
||||
do conjunto de caracteres ativo atual.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
A função retorna um objeto de conjunto de caracteres com as seguintes propriedades:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>charset</parameter></term>
|
||||
<listitem><para>Nome do conjunto de caracteres</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>collation</parameter></term>
|
||||
<listitem><para>Nome do agrupamento</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>dir</parameter></term>
|
||||
<listitem><para>Diretório do qual a descrição do conjunto de caracteres foi obtida (?) ou "" para conjuntos de caracteres integrados</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>min_length</parameter></term>
|
||||
<listitem><para>Comprimento mínimo de caracteres em bytes</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>max_length</parameter></term>
|
||||
<listitem><para>Comprimento máximo de caracteres em bytes</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>number</parameter></term>
|
||||
<listitem><para>Número interno do conjunto de caracteres</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>state</parameter></term>
|
||||
<listitem><para>Status do conjunto de caracteres (?)</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::get_charset</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db = mysqli_init();
|
||||
$db->real_connect("localhost","root","","test");
|
||||
var_dump($db->get_charset());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db = mysqli_init();
|
||||
mysqli_real_connect($db, "localhost","root","","test");
|
||||
var_dump(mysqli_get_charset($db));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
object(stdClass)#2 (7) {
|
||||
["charset"]=>
|
||||
string(6) "latin1"
|
||||
["collation"]=>
|
||||
string(17) "latin1_swedish_ci"
|
||||
["dir"]=>
|
||||
string(0) ""
|
||||
["min_length"]=>
|
||||
int(1)
|
||||
["max_length"]=>
|
||||
int(1)
|
||||
["number"]=>
|
||||
int(8)
|
||||
["state"]=>
|
||||
int(801)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_character_set_name</function></member>
|
||||
<member><function>mysqli_set_charset</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
|
||||
-->
|
||||
219
reference/mysqli/mysqli/get-connection-stats.xml
Normal file
219
reference/mysqli/mysqli/get-connection-stats.xml
Normal file
@@ -0,0 +1,219 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.get-connection-stats" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli::get_connection_stats</refname>
|
||||
<refname>mysqli_get_connection_stats</refname>
|
||||
<refpurpose>Retorna estatísticas sobre a conexão do cliente</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>array</type><methodname>mysqli::get_connection_stats</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>mysqli_get_connection_stats</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna estatísticas sobre a conexão do cliente.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
&mysqli.available.mysqlnd;
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna uma matriz com estatísticas de conexão.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>mysqli_get_connection_stats</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect();
|
||||
print_r(mysqli_get_connection_stats($link));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Array
|
||||
(
|
||||
[bytes_sent] => 43
|
||||
[bytes_received] => 80
|
||||
[packets_sent] => 1
|
||||
[packets_received] => 2
|
||||
[protocol_overhead_in] => 8
|
||||
[protocol_overhead_out] => 4
|
||||
[bytes_received_ok_packet] => 11
|
||||
[bytes_received_eof_packet] => 0
|
||||
[bytes_received_rset_header_packet] => 0
|
||||
[bytes_received_rset_field_meta_packet] => 0
|
||||
[bytes_received_rset_row_packet] => 0
|
||||
[bytes_received_prepare_response_packet] => 0
|
||||
[bytes_received_change_user_packet] => 0
|
||||
[packets_sent_command] => 0
|
||||
[packets_received_ok] => 1
|
||||
[packets_received_eof] => 0
|
||||
[packets_received_rset_header] => 0
|
||||
[packets_received_rset_field_meta] => 0
|
||||
[packets_received_rset_row] => 0
|
||||
[packets_received_prepare_response] => 0
|
||||
[packets_received_change_user] => 0
|
||||
[result_set_queries] => 0
|
||||
[non_result_set_queries] => 0
|
||||
[no_index_used] => 0
|
||||
[bad_index_used] => 0
|
||||
[slow_queries] => 0
|
||||
[buffered_sets] => 0
|
||||
[unbuffered_sets] => 0
|
||||
[ps_buffered_sets] => 0
|
||||
[ps_unbuffered_sets] => 0
|
||||
[flushed_normal_sets] => 0
|
||||
[flushed_ps_sets] => 0
|
||||
[ps_prepared_never_executed] => 0
|
||||
[ps_prepared_once_executed] => 0
|
||||
[rows_fetched_from_server_normal] => 0
|
||||
[rows_fetched_from_server_ps] => 0
|
||||
[rows_buffered_from_client_normal] => 0
|
||||
[rows_buffered_from_client_ps] => 0
|
||||
[rows_fetched_from_client_normal_buffered] => 0
|
||||
[rows_fetched_from_client_normal_unbuffered] => 0
|
||||
[rows_fetched_from_client_ps_buffered] => 0
|
||||
[rows_fetched_from_client_ps_unbuffered] => 0
|
||||
[rows_fetched_from_client_ps_cursor] => 0
|
||||
[rows_skipped_normal] => 0
|
||||
[rows_skipped_ps] => 0
|
||||
[copy_on_write_saved] => 0
|
||||
[copy_on_write_performed] => 0
|
||||
[command_buffer_too_small] => 0
|
||||
[connect_success] => 1
|
||||
[connect_failure] => 0
|
||||
[connection_reused] => 0
|
||||
[reconnect] => 0
|
||||
[pconnect_success] => 0
|
||||
[active_connections] => 1
|
||||
[active_persistent_connections] => 0
|
||||
[explicit_close] => 0
|
||||
[implicit_close] => 0
|
||||
[disconnect_close] => 0
|
||||
[in_middle_of_command_close] => 0
|
||||
[explicit_free_result] => 0
|
||||
[implicit_free_result] => 0
|
||||
[explicit_stmt_close] => 0
|
||||
[implicit_stmt_close] => 0
|
||||
[mem_emalloc_count] => 0
|
||||
[mem_emalloc_ammount] => 0
|
||||
[mem_ecalloc_count] => 0
|
||||
[mem_ecalloc_ammount] => 0
|
||||
[mem_erealloc_count] => 0
|
||||
[mem_erealloc_ammount] => 0
|
||||
[mem_efree_count] => 0
|
||||
[mem_malloc_count] => 0
|
||||
[mem_malloc_ammount] => 0
|
||||
[mem_calloc_count] => 0
|
||||
[mem_calloc_ammount] => 0
|
||||
[mem_realloc_count] => 0
|
||||
[mem_realloc_ammount] => 0
|
||||
[mem_free_count] => 0
|
||||
[proto_text_fetched_null] => 0
|
||||
[proto_text_fetched_bit] => 0
|
||||
[proto_text_fetched_tinyint] => 0
|
||||
[proto_text_fetched_short] => 0
|
||||
[proto_text_fetched_int24] => 0
|
||||
[proto_text_fetched_int] => 0
|
||||
[proto_text_fetched_bigint] => 0
|
||||
[proto_text_fetched_decimal] => 0
|
||||
[proto_text_fetched_float] => 0
|
||||
[proto_text_fetched_double] => 0
|
||||
[proto_text_fetched_date] => 0
|
||||
[proto_text_fetched_year] => 0
|
||||
[proto_text_fetched_time] => 0
|
||||
[proto_text_fetched_datetime] => 0
|
||||
[proto_text_fetched_timestamp] => 0
|
||||
[proto_text_fetched_string] => 0
|
||||
[proto_text_fetched_blob] => 0
|
||||
[proto_text_fetched_enum] => 0
|
||||
[proto_text_fetched_set] => 0
|
||||
[proto_text_fetched_geometry] => 0
|
||||
[proto_text_fetched_other] => 0
|
||||
[proto_binary_fetched_null] => 0
|
||||
[proto_binary_fetched_bit] => 0
|
||||
[proto_binary_fetched_tinyint] => 0
|
||||
[proto_binary_fetched_short] => 0
|
||||
[proto_binary_fetched_int24] => 0
|
||||
[proto_binary_fetched_int] => 0
|
||||
[proto_binary_fetched_bigint] => 0
|
||||
[proto_binary_fetched_decimal] => 0
|
||||
[proto_binary_fetched_float] => 0
|
||||
[proto_binary_fetched_double] => 0
|
||||
[proto_binary_fetched_date] => 0
|
||||
[proto_binary_fetched_year] => 0
|
||||
[proto_binary_fetched_time] => 0
|
||||
[proto_binary_fetched_datetime] => 0
|
||||
[proto_binary_fetched_timestamp] => 0
|
||||
[proto_binary_fetched_string] => 0
|
||||
[proto_binary_fetched_blob] => 0
|
||||
[proto_binary_fetched_enum] => 0
|
||||
[proto_binary_fetched_set] => 0
|
||||
[proto_binary_fetched_geometry] => 0
|
||||
[proto_binary_fetched_other] => 0
|
||||
)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="mysqlnd.stats">Stats description</link></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
|
||||
-->
|
||||
193
reference/mysqli/mysqli/options.xml
Normal file
193
reference/mysqli/mysqli/options.xml
Normal file
@@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.options" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::options</refname>
|
||||
<refname>mysqli_options</refname>
|
||||
<refpurpose>Define opções</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::options</methodname>
|
||||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type class="union"><type>string</type><type>int</type></type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_options</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type class="union"><type>string</type><type>int</type></type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Usado para definir opções extras de conexão e afetar o comportamento de uma conexão.
|
||||
</para>
|
||||
<para>
|
||||
Esta função pode ser chamada várias vezes para definir várias opções.
|
||||
</para>
|
||||
<para>
|
||||
<function>mysqli_options</function> deve ser chamado depois de
|
||||
<function>mysqli_init</function> e antes de
|
||||
<function>mysqli_real_connect</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>option</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A opção que você deseja definir. Pode ser um dos seguintes valores:
|
||||
<table xml:id="mysqli.options.parameters">
|
||||
<title>Valid options</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_CONNECT_TIMEOUT</constant></entry>
|
||||
<entry>Tempo limite de conexão em segundos</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_READ_TIMEOUT</constant></entry>
|
||||
<entry>Tempo limite do resultado da execução do comando em segundos. Disponível a partir do PHP 7.2.0.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_LOCAL_INFILE</constant></entry>
|
||||
<entry>Ativar/desativar o uso de <literal>LOAD LOCAL INFILE</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_INIT_COMMAND</constant></entry>
|
||||
<entry>Comando para executar depois ao conectar ao servidor MySQL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_SET_CHARSET_NAME</constant></entry>
|
||||
<entry>O conjunto de caracteres a ser definido como padrão..</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_READ_DEFAULT_FILE</constant></entry>
|
||||
<entry>
|
||||
Lê as opções do arquivo de opções nomeadas em vez de <filename>my.cnf</filename>
|
||||
Não suportado por mysqlnd.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_READ_DEFAULT_GROUP</constant></entry>
|
||||
<entry>
|
||||
Leia as opções do grupo nomeado de <filename>my.cnf</filename>
|
||||
ou o arquivo especificado com <constant>MYSQL_READ_DEFAULT_FILE</constant>.
|
||||
Não suportado pelo mysqlnd.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_SERVER_PUBLIC_KEY</constant></entry>
|
||||
<entry>
|
||||
Arquivo de chave pública RSA usado com a autenticação baseada em SHA-256.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_NET_CMD_BUFFER_SIZE</constant></entry>
|
||||
<entry>
|
||||
O tamanho do buffer interno de comando/rede. Válido apenas para
|
||||
mysqlnd.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_NET_READ_BUFFER_SIZE</constant></entry>
|
||||
<entry>
|
||||
Tamanho máximo do bloco de leitura em bytes ao ler o corpo de um pacote de
|
||||
comando do MySQL. Válido apenas para mysqlnd.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_INT_AND_FLOAT_NATIVE</constant></entry>
|
||||
<entry>
|
||||
Converta colunas inteiras e flutuantes de volta para números PHP.
|
||||
Válido apenas para mysqlnd.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_OPT_SSL_VERIFY_SERVER_CERT</constant></entry>
|
||||
<entry>
|
||||
Se deve verificar o certificado do servidor ou não.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O valor da opção.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
Veja <function>mysqli_real_connect</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
&mysqli.charset.note;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_init</function></member>
|
||||
<member><function>mysqli_real_connect</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
|
||||
-->
|
||||
137
reference/mysqli/mysqli/ping.xml
Normal file
137
reference/mysqli/mysqli/ping.xml
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.ping" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::ping</refname>
|
||||
<refname>mysqli_ping</refname>
|
||||
<refpurpose>Faz ping em uma conexão de servidor ou tenta reconectar se a conexão cair</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::ping</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_ping</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Verifica se a conexão com o servidor está funcionando. Se ele estiver inativo e a
|
||||
opção global <link linkend="ini.mysqli.reconnect">mysqli.reconnect</link> estiver habilitada,
|
||||
uma reconexão automática será tentada.
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
A configuração mysqli.reconnect do &php.ini; é ignorada pelo driver mysqlnd, então a
|
||||
reconexão automática nunca é tentada.
|
||||
</simpara>
|
||||
</note>
|
||||
<para>
|
||||
Esta função pode ser utilizada por clientes que ficam muito tempo ociosos,
|
||||
para verificar se o servidor encerrou a conexão e reconectar se
|
||||
necessário.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::ping</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* verifique a conexão */
|
||||
if ($mysqli->connect_errno) {
|
||||
printf("Falha na conexão: %s\n", $mysqli->connect_error);
|
||||
exit();
|
||||
}
|
||||
|
||||
/* verifique se o servidor está ativo */
|
||||
if ($mysqli->ping()) {
|
||||
printf ("Nossa conexão está ok!\n");
|
||||
} else {
|
||||
printf ("Erro: %s\n", $mysqli->error);
|
||||
}
|
||||
|
||||
/* encerra a conexão */
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* verifique a conexão */
|
||||
if (mysqli_connect_errno()) {
|
||||
printf("Falha na conexão: %s\n", mysqli_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* verifique se o servidor está ativo */
|
||||
if (mysqli_ping($link)) {
|
||||
printf ("Nossa conexão está ok!\n");
|
||||
} else {
|
||||
printf ("Erro: %s\n", mysqli_error($link));
|
||||
}
|
||||
|
||||
/* encerra a conexão */
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Nossa conexão está ok!
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</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
|
||||
-->
|
||||
179
reference/mysqli/mysqli/prepare.xml
Normal file
179
reference/mysqli/mysqli/prepare.xml
Normal file
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.prepare" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::prepare</refname>
|
||||
<refname>mysqli_prepare</refname>
|
||||
<refpurpose>Prepara uma instrução SQL para execução</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type class="union"><type>mysqli_stmt</type><type>false</type></type><methodname>mysqli::prepare</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>mysqli_stmt</type><type>false</type></type><methodname>mysqli_prepare</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Prepara a consulta SQL e retorna um identificador de instrução a ser usado para outras
|
||||
operações na instrução. A consulta deve consistir em uma única instrução SQL.
|
||||
</para>
|
||||
<para>
|
||||
O modelo de instrução pode conter zero ou mais marcadores de parâmetro de ponto de interrogação
|
||||
(<literal>?</literal>) também chamados de espaços reservados.
|
||||
Os marcadores de parâmetro devem ser vinculados às variáveis do aplicativo usando
|
||||
<function>mysqli_stmt_bind_param</function> antes de executar a instrução.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A consulta, como uma string. Deve consistir em uma única instrução SQL.
|
||||
</para>
|
||||
<para>
|
||||
A instrução SQL pode conter zero ou mais marcadores de
|
||||
parâmetro representados por caracteres de ponto de interrogação (<literal>?</literal>)
|
||||
nas posições apropriadas.
|
||||
</para>
|
||||
<note>
|
||||
<!-- Copied from https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-prepare.html -->
|
||||
<para>
|
||||
Os marcadores são válidos apenas em determinados locais nas instruções SQL.
|
||||
Por exemplo, eles são permitidos na lista <literal>VALUES()</literal>
|
||||
de uma instrução <literal>INSERT</literal> (para especificar valores de
|
||||
coluna para uma linha) ou em uma comparação com uma coluna em uma cláusula
|
||||
<literal>WHERE</literal> para especificar um valor de comparação.
|
||||
No entanto, eles não são permitidos para identificadores (como nomes de tabelas ou
|
||||
colunas).
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
<function>mysqli_prepare</function> retorna um objeto de instrução ou &false; se ocorreu um erro.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::prepare</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
$city = "Amersfoort";
|
||||
|
||||
/* criar uma declaração preparada */
|
||||
$stmt = $mysqli->prepare("SELECT District FROM City WHERE Name=?");
|
||||
|
||||
/* parâmetros de ligação para marcadores */
|
||||
$stmt->bind_param("s", $city);
|
||||
|
||||
/* executar consulta */
|
||||
$stmt->execute();
|
||||
|
||||
/* vincular variáveis de resultado */
|
||||
$stmt->bind_result($district);
|
||||
|
||||
/* buscar valor */
|
||||
$stmt->fetch();
|
||||
|
||||
printf("%s está no distrito %s\n", $city, $district);
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
$city = "Amersfoort";
|
||||
|
||||
/* criar uma declaração preparada */
|
||||
$stmt = mysqli_prepare($link, "SELECT District FROM City WHERE Name=?");
|
||||
|
||||
/* parâmetros de ligação para marcadores */
|
||||
mysqli_stmt_bind_param($stmt, "s", $city);
|
||||
|
||||
/* executar consulta */
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
/* vincular variáveis de resultado */
|
||||
mysqli_stmt_bind_result($stmt, $district);
|
||||
|
||||
/* buscar valor */
|
||||
mysqli_stmt_fetch($stmt);
|
||||
|
||||
printf("%s está no distrito %s\n", $city, $district);
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Amersfoort está no distrito de Utrecht
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_stmt_execute</function></member>
|
||||
<member><function>mysqli_stmt_fetch</function></member>
|
||||
<member><function>mysqli_stmt_bind_param</function></member>
|
||||
<member><function>mysqli_stmt_bind_result</function></member>
|
||||
<member><function>mysqli_stmt_get_result</function></member>
|
||||
<member><function>mysqli_stmt_close</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
|
||||
-->
|
||||
227
reference/mysqli/mysqli/query.xml
Normal file
227
reference/mysqli/mysqli/query.xml
Normal file
@@ -0,0 +1,227 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.query" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::query</refname>
|
||||
<refname>mysqli_query</refname>
|
||||
<refpurpose>Executa uma consulta no banco de dados</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli::query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>result_mode</parameter><initializer><constant>MYSQLI_STORE_RESULT</constant></initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli_query</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>result_mode</parameter><initializer><constant>MYSQLI_STORE_RESULT</constant></initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Executa uma <parameter>consulta</parameter> no banco de dados.
|
||||
</para>
|
||||
<para>
|
||||
Para consultas não-DML (não INSERT, UPDATE ou DELETE),
|
||||
esta função é semelhante a chamar
|
||||
<function>mysqli_real_query</function> seguido por
|
||||
<function>mysqli_use_result</function> ou
|
||||
<function>mysqli_store_result</function>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
No caso em que uma instrução é passada para
|
||||
<function>mysqli_query</function> que é maior que
|
||||
<literal>max_allowed_packet</literal> do servidor, os códigos de
|
||||
erro retornados são diferentes dependendo se você está usando MySQL
|
||||
Native Driver (<literal>mysqlnd</literal>)ou MySQL Client Library
|
||||
(<literal>libmysqlclient</literal>). O comportamento é o seguinte:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>mysqlnd</literal> no Linux retorna um código de erro de 1153.
|
||||
A mensagem de erro significa que <quote>recebi um pacote maior que
|
||||
<literal>max_allowed_packet </literal> bytes</quote>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>mysqlnd</literal> no Windows retorna um código de erro 2006.
|
||||
Esta mensagem de erro significa que o <quote>server has gone away</quote>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>libmysqlclient</literal> em todas as plataformas retorna um código de erro
|
||||
2006. Essa mensagem de erro significa que o <quote>servidor foi
|
||||
desativado</quote>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A string de consulta.
|
||||
</para>
|
||||
&mysqli.sqlinjection.warning;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>result_mode</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O modo de resultado pode ser uma das 3 constantes que indicam como o
|
||||
resultado será retornado do servidor MySQL.
|
||||
</para>
|
||||
<para>
|
||||
<constant>MYSQLI_STORE_RESULT</constant> (padrão) - retorna um objeto
|
||||
<classname>mysqli_result</classname>com conjunto de resultados em buffer.
|
||||
</para>
|
||||
<para>
|
||||
<constant>MYSQLI_USE_RESULT</constant> - retorna um objeto
|
||||
<classname>mysqli_result</classname> com conjunto de resultados sem buffer.
|
||||
Enquanto houver registros pendentes esperando para serem buscados, a linha de
|
||||
conexão estará ocupada e todas as chamadas subseqüentes retornarão o erro
|
||||
<literal>Commands out of sync</literal>. Para evitar o erro, todos os registros
|
||||
devem ser buscados no servidor ou o conjunto de resultados deve ser descartado
|
||||
chamando <function>mysqli_free_result</function>.
|
||||
</para>
|
||||
<para>
|
||||
<constant>MYSQLI_ASYNC</constant> (disponível com mysqlnd) - a consulta é
|
||||
executada de forma assíncrona e nenhum conjunto de resultados é retornado imediatamente.
|
||||
<function>mysqli_poll</function> é então usado para obter resultados de tais
|
||||
consultas. Usado em combinação com a constante
|
||||
<constant>MYSQLI_STORE_RESULT</constant> ou
|
||||
<constant>MYSQLI_USE_RESULT</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna &false; em caso de falha. Para consultas bem-sucedidas que produzem um
|
||||
conjunto de resultados, como <literal>SELECT, SHOW, DESCRIBE</literal> ou
|
||||
<literal>EXPLAIN</literal>, <function>mysqli_query</function> retornará um objeto
|
||||
<classname>mysqli_result</classname>. Para outras consultas bem-sucedidas,
|
||||
<function>mysqli_query</function> retornará
|
||||
&true;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::query</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* Criar tabela não retorna um conjunto de resultados */
|
||||
$mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
printf("Tabela myCity criada com sucesso.\n");
|
||||
|
||||
/* Consultas selecionadas retornam um conjunto de resultados */
|
||||
$result = $mysqli->query("SELECT Name FROM City LIMIT 10");
|
||||
printf("Select retornou %d linhas.\n", $result->num_rows);
|
||||
|
||||
/* Se tivermos que recuperar uma grande quantidade de dados, usamos MYSQLI_USE_RESULT */
|
||||
$result = $mysqli->query("SELECT * FROM City", MYSQLI_USE_RESULT);
|
||||
|
||||
/* Observe que não podemos executar nenhuma função que interaja com o
|
||||
servidor até que todos os registros tenham sido totalmente recuperados ou o resultado
|
||||
conjunto foi fechado. Todas as chamadas retornarão um erro 'fora de sincronia'*/
|
||||
$mysqli->query("SET @a:='isso não vai funcionar'");
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
/* Criar tabela não retorna um conjunto de resultados */
|
||||
mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City");
|
||||
printf("Tabela myCity criada com sucesso.\n");
|
||||
|
||||
/* Select queries return a resultset */
|
||||
$result = mysqli_query($link, "SELECT Name FROM City LIMIT 10");
|
||||
printf("Select retornou %d linhas.\n", mysqli_num_rows($result));
|
||||
|
||||
/* Se tivermos que recuperar uma grande quantidade de dados, usamos MYSQLI_USE_RESULT */
|
||||
$result = mysqli_query($link, "SELECT * FROM City", MYSQLI_USE_RESULT);
|
||||
|
||||
* Observe que não podemos executar nenhuma função que interaja com o
|
||||
servidor até que todos os registros tenham sido totalmente recuperados ou o resultado
|
||||
conjunto foi fechado. Todas as chamadas retornarão um erro 'fora de sincronia'*/
|
||||
mysqli_query($link, "SET @a:='isso não vai funcionar'");
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Tabela myCity criada com sucesso.
|
||||
Select retornou 10 linhas.
|
||||
|
||||
Erro fatal: mysqli_sql_exception não capturado: Comandos fora de sincronia; você não pode executar este comando agora em ...
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_real_query</function></member>
|
||||
<member><function>mysqli_multi_query</function></member>
|
||||
<member><function>mysqli_prepare</function></member>
|
||||
<member><function>mysqli_free_result</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
|
||||
-->
|
||||
342
reference/mysqli/mysqli/real-connect.xml
Normal file
342
reference/mysqli/mysqli/real-connect.xml
Normal file
@@ -0,0 +1,342 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.real-connect" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::real_connect</refname>
|
||||
<refname>mysqli_real_connect</refname>
|
||||
<refpurpose>Abre uma conexão com um servidor mysql</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::real_connect</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>host</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>passwd</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>dbname</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>socket</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_real_connect</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>link</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>host</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>passwd</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>dbname</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>socket</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Estabeleça uma conexão com um mecanismo de banco de dados MySQL.
|
||||
</para>
|
||||
<para>
|
||||
Esta função difere de <function>mysqli_connect</function>:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<function>mysqli_real_connect</function> precisa de um objeto válido que
|
||||
deve ser criado pela função <function>mysqli_init</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Com a função <function>mysqli_options</function> você pode definir várias
|
||||
opções de conexão.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Existe um parâmetro <parameter>flags</parameter>.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>host</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Pode ser um nome de host ou um endereço IP. Passando o valor &null;
|
||||
ou a string "localhost" para este parâmetro, assume-se o host
|
||||
local. Quando possível, serão usados pipes em vez do
|
||||
protocolo TCP/IP.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>username</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O nome de usuário do MySQL.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>passwd</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Se for fornecido ou &null;, o servidor MySQL tentará autenticar
|
||||
o usuário somente com relação aos registros de usuário que não possuem senha. Isso
|
||||
permite que um nome de usuário seja usado com permissões diferentes (dependendo
|
||||
se uma senha foi fornecida ou não).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>dbname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Se fornecido, especificará o banco de dados padrão a ser usado ao
|
||||
realizar consultas.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>port</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Especifica o número da porta para tentar se conectar ao servidor MySQL.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>socket</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Especifica o soquete ou pipe nomeado que deve ser usado.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
A especificação do parâmetro <parameter>socket</parameter> não determinará
|
||||
explicitamente o tipo de conexão a ser usada ao
|
||||
conectar-se ao servidor MySQL. A forma como a conexão é feita com o
|
||||
banco de dados MySQL é determinada pelo parâmetro do
|
||||
<parameter>host</parameter>.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Com as <parameter>flags</parameter> de parâmetro, você pode definir diferentes
|
||||
opções de conexão:
|
||||
</para>
|
||||
<table xml:id="mysqli.real-connect.flags">
|
||||
<title>Supported flags</title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nome</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_COMPRESS</constant></entry>
|
||||
<entry>Usar protocolo de compressão</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_FOUND_ROWS</constant></entry>
|
||||
<entry>retorna o número de linhas correspondentes, não o número de linhas afetadas</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_IGNORE_SPACE</constant></entry>
|
||||
<entry>Permita espaços após os nomes das funções. Torna todos os nomes de função palavras reservadas.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_INTERACTIVE</constant></entry>
|
||||
<entry>
|
||||
Permita segundos de <literal>interactive_timeout</literal> (em vez de
|
||||
<literal>wait_timeout</literal> segundos) de inatividade antes de fechar a conexão
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_SSL</constant></entry>
|
||||
<entry>Usar SSL (criptografia)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT</constant></entry>
|
||||
<entry>
|
||||
Como <constant>MYSQLI_CLIENT_SSL</constant>, mas desabilita a validação do certificado
|
||||
SSL fornecido. Isso é apenas para instalações usando MySQL Native Driver e MySQL 5.6 ou posterior.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<note>
|
||||
<para>
|
||||
Por motivos de segurança, o sinalizador <constant>MULTI_STATEMENT</constant>
|
||||
não é suportado no PHP. Se você deseja executar várias consultas, use a
|
||||
função <function>mysqli_multi_query</function>.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::real_connect</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
if (!$mysqli) {
|
||||
die('mysqli_init failed');
|
||||
}
|
||||
|
||||
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
|
||||
die('A configuração MYSQLI_INIT_COMMAND falhou');
|
||||
}
|
||||
|
||||
if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
|
||||
die('A configuração MYSQLI_OPT_CONNECT_TIMEOUT falhou');
|
||||
}
|
||||
|
||||
if (!$mysqli->real_connect('localhost', 'my_user', 'my_password', 'my_db')) {
|
||||
die('Erro de conexão (' . mysqli_connect_errno() . ') '
|
||||
. mysqli_connect_error());
|
||||
}
|
||||
|
||||
echo 'Sucesso... ' . $mysqli->host_info . "\n";
|
||||
|
||||
$mysqli->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.oop; ao estender a classe mysqli</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class foo_mysqli extends mysqli {
|
||||
public function __construct($host, $user, $pass, $db) {
|
||||
parent::init();
|
||||
|
||||
if (!parent::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
|
||||
die('A configuração MYSQLI_INIT_COMMAND falhou');
|
||||
}
|
||||
|
||||
if (!parent::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
|
||||
die('A configuração MYSQLI_OPT_CONNECT_TIMEOUT falhou');
|
||||
}
|
||||
|
||||
if (!parent::real_connect($host, $user, $pass, $db)) {
|
||||
die('Erro de conexão (' . mysqli_connect_errno() . ') '
|
||||
. mysqli_connect_error());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db = new foo_mysqli('localhost', 'my_user', 'my_password', 'my_db');
|
||||
|
||||
echo 'Sucesso... ' . $db->host_info . "\n";
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$link = mysqli_init();
|
||||
if (!$link) {
|
||||
die('mysqli_init failed');
|
||||
}
|
||||
|
||||
if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
|
||||
die('A configuração MYSQLI_INIT_COMMAND falhou');
|
||||
}
|
||||
|
||||
if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
|
||||
die('A configuração MYSQLI_OPT_CONNECT_TIMEOUT falhou');
|
||||
}
|
||||
|
||||
if (!mysqli_real_connect($link, 'localhost', 'my_user', 'my_password', 'my_db')) {
|
||||
die('Erro de conexão (' . mysqli_connect_errno() . ') '
|
||||
. mysqli_connect_error());
|
||||
}
|
||||
|
||||
echo 'Sucesso... ' . mysqli_get_host_info($link) . "\n";
|
||||
|
||||
mysqli_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Sucesso... Informações do host MySQL: localhost via TCP/IP
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
&mysqli.charset.note;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_connect</function></member>
|
||||
<member><function>mysqli_init</function></member>
|
||||
<member><function>mysqli_options</function></member>
|
||||
<member><function>mysqli_ssl_set</function></member>
|
||||
<member><function>mysqli_close</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
|
||||
-->
|
||||
154
reference/mysqli/mysqli/real-escape-string.xml
Normal file
154
reference/mysqli/mysqli/real-escape-string.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.real-escape-string" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::real_escape_string</refname>
|
||||
<refname>mysqli_real_escape_string</refname>
|
||||
<refpurpose>Escape caracteres especiais em uma string para uso em uma instrução SQL, levando em consideração o conjunto de caracteres atual da conexão</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>string</type><methodname>mysqli::real_escape_string</methodname>
|
||||
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>mysqli_real_escape_string</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Esta função é usada para criar uma string SQL legal que você pode usar em uma
|
||||
instrução SQL. A string fornecida é codificada para produzir uma string SQL com escape,
|
||||
levando em consideração o conjunto de caracteres atual da conexão.
|
||||
</para>
|
||||
<caution>
|
||||
<title>Segurança: o conjunto de caracteres padrão</title>
|
||||
<para>
|
||||
O conjunto de caracteres deve ser definido no nível do servidor ou com a
|
||||
função API <function>mysqli_set_charset</function> para que afete
|
||||
<function>mysqli_real_escape_string</function>. Consulte a seção de
|
||||
conceitos sobre <link linkend="mysqlinfo.concepts.charset">conjuntos de caracteres</link>
|
||||
para obter mais informações.
|
||||
</para>
|
||||
</caution>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>string</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A string a ser escapada.
|
||||
</para>
|
||||
<para>
|
||||
Os caracteres codificados são <literal>NUL (ASCII 0), \n, \r, \, ', ", e
|
||||
Control-Z</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna uma string com escape.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><methodname>mysqli::real_escape_string</methodname> exemplo</title>
|
||||
<para>&style.oop;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
|
||||
|
||||
$city = "'s-Hertogenbosch";
|
||||
|
||||
/* esta consulta com escape $city funcionará */
|
||||
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'",
|
||||
$mysqli->real_escape_string($city));
|
||||
$result = $mysqli->query($query);
|
||||
printf("Select retornou %d linhas.\n", $result->num_rows);
|
||||
|
||||
/* esta consulta falhará, porque não escapamos de $city */
|
||||
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'", $city);
|
||||
$result = $mysqli->query($query);
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>&style.procedural;</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
|
||||
|
||||
$city = "'s-Hertogenbosch";
|
||||
|
||||
/* esta consulta com escape $city funcionará */
|
||||
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'",
|
||||
mysqli_real_escape_string($mysqli, $city));
|
||||
$result = mysqli_query($mysqli, $query);
|
||||
printf("Select retornou %d linhas.\n", mysqli_num_rows($result));
|
||||
|
||||
/* esta consulta falhará, porque não escapamos de $city*/
|
||||
$query = sprintf("SELECT CountryCode FROM City WHERE name='%s'", $city);
|
||||
$result = mysqli_query($mysqli, $query);
|
||||
]]>
|
||||
</programlisting>
|
||||
&examples.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Select retornou 1 linhas.
|
||||
|
||||
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's-Hertogenbosch'' at line 1 in...
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_set_charset</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
|
||||
-->
|
||||
90
reference/mysqli/mysqli/real-query.xml
Normal file
90
reference/mysqli/mysqli/real-query.xml
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.real-query" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::real_query</refname>
|
||||
<refname>mysqli_real_query</refname>
|
||||
<refpurpose>Executa uma consulta SQL</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::real_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_real_query</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Executa uma única consulta no banco de dados cujo resultado pode ser
|
||||
recuperado ou armazenado usando as funções <function>mysqli_store_result</function> ou
|
||||
<function>mysqli_use_result</function>.
|
||||
</para>
|
||||
<para>
|
||||
Para determinar se uma determinada consulta deve retornar um conjunto de resultados ou não,
|
||||
consulte <function>mysqli_field_count</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A string de consulta.
|
||||
</para>
|
||||
&mysqli.sqlinjection.warning;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_query</function></member>
|
||||
<member><function>mysqli_store_result</function></member>
|
||||
<member><function>mysqli_use_result</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
|
||||
-->
|
||||
80
reference/mysqli/mysqli/reap-async-query.xml
Normal file
80
reference/mysqli/mysqli/reap-async-query.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.reap-async-query" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli::reap_async_query</refname>
|
||||
<refname>mysqli_reap_async_query</refname>
|
||||
<refpurpose>Obtenha o resultado da consulta assíncrona</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli::reap_async_query</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type class="union"><type>mysqli_result</type><type>bool</type></type><methodname>mysqli_reap_async_query</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Obtenha o resultado da consulta assíncrona.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
&mysqli.available.mysqlnd;
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna &false; em caso de falha. Para consultas bem-sucedidas que produzem um conjunto de resultados, como <literal>SELECT, SHOW, DESCRIBE</literal>
|
||||
ou <literal>EXPLAIN</literal>, <function>mysqli_reap_async_query</function> retornará
|
||||
um objeto <classname>mysqli_result</classname>. Para outras consultas bem-sucedidas, <function>mysqli_reap_async_query</function>
|
||||
retornará &true;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_poll</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
|
||||
-->
|
||||
86
reference/mysqli/mysqli/refresh.xml
Normal file
86
reference/mysqli/mysqli/refresh.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.refresh" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli::refresh</refname>
|
||||
<refname>mysqli_refresh</refname>
|
||||
<refpurpose>Atualiza</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::refresh</methodname>
|
||||
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_refresh</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Libera tabelas ou caches ou redefine as informações do servidor de replicação.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
As opções para atualizar, usando as constantes MYSQLI_REFRESH_* conforme documentado
|
||||
na documentação das <link linkend="mysqli.constants">MySQLi constantes</link>.
|
||||
</para>
|
||||
<para>
|
||||
Veja também a documentação oficial do <link xlink:href="&url.mysql.docs.refresh;">MySQL
|
||||
Refresh</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; se a atualização foi bem-sucedida, caso contrário, &false;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_poll</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
|
||||
-->
|
||||
82
reference/mysqli/mysqli/release-savepoint.xml
Normal file
82
reference/mysqli/mysqli/release-savepoint.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.release-savepoint" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>mysqli::release_savepoint</refname>
|
||||
<refname>mysqli_release_savepoint</refname>
|
||||
<refpurpose>Remove o ponto de salvamento nomeado do conjunto de pontos de salvamento da transação atual</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::release_savepoint</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_release_savepoint</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Esta função é idêntica à execução de <code>$mysqli->query("RELEASE SAVEPOINT `$name`");</code>.
|
||||
Esta função não aciona commit ou rollback.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O identificador do ponto de salvamento.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_savepoint</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
|
||||
-->
|
||||
135
reference/mysqli/mysqli/rollback.xml
Normal file
135
reference/mysqli/mysqli/rollback.xml
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<refentry xml:id="mysqli.rollback" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>mysqli::rollback</refname>
|
||||
<refname>mysqli_rollback</refname>
|
||||
<refpurpose>Reverte a transação atual</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>&style.oop;</para>
|
||||
<methodsynopsis role="mysqli">
|
||||
<modifier>public</modifier> <type>bool</type><methodname>mysqli::rollback</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>&style.procedural;</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>mysqli_rollback</methodname>
|
||||
<methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>name</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Reverte a transação atual para o banco de dados.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
&mysqli.link.description;
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Uma máscara de bits das constantes <constant>MYSQLI_TRANS_COR_*</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Se fornecido, então <literal>ROLLBACK/*name*/</literal> é executado.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<para>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>8.0.0</entry>
|
||||
<entry>
|
||||
<parameter>name</parameter> agora é anulável.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
Veja o exemplo <link linkend="mysqli.begin-transaction.example.basic"><methodname>mysqli::begin_transaction</methodname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
Esta função não funciona com tipos de tabelas não transacionais (como MyISAM ou
|
||||
ISAM).
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>mysqli_begin_transaction</function></member>
|
||||
<member><function>mysqli_commit</function></member>
|
||||
<member><function>mysqli_autocommit</function></member>
|
||||
<member><function>mysqli_release_savepoint</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
|
||||
-->
|
||||
159
reference/mysqli/mysqli_driver.xml
Normal file
159
reference/mysqli/mysqli_driver.xml
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<phpdoc:classref xml:id="class.mysqli-driver" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>A classe mysqli_driver</title>
|
||||
<titleabbrev>mysqli_driver</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ ClassName intro -->
|
||||
<section xml:id="mysqli-driver.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
A classe <classname>mysqli_driver</classname> é uma instância do padrão monostate,
|
||||
ou seja, existe apenas um driver que pode ser acessado por meio de uma quantidade arbitrária
|
||||
de instâncias <classname>mysqli_driver</classname>.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="mysqli-driver.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass>
|
||||
<classname>mysqli_driver</classname>
|
||||
</ooclass>
|
||||
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<modifier>final</modifier>
|
||||
<classname>mysqli_driver</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
|
||||
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<modifier>readonly</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mysqli-driver.props.client-info">client_info</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<modifier>readonly</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mysqli-driver.props.client-version">client_version</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<modifier>readonly</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mysqli-driver.props.driver-version">driver_version</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<modifier>readonly</modifier>
|
||||
<type>bool</type>
|
||||
<varname linkend="mysqli-driver.props.embedded">embedded</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>bool</type>
|
||||
<varname linkend="mysqli-driver.props.reconnect">reconnect</varname>
|
||||
<initializer>false</initializer>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mysqli-driver.props.report-mode">report_mode</varname>
|
||||
</fieldsynopsis>
|
||||
|
||||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqli-driver')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='mysqli_driver'])" />
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
<!-- {{{ mysqli_driver properties -->
|
||||
<section xml:id="mysqli-driver.props">
|
||||
&reftitle.properties;
|
||||
<variablelist>
|
||||
<varlistentry xml:id="mysqli-driver.props.client-info">
|
||||
<term><varname>client_info</varname></term>
|
||||
<listitem>
|
||||
<para>A versão do cabeçalho da API do cliente</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-driver.props.client-version">
|
||||
<term><varname>client_version</varname></term>
|
||||
<listitem>
|
||||
<para>A versão do cliente</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-driver.props.driver-version">
|
||||
<term><varname>driver_version</varname></term>
|
||||
<listitem>
|
||||
<para>A versão do driver MySQLi</para>
|
||||
<warning><simpara>Esta propriedade
|
||||
foi <emphasis>depreciada</emphasis> a partir do PHP 8.1.0. Confiar nesta
|
||||
propriedade é altamente desencorajado.</simpara></warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-driver.props.embedded">
|
||||
<term><varname>embedded</varname></term>
|
||||
<listitem>
|
||||
<para>Se o suporte MySQLi Embedded está ativado</para>
|
||||
<warning><simpara>Esta propriedade
|
||||
foi <emphasis>removed</emphasis> a partir do PHP 8.0.0.</simpara></warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-driver.props.reconnect">
|
||||
<term><varname>reconnect</varname></term>
|
||||
<listitem>
|
||||
<para>Permitir ou impedir a reconexão (consulte a diretiva mysqli.reconnect INI)</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-driver.props.report-mode">
|
||||
<term><varname>report_mode</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Defina como <constant>MYSQLI_REPORT_OFF</constant>,
|
||||
<constant>MYSQLI_REPORT_ALL</constant> ou qualquer combinação de
|
||||
<constant>MYSQLI_REPORT_STRICT</constant> (lança exceções para erros),
|
||||
<constant>MYSQLI_REPORT_ERROR</constant> (reporta erros) e
|
||||
<constant>MYSQLI_REPORT_INDEX</constant> (erros relacionados a índices).
|
||||
Veja também <function>mysqli_report</function>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.mysqli.entities.mysqli-driver;
|
||||
|
||||
</phpdoc:classref>
|
||||
<!-- 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
|
||||
-->
|
||||
102
reference/mysqli/mysqli_sql_exception.xml
Normal file
102
reference/mysqli/mysqli_sql_exception.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 3fc56d76de1007a3c4f60b143c60c071f32546fb Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<phpdoc:classref xml:id="class.mysqli-sql-exception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>A classe mysqli_sql_exception</title>
|
||||
<titleabbrev>mysqli_sql_exception</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<section xml:id="mysqli-sql-exception.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
A classe de manipulação de exceção mysqli.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="mysqli-sql-exception.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
<classsynopsis>
|
||||
<ooclass>
|
||||
<classname>mysqli_sql_exception</classname>
|
||||
</ooclass>
|
||||
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<modifier>final</modifier>
|
||||
<classname>mysqli_sql_exception</classname>
|
||||
</ooclass>
|
||||
|
||||
<ooclass>
|
||||
<modifier>extends</modifier>
|
||||
<classname>RuntimeException</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
|
||||
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>protected</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mysqli-sql-exception.props.sqlstate">sqlstate</varname>
|
||||
<initializer>"00000"</initializer>
|
||||
</fieldsynopsis>
|
||||
|
||||
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:partintro/db:section/db:classsynopsis/db:fieldsynopsis[preceding-sibling::db:classsynopsisinfo[1][@role='comment' and text()='&Properties;']]))">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
|
||||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqli-sql-exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='mysqli_sql_exception'])">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
|
||||
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='Exception'])">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.exception')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='Exception'])">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
</classsynopsis>
|
||||
</section>
|
||||
|
||||
<section xml:id="mysqli-sql-exception.props">
|
||||
&reftitle.properties;
|
||||
<variablelist>
|
||||
<varlistentry xml:id="mysqli-sql-exception.props.sqlstate">
|
||||
<term><varname>sqlstate</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O estado sql com o erro.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.mysqli.entities.mysqli-sql-exception;
|
||||
|
||||
</phpdoc:classref>
|
||||
<!-- 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
|
||||
-->
|
||||
115
reference/mysqli/mysqli_warning.xml
Normal file
115
reference/mysqli/mysqli_warning.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 035c126c0393fe154bac46e2c3c489ebadce48a5 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<phpdoc:classref xml:id="class.mysqli-warning" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>A classe mysqli_warning</title>
|
||||
<titleabbrev>mysqli_warning</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ ClassName intro -->
|
||||
<section xml:id="mysqli-warning.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
Representa um aviso do MySQL.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="mysqli-warning.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass>
|
||||
<classname>mysqli_warning</classname>
|
||||
</ooclass>
|
||||
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<modifier>final</modifier>
|
||||
<classname>mysqli_warning</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
|
||||
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mysqli-warning.props.message">message</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="mysqli-warning.props.sqlstate">sqlstate</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>public</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="mysqli-warning.props.errno">errno</varname>
|
||||
</fieldsynopsis>
|
||||
|
||||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqli-warning')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='mysqli_warning'])">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mysqli-warning')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='mysqli_warning'])">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<!-- {{{ mysqli_warning properties -->
|
||||
<section xml:id="mysqli-warning.props">
|
||||
&reftitle.properties;
|
||||
<variablelist>
|
||||
<varlistentry xml:id="mysqli-warning.props.message">
|
||||
<term><varname>message</varname></term>
|
||||
<listitem>
|
||||
<para>string da Mensagem</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-warning.props.sqlstate">
|
||||
<term><varname>sqlstate</varname></term>
|
||||
<listitem>
|
||||
<para>Estado SQL</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="mysqli-warning.props.errno">
|
||||
<term><varname>errno</varname></term>
|
||||
<listitem>
|
||||
<para>Número do erro</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
</partintro>
|
||||
|
||||
&reference.mysqli.entities.mysqli-warning;
|
||||
|
||||
</phpdoc:classref>
|
||||
<!-- 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
|
||||
-->
|
||||
53
reference/mysqli/notes.xml
Normal file
53
reference/mysqli/notes.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: cd09fab47b40563cb8b2316d817efc973d991713 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<chapter xml:id="mysqli.notes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Notes</title>
|
||||
|
||||
<para>Algumas notas de implementação:</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Foi adicionado suporte para <literal>MYSQL_TYPE_GEOMETRY</literal>
|
||||
à extensão MySQLi no PHP 5.3.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Observe que existem diferentes implementações internas em
|
||||
<literal>libmysqlclient</literal> e <literal>mysqlnd</literal> para lidar
|
||||
com colunas do tipo <literal>MYSQL_TYPE_GEOMETRY</literal>. De um modo geral,
|
||||
o <literal>mysqlnd</literal> irá alocar significativamente menos memória. Por
|
||||
exemplo, se houver uma coluna <literal>POINT</literal>
|
||||
em um conjunto de resultados, <literal>libmysqlclient</literal> pode pré-alocar até
|
||||
4 GB de RAM, embora sejam necessários menos de 50 bytes para
|
||||
manter uma coluna <literal>POINT</literal> na memória. A alocação de
|
||||
memória é muito menor, menos de 50 bytes, se estiver
|
||||
usando <literal>mysqlnd</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
410
reference/mysqli/overview.xml
Normal file
410
reference/mysqli/overview.xml
Normal file
@@ -0,0 +1,410 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 40667918dcff1d5c9f7ecdc88b5caca24ba0686c Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<chapter xml:id="mysqli.overview" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Overview</title>
|
||||
|
||||
<para>
|
||||
Esta seção fornece uma introdução às opções disponíveis ao desenvolver
|
||||
um aplicativo PHP que precisa interagir com um banco de
|
||||
dados MySQL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">O que é uma API?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Uma interface de programação de aplicativos, ou API, define as classes,
|
||||
métodos, funções e variáveis que seu aplicativo precisará chamar
|
||||
para executar a tarefa desejada. No caso de aplicativos PHP
|
||||
que precisam se comunicar com bancos de dados,
|
||||
as APIs necessárias geralmente são expostas por meio de extensões PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As APIs podem ser processuais ou orientadas a objetos. Com uma API procedural, você
|
||||
chama funções para realizar tarefas, com a API orientada a objetos você
|
||||
instancia classes e então chama métodos nos objetos resultantes.
|
||||
Das duas, a última costuma ser a interface preferida, pois é
|
||||
mais moderna e leva a um código mais organizado.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Ao escrever aplicativos PHP que precisam se conectar ao servidor MySQL,
|
||||
existem várias opções de API disponíveis. Este documento discute
|
||||
o que está disponível e como selecionar a melhor solução
|
||||
para sua aplicação.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">O que é um Conector?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Na documentação do MySQL, o termo <emphasis>conector</emphasis>
|
||||
refere-se a um software que permite que seu aplicativo
|
||||
se conecte ao servidor de banco de dados MySQL. MySQL fornece conectores
|
||||
para uma variedade de linguagens, incluindo PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Se seu aplicativo PHP precisar se comunicar com um servidor de banco de dados,
|
||||
você precisará escrever código PHP para executar atividades como
|
||||
conectar-se ao servidor de banco de dados, consultar o banco de dados e outras
|
||||
funções relacionadas ao banco de dados. O software é necessário para fornecer a API
|
||||
que seu aplicativo PHP usará e também para lidar com a comunicação entre seu aplicativo
|
||||
e o servidor de banco de dados, possivelmente usando outras bibliotecas intermediárias
|
||||
quando necessário. Este software é conhecido genericamente como conector,
|
||||
pois permite que sua aplicação se <emphasis>connect</emphasis>
|
||||
a um servidor de banco de dados.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">O que é um Driver?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Um driver é um software projetado para se comunicar com um tipo
|
||||
específico de servidor de banco de dados. O driver também pode chamar
|
||||
uma biblioteca, como a MySQL Client Library ou o MySQL Native
|
||||
Driver. Essas bibliotecas implementam o protocolo de baixo nível usado
|
||||
para se comunicar com o servidor de banco de dados MySQL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A título de exemplo, a camada de abstração do banco de dados <link linkend="mysqli.overview.pdo">PHP
|
||||
Data Objects (PDO)</link> pode usar um dos vários drivers específicos do
|
||||
banco de dados. Um dos drivers disponíveis
|
||||
é o driver PDO MYSQL, que permite a interface
|
||||
com o servidor MySQL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Às vezes, as pessoas usam os termos conector e driver de forma intercambiável,
|
||||
o que pode ser confuso. Na documentação relacionada ao MySQL, o termo
|
||||
<quote>driver</quote> é reservado para software que fornece a parte específica
|
||||
do banco de dados de um pacote de conector.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">What is an Extension?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Na documentação do PHP, você encontrará outro termo -
|
||||
<emphasis>extension</emphasis>. O código PHP consiste em um núcleo,
|
||||
com extensões opcionais para a funcionalidade principal. As extensões
|
||||
relacionadas ao MySQL do PHP, como a extensão mysqli e a
|
||||
extensão do driver PDO MySQL, são
|
||||
implementadas usando a estrutura de extensão do PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Uma extensão normalmente expõe uma API ao programador PHP, para
|
||||
permitir que suas facilidades sejam usadas programaticamente. No entanto,
|
||||
algumas extensões que usam a estrutura de extensão PHP não expõem uma
|
||||
API ao programador PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A extensão do driver PDO MySQL, por exemplo, não expõe uma API ao
|
||||
programador PHP, mas fornece uma interface para a camada
|
||||
PDO acima dela.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Os termos API e extensão não devem significar a mesma coisa,
|
||||
pois uma extensão pode não necessariamente expor uma API
|
||||
ao programador.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">Quais são as principais ofertas de API do PHP para usar o
|
||||
MySQL?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Existem duas opções principais de API ao considerar a conexão com um
|
||||
servidor de banco de dados MySQL:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Extensão mysqli do PHP
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Objetos de Dados PHP (PDO)
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Cada um tem suas próprias vantagens e desvantagens. A discussão a
|
||||
seguir visa fornecer uma breve introdução aos principais aspectos de
|
||||
cada API.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">O que é a extensão mysqli do PHP?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A extensão <literal>mysqli</literal>, ou como às vezes é
|
||||
conhecida, a extensão <emphasis>improved</emphasis> do MySQL, foi desenvolvida
|
||||
para aproveitar os novos recursos encontrados nos
|
||||
sistemas MySQL versões 4.1.3 e mais recentes. A extensão <literal>mysqli</literal>
|
||||
está incluída nas versões 5 e posteriores do PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A extensão <literal>mysqli</literal> tem vários benefícios,
|
||||
sendo os principais aprimoramentos sobre a
|
||||
extensão <literal>mysql</literal>:
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Interface orientada a objetos
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Suporte para Declarações Preparadas
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Suporte para várias declarações
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Suporte para transações
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Recursos de depuração aprimorados
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Assim como a interface orientada a objetos, a extensão também fornece uma
|
||||
interface processual.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A extensão <literal>mysqli</literal> é construída usando a e
|
||||
strutura de extensão PHP, seu código fonte está localizado no diretório
|
||||
<filename>ext/mysqli</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Para obter mais informações sobre a extensão <literal>mysqli</literal>,
|
||||
consulte <xref linkend="book.mysqli"/>.
|
||||
</para>
|
||||
|
||||
<para xml:id="mysqli.overview.pdo">
|
||||
<emphasis role="bold">O que é PDO?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PHP Data Objects, ou PDO, é uma camada de abstração
|
||||
de banco de dados especificamente para aplicativos PHP. O PDO fornece uma API consistente
|
||||
para seu aplicativo PHP, independentemente do tipo de servidor de
|
||||
banco de dados ao qual seu aplicativo se conectará. Em teoria, se você estiver usando a
|
||||
API PDO, você pode mudar o servidor de banco de dados que você usou, digamos
|
||||
Firebird para MySQL, e só precisa fazer pequenas alterações em seu
|
||||
código PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Outros exemplos de camadas de abstração de banco de dados incluem JDBC para
|
||||
aplicativos Java e DBI para Perl.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Embora o PDO tenha suas vantagens, como uma API limpa, simples e portátil,
|
||||
sua principal desvantagem é que ele não permite que você use todos os
|
||||
recursos avançados disponíveis nas versões mais recentes do
|
||||
servidor MySQL. Por exemplo, PDO não permite que você use o suporte do MySQL
|
||||
para Multiple Statements.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PDO é implementado usando o framework de extensão PHP, seu código
|
||||
fonte está localizado no diretório <filename>ext/pdo</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Para mais informações sobre PDO, consulte o
|
||||
<xref linkend="book.pdo"/>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">O que é o driver PDO MYSQL?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O driver PDO MYSQL não é uma API como tal, pelo menos da
|
||||
perspectiva do programador PHP. Na verdade, o driver PDO MYSQL fica na
|
||||
camada abaixo do próprio PDO e fornece funcionalidade específica do MySQL.
|
||||
O programador ainda chama a API PDO, mas o PDO usa o driver PDO MYSQL
|
||||
para realizar a comunicação com o servidor MySQL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O driver PDO MYSQL é um dos vários drivers PDO disponíveis. Outros
|
||||
drivers PDO disponíveis incluem aqueles para os servidores de banco de dados
|
||||
Firebird e PostgreSQL.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O driver PDO MYSQL é implementado usando a estrutura de
|
||||
extensão PHP. Seu código-fonte está localizado no diretório
|
||||
<filename>ext/pdo_mysql</filename>. Ele não expõe uma API ao
|
||||
programador PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Para obter mais informações sobre o driver PDO MYSQL, consulte
|
||||
<xref linkend="ref.pdo-mysql"/>.
|
||||
</para>
|
||||
|
||||
<para xml:id="mysqli.overview.mysqlnd">
|
||||
<emphasis role="bold">O que é o driver nativo MySQL do PHP?</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Para se comunicar com o servidor de banco de dados MySQL, <literal>mysqli</literal> e
|
||||
o driver PDO MYSQL usam uma biblioteca de baixo nível que implementa
|
||||
o protocolo necessário. No passado, a única biblioteca disponível era a
|
||||
MySQL Client Library, também conhecida como
|
||||
<literal>libmysqlclient</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
No entanto, a interface apresentada pelo <literal>libmysqlclient</literal> não
|
||||
foi otimizada para comunicação com aplicativos PHP, pois
|
||||
<literal>libmysqlclient</literal> foi originalmente projetado com
|
||||
aplicativos C em mente. Por esta razão, o MySQL Native Driver,
|
||||
<literal>mysqlnd</literal>, foi desenvolvido como uma alternativa ao
|
||||
<literal>libmysqlclient</literal> para aplicações PHP.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Tanto a extensão <literal>mysqli</literal> quanto o driver PDO MySQL podem
|
||||
ser configurados individualmente para usar
|
||||
<literal>libmysqlclient</literal>ou <literal>mysqlnd</literal>. Como o
|
||||
<literal>mysqlnd</literal> foi projetado especificamente para ser utilizado
|
||||
no sistema PHP, ele possui vários aprimoramentos de memória e velocidade em relação ao
|
||||
<literal>libmysqlclient</literal>. Você é fortemente encorajado a
|
||||
aproveitar essas melhorias.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O MySQL Native Driver é implementado usando a estrutura de
|
||||
extensão PHP. O código-fonte está localizado em
|
||||
<filename>ext/mysqlnd</filename>. Ele não expõe uma API ao
|
||||
programador PHP.
|
||||
</para>
|
||||
|
||||
<!-- TODO
|
||||
<para>
|
||||
For further information on the MySQL Native Driver, see
|
||||
<xref linkend="book.mysqlnd"/>.
|
||||
</para>
|
||||
-->
|
||||
|
||||
<para>
|
||||
<emphasis role="bold">Comparação de recursos</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A tabela a seguir compara a funcionalidade dos principais
|
||||
métodos de conexão ao MySQL a partir do PHP:
|
||||
</para>
|
||||
|
||||
<table xml:id="mysqli.overview.option.comparison">
|
||||
<title>Comparação das opções da API do MySQL para PHP</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colwidth="34*"/>
|
||||
<colspec colwidth="33*"/>
|
||||
<colspec colwidth="33*"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry></entry>
|
||||
<entry>Extensão mysqli do PHP</entry>
|
||||
<entry>PDO (usando PDO MySQL Driver e MySQL Native Driver)</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Versão do PHP introduzida</entry>
|
||||
<entry>5.0</entry>
|
||||
<entry>5.0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Status de desenvolvimento do MySQL</entry>
|
||||
<entry>Desenvolvimento ativo</entry>
|
||||
<entry>Desenvolvimento ativo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>API suporta conjuntos de caracteres</entry>
|
||||
<entry>Sim</entry>
|
||||
<entry>Sim</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>A API oferece suporte a instruções preparadas do lado do servidor</entry>
|
||||
<entry>Sim</entry>
|
||||
<entry>Sim</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>A API oferece suporte a declarações preparadas do lado do cliente</entry>
|
||||
<entry>Não</entry>
|
||||
<entry>Sim</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>API suporta procedimentos armazenados</entry>
|
||||
<entry>Sim</entry>
|
||||
<entry>Sim</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>A API oferece suporte a várias instruções</entry>
|
||||
<entry>Sim</entry>
|
||||
<entry>A maioria</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Suporta todas as funcionalidades do MySQL 4.1+</entry>
|
||||
<entry>Sim</entry>
|
||||
<entry>A maioria</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<!--
|
||||
<para>
|
||||
<emphasis role="bold">Further information</emphasis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The PHP distribution and documentation are available from the
|
||||
<link xlink:href="http://www.php.net/">PHP Web site</link>.
|
||||
</para>
|
||||
-->
|
||||
</chapter>
|
||||
141
reference/mysqli/persistconns.xml
Normal file
141
reference/mysqli/persistconns.xml
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: a714378ed87cdbdbde3b10ded183e8df7b243cb4 Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<chapter xml:id="mysqli.persistconns" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>A extensão mysqli e conexões persistentes</title>
|
||||
|
||||
<para>
|
||||
A ideia por trás das conexões persistentes é
|
||||
que uma conexão entre um processo cliente e um banco de dados pode ser
|
||||
reutilizada por um processo cliente, em vez de ser criada e destruída
|
||||
várias vezes. Isso reduz a sobrecarga de criar novas conexões
|
||||
sempre que uma é necessária, pois as conexões não utilizadas
|
||||
são armazenadas em cache e estão prontas para serem reutilizadas.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Ao contrário da extensão mysql, mysqli não fornece uma função separada
|
||||
para abrir conexões persistentes. Para abrir uma conexão persistente,
|
||||
você deve preceder <literal>p:</literal> ao nome do host ao conectar.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O problema com conexões persistentes é que elas podem ser deixadas em
|
||||
estados imprevisíveis pelos clientes. Por exemplo, um bloqueio de tabela
|
||||
pode ser ativado antes que um cliente seja encerrado inesperadamente. Um novo
|
||||
processo cliente reutilizando essa conexão persistente obterá a conexão
|
||||
<quote>como está</quote>. Qualquer limpeza precisaria ser feita pelo novo
|
||||
processo cliente antes que ele pudesse fazer bom uso da conexão ]
|
||||
persistente, aumentando a carga do programador.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A conexão persistente da extensão <literal>mysqli</literal>,
|
||||
no entanto, fornece código de manipulação de limpeza integrado. A limpeza
|
||||
realizada pelo <literal>mysqli</literal> inclui:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Reverter transações ativas
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Fechar e descartar tabelas temporárias
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Desbloquear tabelas
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Redefinir variáveis de sessão
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Fechar declarações preparadas (sempre acontece com PHP)
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Fechar manipulador
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Liberar bloqueios adquiridos com <function>GET_LOCK</function>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Isso garante que as conexões persistentes estejam em um estado limpo ao
|
||||
retornar do pool de conexões, antes que o processo do cliente as use.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A extensão <literal>mysqli</literal> faz essa limpeza
|
||||
chamando automaticamente a função C-API
|
||||
<literal>mysql_change_user()</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
O recurso de limpeza automática tem vantagens e desvantagens.
|
||||
A vantagem é que o programador não precisa mais se preocupar em
|
||||
adicionar código de limpeza, pois ele é chamado automaticamente. No entanto, a
|
||||
desvantagem é que o código pode ser um <emphasis>pouco</emphasis>
|
||||
mais lento, pois o código para executar a limpeza precisa ser executado
|
||||
sempre que uma conexão é retornada do pool de conexões.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
É possível desligar o código de limpeza automática, compilando o
|
||||
PHP com
|
||||
|
||||
<constant>MYSQLI_NO_CHANGE_USER_ON_PCONNECT</constant>
|
||||
|
||||
definido.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
A extensão <literal>mysqli</literal> suporta conexões
|
||||
persistentes ao usar MySQL Native Driver ou MySQL Client
|
||||
Library.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</chapter>
|
||||
<!-- 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
|
||||
-->
|
||||
737
reference/mysqli/summary.xml
Normal file
737
reference/mysqli/summary.xml
Normal file
@@ -0,0 +1,737 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4e8c90ca8a4a63575341cde6f5fbdc34419d2cff Maintainer: marcosmarcolin Status: ready --><!-- CREDITS: marcosmarcolin -->
|
||||
<chapter xml:id="mysqli.summary" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Resumo da Função de Extensão do MySQLi</title>
|
||||
|
||||
<table xml:id="mysqli.summary.classtable">
|
||||
<title>Resumo dos métodos <classname>mysqli</classname></title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Classe mysqli</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Interface POO</entry>
|
||||
<entry>Interface Procedural</entry>
|
||||
<entry>Alias (não use)</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Propriedades</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.affected-rows">$mysqli::affected_rows</link></entry>
|
||||
<entry><function>mysqli_affected_rows</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém o número de linhas afetadas em uma operação MySQL anterior</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-client-info">$mysqli::client_info</link></entry>
|
||||
<entry><function>mysqli_get_client_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a versão do cliente MySQL como uma string</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-client-version">$mysqli::client_version</link></entry>
|
||||
<entry><function>mysqli_get_client_version</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna as informações da versão do cliente MySQL como um número inteiro</entry> </row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.connect-errno">$mysqli::connect_errno</link></entry>
|
||||
<entry><function>mysqli_connect_errno</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o código de erro da última chamada de conexão</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.connect-error">$mysqli::connect_error</link></entry>
|
||||
<entry><function>mysqli_connect_error</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma descrição de string do último erro de conexão</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.errno">$mysqli::errno</link></entry>
|
||||
<entry><function>mysqli_errno</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o código de erro da chamada de função mais recente</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.error">$mysqli::error</link></entry>
|
||||
<entry><function>mysqli_error</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma descrição de string do último erro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.field-count">$mysqli::field_count</link></entry>
|
||||
<entry><function>mysqli_field_count</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número de colunas da consulta mais recente</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-host-info">$mysqli::host_info</link></entry>
|
||||
<entry><function>mysqli_get_host_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma string representando o tipo de conexão usada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-proto-info">$mysqli::protocol_version</link></entry>
|
||||
<entry><function>mysqli_get_proto_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a versão do protocolo MySQL usado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-server-info">$mysqli::server_info</link></entry>
|
||||
<entry><function>mysqli_get_server_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a versão do servidor MySQL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.get-server-version">$mysqli::server_version</link></entry>
|
||||
<entry><function>mysqli_get_server_version</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a versão do servidor MySQL como um inteiro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.info">$mysqli::info</link></entry>
|
||||
<entry><function>mysqli_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Recupera informações sobre a consulta executada mais recentemente</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.insert-id">$mysqli::insert_id</link></entry>
|
||||
<entry><function>mysqli_insert_id</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o id gerado automaticamente usado na última consulta</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.sqlstate">$mysqli::sqlstate</link></entry>
|
||||
<entry><function>mysqli_sqlstate</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o erro SQLSTATE da operação MySQL anterior</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli.warning-count">$mysqli::warning_count</link></entry>
|
||||
<entry><function>mysqli_warning_count</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número de avisos da última consulta para o link fornecido</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Métodos</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::autocommit</methodname></entry>
|
||||
<entry><function>mysqli_autocommit</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Ativa ou desativa modificações de banco de dados de confirmação automática</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::change_user</methodname></entry>
|
||||
<entry><function>mysqli_change_user</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Altera o usuário da conexão de banco de dados especificada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::character_set_name</methodname></entry>
|
||||
<entry><function>mysqli_character_set_name</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o conjunto de caracteres padrão para a conexão do banco de dados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::close</methodname></entry>
|
||||
<entry><function>mysqli_close</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Fecha uma conexão de banco de dados aberta anteriormente</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::commit</methodname></entry>
|
||||
<entry><function>mysqli_commit</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Confirma a transação atual</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::__construct</methodname></entry>
|
||||
<entry><function>mysqli_connect</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Abra uma nova conexão com o servidor MySQL [Nota: método estático (ou seja,
|
||||
classe)]</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::debug</methodname></entry>
|
||||
<entry><function>mysqli_debug</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Executa operações de depuração</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::dump_debug_info</methodname></entry>
|
||||
<entry><function>mysqli_dump_debug_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Despejar informações de depuração no log</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::get_charset</methodname></entry>
|
||||
<entry><function>mysqli_get_charset</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna um objeto de conjunto de caracteres</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::get_connection_stats</methodname></entry>
|
||||
<entry><function>mysqli_get_connection_stats</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna estatísticas de conexão do cliente. &mysqli.available.mysqlnd;</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::get_client_info</methodname></entry>
|
||||
<entry><function>mysqli_get_client_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a versão do cliente MySQL como uma string</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>N/A</entry>
|
||||
<entry><function>mysqli_get_client_stats</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna as estatísticas do cliente por processo. &mysqli.available.mysqlnd;</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::get_server_info</methodname></entry>
|
||||
<entry><function>mysqli_get_server_info</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma string representando a versão do servidor MySQL ao qual a extensão MySQLi está conectada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::get_warnings</methodname></entry>
|
||||
<entry><function>mysqli_get_warnings</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>NÃO DOCUMENTADO</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::init</methodname></entry>
|
||||
<entry><function>mysqli_init</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Inicializa o MySQLi e retorna um objeto para uso com
|
||||
mysqli_real_connect.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::kill</methodname></entry>
|
||||
<entry><function>mysqli_kill</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Pede ao servidor para matar um encadeamento do MySQL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::more_results</methodname></entry>
|
||||
<entry><function>mysqli_more_results</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Verifica se há mais resultados de consulta de uma consulta múltipla</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::multi_query</methodname></entry>
|
||||
<entry><function>mysqli_multi_query</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Executa uma consulta no banco de dados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::next_result</methodname></entry>
|
||||
<entry><function>mysqli_next_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Prepara o próximo resultado da multi_query</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::options</methodname></entry>
|
||||
<entry><function>mysqli_options</function></entry>
|
||||
<entry><function>mysqli_set_opt</function></entry>
|
||||
<entry>Define opções</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::ping</methodname></entry>
|
||||
<entry><function>mysqli_ping</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Faz ping em uma conexão de servidor ou tenta reconectar se a
|
||||
conexão cair</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::prepare</methodname></entry>
|
||||
<entry><function>mysqli_prepare</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Prepara uma instrução SQL para execução</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::query</methodname></entry>
|
||||
<entry><function>mysqli_query</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Executa uma consulta no banco de dados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::real_connect</methodname></entry>
|
||||
<entry><function>mysqli_real_connect</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Abre uma conexão com um servidor mysql</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::real_escape_string</methodname>,
|
||||
<methodname>mysqli::escape_string</methodname></entry>
|
||||
<entry><function>mysqli_real_escape_string</function></entry>
|
||||
<entry><function>mysqli_escape_string</function></entry>
|
||||
<entry>Escapa caracteres especiais em uma string para uso em uma instrução SQL,
|
||||
levando em consideração o conjunto de caracteres atual da conexão</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::real_query</methodname></entry>
|
||||
<entry><function>mysqli_real_query</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Executa uma consulta SQL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::refresh</methodname></entry>
|
||||
<entry><function>mysqli_refresh</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Libera tabelas ou caches ou redefine as informações do servidor de replicação</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::rollback</methodname></entry>
|
||||
<entry><function>mysqli_rollback</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Reverte a transação atual</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::select_db</methodname></entry>
|
||||
<entry><function>mysqli_select_db</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Seleciona o banco de dados padrão para consultas de banco de dados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::set_charset</methodname></entry>
|
||||
<entry><function>mysqli_set_charset</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Define o conjunto de caracteres do cliente padrão</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::ssl_set</methodname></entry>
|
||||
<entry><function>mysqli_ssl_set</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Usado para estabelecer conexões seguras usando SSL</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::stat</methodname></entry>
|
||||
<entry><function>mysqli_stat</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém o status atual do sistema</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::stmt_init</methodname></entry>
|
||||
<entry><function>mysqli_stmt_init</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Inicializa uma instrução e retorna um objeto para uso com
|
||||
mysqli_stmt_prepare</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::store_result</methodname></entry>
|
||||
<entry><function>mysqli_store_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Transfere um conjunto de resultados da última consulta</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::thread_id</methodname></entry>
|
||||
<entry><function>mysqli_thread_id</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o ID do thread para a conexão atual</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::thread_safe</methodname></entry>
|
||||
<entry><function>mysqli_thread_safe</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna se a segurança de thread é dada ou não</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli::use_result</methodname></entry>
|
||||
<entry><function>mysqli_use_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Inicia uma recuperação de conjunto de resultados</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table xml:id="mysqli.summary.methods">
|
||||
<title>Resumo dos métodos <classname>mysqli_stmt</classname></title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>MySQL_STMT</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Interface POO</entry>
|
||||
<entry>Interface Procedural</entry>
|
||||
<entry>Alias (não use)</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Propriedades</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.affected-rows">$mysqli_stmt::affected_rows</link></entry>
|
||||
<entry><function>mysqli_stmt_affected_rows</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número total de linhas alteradas, excluídas ou inseridas pela
|
||||
última instrução executada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.errno">$mysqli_stmt::errno</link></entry>
|
||||
<entry><function>mysqli_stmt_errno</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o código de erro para a chamada de instrução mais recente</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.error">$mysqli_stmt::error</link></entry>
|
||||
<entry><function>mysqli_stmt_error</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma descrição de string para o último erro de instrução</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.field-count">$mysqli_stmt::field_count</link></entry>
|
||||
<entry><function>mysqli_stmt_field_count</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número do campo na instrução fornecida - não documentado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.insert-id">$mysqli_stmt::insert_id</link></entry>
|
||||
<entry><function>mysqli_stmt_insert_id</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtenha o ID gerado da operação INSERT anterior</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.num-rows">$mysqli_stmt::num_rows</link></entry>
|
||||
<entry><function>mysqli_stmt_num_rows</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número de linhas no conjunto de resultados de instruções</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.param-count">$mysqli_stmt::param_count</link></entry>
|
||||
<entry><function>mysqli_stmt_param_count</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o número do parâmetro para a instrução fornecida</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-stmt.sqlstate">$mysqli_stmt::sqlstate</link></entry>
|
||||
<entry><function>mysqli_stmt_sqlstate</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o erro SQLSTATE da operação de instrução anterior</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Métodos</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::attr_get</methodname></entry>
|
||||
<entry><function>mysqli_stmt_attr_get</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Usado para obter o valor atual de um atributo de instrução</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::attr_set</methodname></entry>
|
||||
<entry><function>mysqli_stmt_attr_set</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Usado para modificar o comportamento de uma instrução preparada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::bind_param</methodname></entry>
|
||||
<entry><function>mysqli_stmt_bind_param</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Vincula variáveis a uma instrução preparada como parâmetros</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::bind_result</methodname></entry>
|
||||
<entry><function>mysqli_stmt_bind_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Vincula variáveis a uma instrução preparada para armazenamento de resultados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::close</methodname></entry>
|
||||
<entry><function>mysqli_stmt_close</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Fecha uma instrução preparada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::data_seek</methodname></entry>
|
||||
<entry><function>mysqli_stmt_data_seek</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Procura uma linha arbitrária no conjunto de resultados da instrução</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::execute</methodname></entry>
|
||||
<entry><function>mysqli_stmt_execute</function></entry>
|
||||
<entry><function>mysqli_execute</function></entry>
|
||||
<entry>Executa uma consulta preparada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::fetch</methodname></entry>
|
||||
<entry><function>mysqli_stmt_fetch</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Busca resultados de uma instrução preparada nas variáveis vinculadas</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::free_result</methodname></entry>
|
||||
<entry><function>mysqli_stmt_free_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Libera a memória de resultado armazenada para o identificador de instrução fornecido</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::get_result</methodname></entry>
|
||||
<entry><function>mysqli_stmt_get_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém um conjunto de resultados de uma instrução preparada. &mysqli.available.mysqlnd;</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::get_warnings</methodname></entry>
|
||||
<entry><function>mysqli_stmt_get_warnings</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>NÃO DOCUMENTADO</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::more_results</methodname></entry>
|
||||
<entry><function>mysqli_stmt_more_results</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Verifica se há mais resultados de consulta de uma consulta múltipla</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::next_result</methodname></entry>
|
||||
<entry><function>mysqli_stmt_next_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Lê o próximo resultado de uma consulta múltipla</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::num_rows</methodname></entry>
|
||||
<entry><function>mysqli_stmt_num_rows</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Veja também a propriedade <link linkend="mysqli-stmt.num-rows">$mysqli_stmt::num_rows</link></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::prepare</methodname></entry>
|
||||
<entry><function>mysqli_stmt_prepare</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Prepara uma instrução SQL para execução</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::reset</methodname></entry>
|
||||
<entry><function>mysqli_stmt_reset</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Redefine uma instrução preparada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::result_metadata</methodname></entry>
|
||||
<entry><function>mysqli_stmt_result_metadata</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna os metadados do conjunto de resultados de uma instrução preparada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::send_long_data</methodname></entry>
|
||||
<entry><function>mysqli_stmt_send_long_data</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Envia dados em blocos</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_stmt::store_result</methodname></entry>
|
||||
<entry><function>mysqli_stmt_store_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Transfere um conjunto de resultados de uma instrução preparada</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table xml:id="mysqli.summary.resultmethods">
|
||||
<title>Resumo dos métodos <classname>mysqli_result</classname> </title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>mysqli_result</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Interface POO</entry>
|
||||
<entry>Interface Procedural</entry>
|
||||
<entry>Alias (não use)</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Propriedades</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-result.current-field">$mysqli_result::current_field</link></entry>
|
||||
<entry><function>mysqli_field_tell</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém o deslocamento de campo atual de um ponteiro de resultado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-result.field-count">$mysqli_result::field_count</link></entry>
|
||||
<entry><function>mysqli_num_fields</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém o número de campos em um resultado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-result.lengths">$mysqli_result::lengths</link></entry>
|
||||
<entry><function>mysqli_fetch_lengths</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna os comprimentos das colunas da linha atual no conjunto de resultados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-result.num-rows">$mysqli_result::num_rows</link></entry>
|
||||
<entry><function>mysqli_num_rows</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtém o número de linhas em um resultado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Methods</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::data_seek</methodname></entry>
|
||||
<entry><function>mysqli_data_seek</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Ajusta o ponteiro de resultado para uma linha arbitrária no resultado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_all</methodname></entry>
|
||||
<entry><function>mysqli_fetch_all</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Busca todas as linhas de resultado e retorna o conjunto de resultados como uma matriz associativa, uma matriz numérica ou ambas. &mysqli.available.mysqlnd;</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_array</methodname></entry>
|
||||
<entry><function>mysqli_fetch_array</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Busca uma linha de resultado como uma associativa, uma matriz numérica ou ambas</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_assoc</methodname></entry>
|
||||
<entry><function>mysqli_fetch_assoc</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Busca uma linha de resultado como uma matriz associativa</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_column</methodname></entry>
|
||||
<entry><function>mysqli_fetch_column</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Busca uma única coluna da próxima linha de um conjunto de resultados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_field_direct</methodname></entry>
|
||||
<entry><function>mysqli_fetch_field_direct</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Buscar metadados para um único campo</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_field</methodname></entry>
|
||||
<entry><function>mysqli_fetch_field</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna o próximo campo no conjunto de resultados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_fields</methodname></entry>
|
||||
<entry><function>mysqli_fetch_fields</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna uma matriz de objetos que representam os campos em um conjunto de resultados</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_object</methodname></entry>
|
||||
<entry><function>mysqli_fetch_object</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Retorna a linha atual de um conjunto de resultados como um objeto</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::fetch_row</methodname></entry>
|
||||
<entry><function>mysqli_fetch_row</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Obtenha uma linha de resultado como uma matriz enumerada</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::field_seek</methodname></entry>
|
||||
<entry><function>mysqli_field_seek</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Definir ponteiro de resultado para um deslocamento de campo especificado</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_result::free</methodname>,
|
||||
<link linkend="mysqli-result.free">mysqli_result::close</link>,
|
||||
<link linkend="mysqli-result.free">mysqli_result::free_result</link></entry>
|
||||
<entry><function>mysqli_free_result</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Libera a memória associada a um resultado</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table xml:id="mysqli.summary.drivermethods">
|
||||
<title>Resumo dos métodos <classname>mysqli_driver</classname></title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>MySQL_Driver</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Interface POO</entry>
|
||||
<entry>Interface Procedural</entry>
|
||||
<entry>Alias (não use)</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Propriedades</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="mysqli-driver.report-mode">$mysqli_driver::mysqli_report</link></entry>
|
||||
<entry><function>mysqli_report</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>Define o modo de relatório de erros do mysqli</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><emphasis role="bold">Métodos</emphasis></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_driver::embedded_server_end</methodname></entry>
|
||||
<entry><function>mysqli_embedded_server_end</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>NÃO DOCUMENTADO</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><methodname>mysqli_driver::embedded_server_start</methodname></entry>
|
||||
<entry><function>mysqli_embedded_server_start</function></entry>
|
||||
<entry>N/A</entry>
|
||||
<entry>NÃO DOCUMENTADO</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
As funções de alias são fornecidas apenas para fins de compatibilidade com versões
|
||||
anteriores. Não os use em novos projetos.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
Reference in New Issue
Block a user