<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="function.rpmdbsearch" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>rpmdbsearch</refname>
  <refpurpose>Search RPM packages</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>array</type><type>null</type></type><methodname>rpmdbsearch</methodname>
   <methodparam><type>string</type><parameter>pattern</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>rpmtag</parameter><initializer>RPMTAG_NAME</initializer></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>rpmmire</parameter><initializer>-1</initializer></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>full</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Search packages in the system RPM database.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>pattern</parameter></term>
    <listitem>
     <para>
      Value to search for.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>rpmtag</parameter></term>
    <listitem>
     <para>
      Search criterion, one of RPMTAG_* constant, see the <link linkend="rpminfo.constants">rpminfo constants</link> page.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>rpmmire</parameter></term>
    <listitem>
     <para>
      Pattern type, one of RPMMIRE_* constant, see the <link linkend="rpminfo.constants">rpminfo constants</link> page.
      When &lt; 0 the criterion must equals the value, and database index is used if possible.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>full</parameter></term>
    <listitem>
     <para>
      If &true; all information headers for the file are retrieved, else only a minimal set.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   An <type>array</type> of <type>array</type> of information or NULL on error.   
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Searching for the package owning a file</title>
    <programlisting role="php">
<![CDATA[
<?php
$info = rpmdbsearch("/usr/bin/php", RPMTAG_INSTFILENAMES);
print_r($info);
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Array
(
    [0] => Array
        (
            [Name] => php-cli
            [Version] => 7.4.4
            [Release] => 1.fc32
            [Summary] => Command-line interface for PHP
            [Arch] => x86_64
        )

)
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>rpmaddtag</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
-->
