akabeiquery.h 4.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/* This file is part of the Chakra project
 * It contains methods to return the most used queries, with placeholders for the parameters.

   Copyright (C) 2012 Lisa Vitolo <shainer@chakra-project.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
*/

#ifndef AKABEIQUERY_H
#define AKABEIQUERY_H

#include <QString>
#include <akabeicore_global.h>

namespace Akabei
{
namespace Queries
{

/**
 * Query to select groups.
 * 
 * @param property the property to compare groups to.
 * @param comparison the comparison method (LIKE, exact comparison...)
 * @param value the property's value.
 */
QString AKABEICORESHARED_EXPORT selectGroups(const QString &, const QString &, const QString &);

Lisa's avatar
Lisa committed
32 33 34 35 36 37 38 39
/**
 * Query to select groups with more freedom.
 * 
 * @param token a pattern for the name and/or description.
 * @param comparison the comparison method (LIKE, exact comparison...)
 */
QString AKABEICORESHARED_EXPORT selectGroupsNameOrDescription(const QString &, const QString &);

40 41 42 43 44 45 46
/**
 * Query to select packages.
 * 
 * @param property the property to compare packages to.
 * @param comparison the comparison method (LIKE, exact comparison...)
 * @param value the property's value.
 */
47
QString AKABEICORESHARED_EXPORT selectPackages(const QString &property, const QString &comparison, const QString &value);
48

Lisa's avatar
Lisa committed
49 50 51 52 53 54 55 56
/**
 * Query to select packages with more freedom.
 * 
 * @param token a pattern for the name and/or description.
 * @param comparison the comparison method (LIKE, exact comparison...)
 */
QString AKABEICORESHARED_EXPORT selectPackagesNameOrDescription(const QString &, const QString &);

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
/**
 * Query to select hooks.
 * 
 * @param property the property to compare hooks to.
 * @param comparison the comparison method (LIKE, exact comparison...)
 * @param value the property's value.
 */
QString AKABEICORESHARED_EXPORT selectHooks(const QString &, const QString &, const QString &);

/**
 * Query to select deltas.
 * 
 * @param property the property to compare deltas to.
 * @param comparison the comparison method (LIKE, exact comparison...)
 * @param value the property's value.
 */
QString AKABEICORESHARED_EXPORT selectDeltas(const QString &, const QString &, const QString &);

/**
 * Query that returns all packages.
 */
QString AKABEICORESHARED_EXPORT allPackages();

/**
 * Query that returns all groups.
 */
QString AKABEICORESHARED_EXPORT allGroups();

/**
 * Query for a package property among those expressed with tables (conflicts, dependencies, provides...).
 * 
 * @param property the property returned.
 * @param table the table from which the property is taken.
 * @param packageId the package ID to distinguish its properties.
 */
Lisa's avatar
Lisa committed
92
QString AKABEICORESHARED_EXPORT packageProperty(const QString &, const QString &, int);
93 94 95 96 97 98

/**
 * Query for the package hooks.
 * 
 * @param packageId the package ID.
 */
Lisa's avatar
Lisa committed
99
QString AKABEICORESHARED_EXPORT packageHooks(int);
100 101 102 103 104 105 106 107 108 109 110 111

/**
 * Query for all the packages with a certain hook.
 * 
 * @param hook the hook's name.
 */
QString AKABEICORESHARED_EXPORT packagesFromHook(const QString &);

/**
 * Query that selects some packages in a group.
 * 
 * @param group the group's name.
Lisa's avatar
Lisa committed
112
 * @param token pattern for package's name and description.
113
 */
Lisa's avatar
Lisa committed
114
QString AKABEICORESHARED_EXPORT packagesInGroup(const QString &, const QString &);
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

/**
 * Query that shows us if a package belongs to some group.
 * 
 * @param group the group's name.
 * @param package the package's ID.
 */
QString AKABEICORESHARED_EXPORT belongsGroup(const QString &, const QString &);

/**
 * Query that returns all packages in a group.
 * 
 * @param group the group's name.
 */
QString AKABEICORESHARED_EXPORT allPackagesInGroup(const QString &);

/**
 * Query for all the packages with a given dependency.
 * 
 * @param dependency the dependency as a regular expression.
 */
QString AKABEICORESHARED_EXPORT requiredByPackages(const QString &);

/**
 * Query for some package's dependencies.
 * 
 * @param dependency a regexp's filter for the dependencies.
Lisa's avatar
Lisa committed
142
 * @param comparison the comparison method (LIKE, exact comparison...)
143
 */
Lisa's avatar
Lisa committed
144
QString AKABEICORESHARED_EXPORT packageDependencies(const QString &, const QString &);
145

146 147 148
/**
 * Query all packages with at least one replacement.
 */
149 150
QString AKABEICORESHARED_EXPORT globalReplaces();

151 152 153 154 155 156 157 158 159 160 161
/**
 * Query that begins a transaction.
 */
QString AKABEICORESHARED_EXPORT begin();

/**
 * Query that commits a transaction.
 */
QString AKABEICORESHARED_EXPORT commit();

/**
Lisa's avatar
Lisa committed
162
 * Query that vacuums the database.
163 164
 */
QString AKABEICORESHARED_EXPORT vacuum();
Lisa's avatar
Lisa committed
165 166 167 168 169

/**
 * Query that rollbacks a transaction.
 */
QString AKABEICORESHARED_EXPORT rollback();
170 171 172 173
}
}

#endif