<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libedata-book-e-book-backend-db-cache">
<refmeta>
<refentrytitle role="top_of_page" id="libedata-book-e-book-backend-db-cache.top_of_page">e-book-backend-db-cache</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBEDATA-BOOK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>e-book-backend-db-cache</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="libedata-book-e-book-backend-db-cache.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
<link linkend="EContact">EContact</link>*           <link linkend="e-book-backend-db-cache-get-contact">e_book_backend_db_cache_get_contact</link> (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);
<link linkend="void">void</link>                <link linkend="string-to-dbt">string_to_dbt</link>                       (const <link linkend="char">char</link> *str,
                                                         <link linkend="DBT:CAPS">DBT</link> *dbt);
<link linkend="char">char</link>*               <link linkend="e-book-backend-db-cache-get-filename">e_book_backend_db_cache_get_filename</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db);
<link linkend="void">void</link>                <link linkend="e-book-backend-db-cache-set-filename">e_book_backend_db_cache_set_filename</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *filename);
<link linkend="gboolean">gboolean</link>            <link linkend="e-book-backend-db-cache-add-contact">e_book_backend_db_cache_add_contact</link> (<link linkend="DB:CAPS">DB</link> *db,
                                                         <link linkend="EContact">EContact</link> *contact);
<link linkend="gboolean">gboolean</link>            <link linkend="e-book-backend-db-cache-remove-contact">e_book_backend_db_cache_remove_contact</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);
<link linkend="gboolean">gboolean</link>            <link linkend="e-book-backend-db-cache-check-contact">e_book_backend_db_cache_check_contact</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);
<link linkend="GList">GList</link>*              <link linkend="e-book-backend-db-cache-get-contacts">e_book_backend_db_cache_get_contacts</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *query);
<link linkend="gboolean">gboolean</link>            <link linkend="e-book-backend-db-cache-exists">e_book_backend_db_cache_exists</link>      (const <link linkend="char">char</link> *uri);
<link linkend="void">void</link>                <link linkend="e-book-backend-db-cache-set-populated">e_book_backend_db_cache_set_populated</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db);
<link linkend="gboolean">gboolean</link>            <link linkend="e-book-backend-db-cache-is-populated">e_book_backend_db_cache_is_populated</link>
                                                        (<link linkend="DB:CAPS">DB</link> *db);
<link linkend="GPtrArray">GPtrArray</link>*          <link linkend="e-book-backend-db-cache-search">e_book_backend_db_cache_search</link>      (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *query);
</synopsis>
</refsynopsisdiv>









<refsect1 id="libedata-book-e-book-backend-db-cache.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="libedata-book-e-book-backend-db-cache.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="e-book-backend-db-cache-get-contact" role="function">
<title>e_book_backend_db_cache_get_contact ()</title>
<indexterm zone="e-book-backend-db-cache-get-contact"><primary>e_book_backend_db_cache_get_contact</primary></indexterm><programlisting><link linkend="EContact">EContact</link>*           e_book_backend_db_cache_get_contact (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);</programlisting>
<para>
Get a cached contact. Note that the returned <link linkend="EContact"><type>EContact</type></link> will be
newly created, and must be unreffed by the caller when no longer
needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara> DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uid</parameter>&nbsp;:</term>
<listitem><simpara> a unique contact ID
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A cached <link linkend="EContact"><type>EContact</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>uid</parameter> is not cached.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="string-to-dbt" role="function">
<title>string_to_dbt ()</title>
<indexterm zone="string-to-dbt"><primary>string_to_dbt</primary></indexterm><programlisting><link linkend="void">void</link>                string_to_dbt                       (const <link linkend="char">char</link> *str,
                                                         <link linkend="DBT:CAPS">DBT</link> *dbt);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dbt</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-get-filename" role="function">
<title>e_book_backend_db_cache_get_filename ()</title>
<indexterm zone="e-book-backend-db-cache-get-filename"><primary>e_book_backend_db_cache_get_filename</primary></indexterm><programlisting><link linkend="char">char</link>*               e_book_backend_db_cache_get_filename
                                                        (<link linkend="DB:CAPS">DB</link> *db);</programlisting>
<para>
Get the filename for db cacahe file.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara>  DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-set-filename" role="function">
<title>e_book_backend_db_cache_set_filename ()</title>
<indexterm zone="e-book-backend-db-cache-set-filename"><primary>e_book_backend_db_cache_set_filename</primary></indexterm><programlisting><link linkend="void">void</link>                e_book_backend_db_cache_set_filename
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *filename);</programlisting>
<para>
Set the filename for db cacahe file.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara>  DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
<listitem><simpara> filename to be set
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-add-contact" role="function">
<title>e_book_backend_db_cache_add_contact ()</title>
<indexterm zone="e-book-backend-db-cache-add-contact"><primary>e_book_backend_db_cache_add_contact</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            e_book_backend_db_cache_add_contact (<link linkend="DB:CAPS">DB</link> *db,
                                                         <link linkend="EContact">EContact</link> *contact);</programlisting>
