aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/plugins/populateconstant.h
blob: 10615195450bbce7b8f5b64a83778f02ef4a3004 (plain) (blame)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef POPULATECONSTANT_H
#define POPULATECONSTANT_H

#include "builtinplugin.h"
#include "populateplugin.h"
#include "config_builder.h"

CFG_CATEGORIES(PopulateConstantConfig,
    CFG_CATEGORY(PopulateConstant,
        CFG_ENTRY(QString, Value, QString())
    )
)

class PopulateConstant : public BuiltInPlugin, public PopulatePlugin
{
        Q_OBJECT

        SQLITESTUDIO_PLUGIN_TITLE("Constant")
        SQLITESTUDIO_PLUGIN_DESC("Support for populating tables with a constant value.")
        SQLITESTUDIO_PLUGIN_VERSION(10001)
        SQLITESTUDIO_PLUGIN_AUTHOR("sqlitestudio.pl")

    public:
        PopulateConstant();

        QString getTitle() const;
        PopulateEngine* createEngine();
};

class PopulateConstantEngine : public PopulateEngine
{
    public:
        bool beforePopulating(Db* db, const QString& table);
        QVariant nextValue(bool& nextValueError);
        void afterPopulating();
        CfgMain* getConfig();
        QString getPopulateConfigFormName() const;
        bool validateOptions();

    private:
        CFG_LOCAL(PopulateConstantConfig, cfg)
};

#endif // POPULATECONSTANT_H