dbactions.h 1.66 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
/***
Buho  Copyright (C) 2018  Camilo Higuita
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

 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 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
***/

#ifndef DBACTIONS_H
#define DBACTIONS_H

#include <QObject>
#include "db.h"
Camilo Higuita's avatar
Camilo Higuita committed
26

Camilo higuita's avatar
Camilo higuita committed
27
class Tagging;
28 29 30 31 32 33 34 35 36 37
class DBActions : public DB
{
    Q_OBJECT
public:
    explicit DBActions(QObject *parent = nullptr);
    ~DBActions();

    Q_INVOKABLE QVariantList get(const QString &queryTxt);

    /*main actions*/
Camilo Higuita's avatar
Camilo Higuita committed
38 39 40
    Q_INVOKABLE bool insertLink(const QVariantMap &link);
    Q_INVOKABLE bool updateLink(const QVariantMap &link);
    Q_INVOKABLE bool removeLink(const QVariantMap &link);
41
    Q_INVOKABLE QVariantList getLinks();
42
    Q_INVOKABLE QVariantList getLinkTags(const QString &link);
43

44 45 46
protected:
    OWL::DB_LIST getDBData(const QString &queryTxt);
    bool execQuery(const QString &queryTxt);
47
    Tagging *tag;
48

Camilo Higuita's avatar
Camilo Higuita committed
49 50
    void removeAbtractTags(const QString &key, const QString &lot);

51
signals:
52
    void linkInserted(QVariantMap link);
53 54 55
};

#endif // DBACTIONS_H