<para>
Adds <parameter>contact</parameter> to <parameter>cache</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara> DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>contact</parameter>&nbsp;:</term>
<listitem><simpara> an <link linkend="EContact"><type>EContact</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the contact was cached successfully, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-remove-contact" role="function">
<title>e_book_backend_db_cache_remove_contact ()</title>
<indexterm zone="e-book-backend-db-cache-remove-contact"><primary>e_book_backend_db_cache_remove_contact</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            e_book_backend_db_cache_remove_contact
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);</programlisting>
<para>
Removes the contact identified by <parameter>uid</parameter> from <parameter>cache</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara> DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uid</parameter>&nbsp;:</term>
<listitem><simpara> a unique contact ID
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the contact was found and removed, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-check-contact" role="function">
<title>e_book_backend_db_cache_check_contact ()</title>
<indexterm zone="e-book-backend-db-cache-check-contact"><primary>e_book_backend_db_cache_check_contact</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            e_book_backend_db_cache_check_contact
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *uid);</programlisting>
<para>
Checks if the contact identified by <parameter>uid</parameter> exists in <parameter>cache</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara> DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uid</parameter>&nbsp;:</term>
<listitem><simpara> a unique contact ID
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the cache contains the contact, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-get-contacts" role="function">
<title>e_book_backend_db_cache_get_contacts ()</title>
<indexterm zone="e-book-backend-db-cache-get-contacts"><primary>e_book_backend_db_cache_get_contacts</primary></indexterm><programlisting><link linkend="GList">GList</link>*              e_book_backend_db_cache_get_contacts
                                                        (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *query);</programlisting>
<para>
Returns a list of <link linkend="EContact"><type>EContact</type></link> elements from <parameter>cache</parameter> matching <parameter>query</parameter>.
When done with the list, the caller must unref the contacts and
free the list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara> DB Handle
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> an s-expression
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A <link linkend="GList"><type>GList</type></link> of pointers to <link linkend="EContact"><type>EContact</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-exists" role="function">
<title>e_book_backend_db_cache_exists ()</title>
<indexterm zone="e-book-backend-db-cache-exists"><primary>e_book_backend_db_cache_exists</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            e_book_backend_db_cache_exists      (const <link linkend="char">char</link> *uri);</programlisting>
<para>
Checks if an <link linkend="EBookBackendCache"><type>EBookBackendCache</type></link> exists at <parameter>uri</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> URI for the cache
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if cache exists, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if not.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-set-populated" role="function">
<title>e_book_backend_db_cache_set_populated ()</title>
<indexterm zone="e-book-backend-db-cache-set-populated"><primary>e_book_backend_db_cache_set_populated</primary></indexterm><programlisting><link linkend="void">void</link>                e_book_backend_db_cache_set_populated
                                                        (<link linkend="DB:CAPS">DB</link> *db);</programlisting>
<para>
Flags <parameter>cache</parameter> as being populated - that is, it is up-to-date on the
contents of the book it's caching.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-is-populated" role="function">
<title>e_book_backend_db_cache_is_populated ()</title>
<indexterm zone="e-book-backend-db-cache-is-populated"><primary>e_book_backend_db_cache_is_populated</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            e_book_backend_db_cache_is_populated
                                                        (<link linkend="DB:CAPS">DB</link> *db);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="e-book-backend-db-cache-search" role="function">
<title>e_book_backend_db_cache_search ()</title>
<indexterm zone="e-book-backend-db-cache-search"><primary>e_book_backend_db_cache_search</primary></indexterm><programlisting><link linkend="GPtrArray">GPtrArray</link>*          e_book_backend_db_cache_search      (<link linkend="DB:CAPS">DB</link> *db,
                                                         const <link linkend="char">char</link> *query);</programlisting>
<para>
Returns an array of pointers to unique contact ID strings for contacts
in <parameter>cache</parameter> matching <parameter>query</parameter>. When done with the array, the caller must
free the ID strings and the array.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>db</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>query</parameter>&nbsp;:</term>
<listitem><simpara> an s-expression
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A <link linkend="GPtrArray"><type>GPtrArray</type></link> of pointers to contact ID strings.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
