mirror of
https://github.com/php/doc-es.git
synced 2026-04-28 17:43:11 +02:00
5c476dfd32
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@332602 c90b9560-bf6c-de11-be94-00142212c4b1
186 lines
5.4 KiB
XML
186 lines
5.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: TardeEnFaMenor Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xml:id="function.ifx-query" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>ifx_query</refname>
|
|
<refpurpose>Enviar una consulta Informix</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>ifx_query</methodname>
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>cursor_type</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>blobidarray</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Envía la consulta <parameter>query</parameter> a la base de datos por medio de una conexión activa
|
|
asociada con <parameter>link_identifier</parameter>.
|
|
</para>
|
|
<para>
|
|
Para consultas "SELECT" devuelve un cursor.
|
|
Para consultas "INSERT", "UPDATE" y "DELETE", se ejecutan inmediatamente.
|
|
</para>
|
|
<para>
|
|
Para cualquier tipo de consulta el total (estimado o real) de filas afectadas es
|
|
guardado y devuelto por <function>ifx_affected_rows</function>.
|
|
</para>
|
|
<para>
|
|
Si la columna es de tipo TEXT (o BYTE) y la columna lo permite, se puede utilizar
|
|
<literal>ifx_textasvarchar(1)</literal> y
|
|
<literal>ifx_byteasvarchar(1)</literal>. Ésto permite tratar columnas de tipo TEXT
|
|
(o BYTE) como si fueran columnas VARCHAR ordinarias (pero extensas) en
|
|
consultas "SELECT", y no preocuparse por identificadores BLOB.
|
|
</para>
|
|
<para>
|
|
Con <literal>ifx_textasvarchar(0)</literal> o
|
|
<literal>ifx_byteasvarchar(0)</literal> (por defecto), las consultas "SELECT"
|
|
devuelven columnas BLOB como identificadores BLOB (enteros). Puede
|
|
obtener el valor de estas columnas como si fuera una cadena o archivo usando las funciones BLOB (ver más
|
|
abajo).
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>query</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Consulta a enviar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>link_identifier</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Identificador de la conexión.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>cursor_def</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Este parámetro opcional permite tratarlo como un cursor
|
|
<literal>scroll</literal> y/o <literal>hold</literal>.
|
|
Es una máscara y puede ser <constant>IFX_SCROLL</constant>,
|
|
<constant>IFX_HOLD</constant>, o ambas. Si se omite este parámetro
|
|
será un cursor secuencial normal.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>blobidarray</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si existen columnas BLOB (BYTE o TEXT) en la consulta, puede agregar
|
|
un parámetro <parameter>blobidarray</parameter> que contenga los
|
|
identificadores BLOB correspondientes.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un identificador Informix válido en caso de éxito, o &false; si ocurre algún error.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>
|
|
Ver todas las filas de la tabla "orders" en formato HTML
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
ifx_textasvarchar(1); // se usa el modo de texto para blobs
|
|
$res_id = ifx_query("select * from orders", $conn_id);
|
|
if (! $res_id) {
|
|
printf("No se pudo ejecutar la consulta : %s\n<br />%s<br />\n", ifx_error(), ifx_errormsg());
|
|
die;
|
|
}
|
|
ifx_htmltbl_result($res_id, "border=\"1\"");
|
|
ifx_free_result($res_id);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Insertar registros en la tabla "catalog"</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// create blob id's for a byte and text column
|
|
$textid = ifx_create_blob(0, 0, "Text column in memory");
|
|
$byteid = ifx_create_blob(1, 0, "Byte column in memory");
|
|
|
|
// store blob id's in a blobid array
|
|
$blobidarray[] = $textid;
|
|
$blobidarray[] = $byteid;
|
|
|
|
// launch query
|
|
$query = "insert into catalog (stock_num, manu_code, " .
|
|
"cat_descr,cat_picture) values(1,'HRO',?,?)";
|
|
$res_id = ifx_query($query, $conn_id, $blobidarray);
|
|
if (! $res_id) {
|
|
/* ... error ... */
|
|
}
|
|
|
|
// free result id
|
|
ifx_free_result($res_id);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>ifx_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
|
|
-->
|