From 7167ce41b61d2ba2cdb526777a4233eb84a3b66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 6 Dec 2014 17:33:25 -0500 Subject: Imported Upstream version 2.99.6 --- .../coreSQLiteStudio/plugins/populatesequence.h | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 SQLiteStudio3/coreSQLiteStudio/plugins/populatesequence.h (limited to 'SQLiteStudio3/coreSQLiteStudio/plugins/populatesequence.h') diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populatesequence.h b/SQLiteStudio3/coreSQLiteStudio/plugins/populatesequence.h new file mode 100644 index 0000000..5435477 --- /dev/null +++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populatesequence.h @@ -0,0 +1,47 @@ +#ifndef POPULATESEQUENCE_H +#define POPULATESEQUENCE_H + +#include "builtinplugin.h" +#include "populateplugin.h" +#include "config_builder.h" + +CFG_CATEGORIES(PopulateSequenceConfig, + CFG_CATEGORY(PopulateSequence, + CFG_ENTRY(int, StartValue, 0) + CFG_ENTRY(int, Step, 1) + ) +) + +class PopulateSequence : public BuiltInPlugin, public PopulatePlugin +{ + Q_OBJECT + + SQLITESTUDIO_PLUGIN_TITLE("Sequence") + SQLITESTUDIO_PLUGIN_DESC("Support for populating tables with sequenced values.") + SQLITESTUDIO_PLUGIN_VERSION(10001) + SQLITESTUDIO_PLUGIN_AUTHOR("sqlitestudio.pl") + + public: + PopulateSequence(); + + QString getTitle() const; + PopulateEngine* createEngine(); +}; + +class PopulateSequenceEngine : 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(PopulateSequenceConfig, cfg) + qint64 seq = 0; + qint64 step = 1; +}; + +#endif // POPULATESEQUENCE_H -- cgit v1.2.3