AppStream Library Reference Manual: AsDatabase

## AsDatabase AsDatabase — Read-only access to the Appstream component database |

## Functions

AsDatabase * | as_database_new ()
AsDatabase * | as_database_construct ()
void | as_database_set_database_path ()
gboolean | as_database_open ()
const gchar * | as_database_get_database_path ()
gboolean | as_database_db_exists ()
GPtrArray * | as_database_get_all_components ()
GPtrArray * | as_database_find_components ()
GPtrArray * | as_database_find_components_by_term ()
AsComponent * | as_database_get_component_by_id ()
GPtrArray * | as_database_get_components_by_provides ()
GPtrArray * | as_database_get_components_by_kind ()

## Properties

gchar * | database-path | Read / Write

## Object Hierarchy

        GObject
        ╰── AsDatabase

## Includes

    #include <appstream.h>

## Description

This object provides access to the Appstream Xapian database of available software components. You can search for components using various criteria, as well as getting some information about the data provided by this Appstream database.

See also: AsComponent, AsSearchQuery

## Functions

### as_database_new ()

    AsDatabase *
    as_database_new (void);

Creates a new AsDatabase.

#### Returns

a new AsDatabase.

[transfer full]

### as_database_construct ()

    AsDatabase *
    as_database_construct (GType object_type);

Construct a new AsDatabase.

#### Returns

a new AsDatabase.

[transfer full]

### as_database_set_database_path ()

    void
    as_database_set_database_path (AsDatabase *self,
                                   const gchar *value);

### as_database_open ()

    gboolean
    as_database_open (AsDatabase *self);

#### Returns

### as_database_get_database_path ()

    const gchar *
    as_database_get_database_path (AsDatabase *self);

#### Returns

### as_database_db_exists ()

    gboolean
    as_database_db_exists (AsDatabase *self);

#### Parameters

self | a valid AsDatabase instance |

#### Returns

TRUE if the application database exists

### as_database_get_all_components ()

    GPtrArray *
    as_database_get_all_components (AsDatabase *self);

Dump a list of all components found in the database.

#### Parameters

self | a valid AsDatabase instance |

#### Returns

an array of AsComponent objects.

[element-type AsComponent][transfer full]

### as_database_find_components ()

    GPtrArray *
    as_database_find_components (AsDatabase *self,
                                 AsSearchQuery *query);

Find components in the Appstream database.

#### Parameters

self | a valid AsDatabase instance |
query | a AsSearchQuery |

#### Returns

an array of AsComponent objects which have been found.

[element-type AsComponent][transfer full]

### as_database_find_components_by_term ()

    GPtrArray *
    as_database_find_components_by_term (AsDatabase *self,
                                         const gchar *search_term,
                                         const gchar *categories_str);

Find components in the Appstream database by searching for a simple string.

#### Parameters

self | a valid AsDatabase instance |
search_term | the string to search for |
categories_str | a comma-separated list of category names, or NULL to search in all categories. | [allow-none][default NULL]

#### Returns

an array of AsComponent objects which have been found.

[element-type AsComponent][transfer full]

### as_database_get_component_by_id ()

    AsComponent *
    as_database_get_component_by_id (AsDatabase *self,
                                     const gchar *idname);

Get a component by it's ID

#### Parameters

self | a valid AsDatabase instance |
idname | the ID of the component |

#### Returns

an AsComponent or NULL if none was found.

[transfer full]

### as_database_get_components_by_provides ()

    GPtrArray *
    as_database_get_components_by_provides
                                   (AsDatabase *self,
                                    AsProvidesKind kind,
                                    const gchar *value,
                                    const gchar *data);

Find components in the Appstream database.

#### Parameters

self | a valid AsDatabase instance |
kind | an AsProvidesKind |
value | a value of the selected provides kind |
data | additional provides data. | [allow-none][default NULL]

#### Returns

an array of AsComponent objects which have been found, NULL on error.

[element-type AsComponent][transfer full]

### as_database_get_components_by_kind ()

    GPtrArray *
    as_database_get_components_by_kind (AsDatabase *self,
                                        AsComponentKind kinds);

Find components of a given kind.

#### Parameters

self | a valid AsDatabase instance |
kinds | an AsComponentKind bitfield |

#### Returns

an array of AsComponent objects which have been found, NULL on error.

[element-type AsComponent][transfer full]

## Types and Values

## Property Details

### The `“database-path”` property

      “database-path”            gchar *

database-path.

Flags: Read / Write

Default value: NULL