stec-platform
postgresinterface.h
1 #ifndef POSTGRESINTERFACE_H
2 #define POSTGRESINTERFACE_H
3 
4 #include <QObject>
5 #include <QDateTime>
6 #include <QHash>
7 #include <QList>
8 #include <QMap>
9 
10 
11 #include <QPair>
12 #include <QSqlDatabase>
13 #include <QSqlError>
14 #include <QSqlQuery>
15 #include <QSqlRecord>
16 #include <QSqlTableModel>
17 #include <QSqlTableModel>
18 #include <QString>
19 #include <QVariant>
20 #include <QVariantList>
21 #include <QtCore>
22 #include "platformu_global.h"
23 #include <publication.h>
24 #include <subscription.h>
25 #include "sqlbase.h"
26 
27 
34 class PLATFORMUSHARED_EXPORT PostgresInterface : public SQLBase
35 {
36  Q_OBJECT
37 
38 protected :
39  virtual void ReloadTables(void) ;
40 
41 public:
42 
47  PostgresInterface(QObject *parent = nullptr);
48 
58  PostgresInterface(QString DatabaseIP, QString DatabasePort, QString DatabaseName, QString DatabaseUser,
59  QString DatabasePasswd, QObject *parent = 0);
60 
67  virtual bool ClearAllData( QString dataTable);
68 
73  virtual QString OpenDatabase(void) ;
74 
76  virtual void ScratchSql(void);
77 
79  virtual void ScratchSubscriber(QString subscriber);
80 
82  virtual QString TrendThis(QString subscription);
83 
89  virtual QString getSubFromTable( QString table);
90 
96  virtual QString getTableFromSub( QString sub);
97 
105  virtual QDataLoggerRecord GetDataRecordsFromTrendTable(QString table, QDateTime fromLocalTime, QDateTime toLocalTime);
106 
107 
115  virtual VremMYSqlRecord GetLastDataRecordsFromTrendTable(QString table, QDateTime fromLocalTime, QDateTime toLocalTime);
116 
123  virtual VremMYSqlRecord GetLastDataRecordsFromTrendTable(QString table, QDateTime toLocalTime);
124 
125 
131  virtual VremMYSqlRecord GetLastDataRecordsFromTrendTable(QString table);
132 
133 
142  virtual bool DeleteDataRecordsFromTrendTable(QString table, QDateTime beforeLocalTime);
143 
152  virtual bool AddData( QString dataTable, const VremVArray &instance1);
153 
162  virtual bool ChangeProperties(QString subscriber, VremVArray propertys);
163 
171  virtual VremVArray GetProperties( QString subscription);
172 
180  virtual DBType getDBType() { return postgres; }
181 };
182 
183 #endif // POSTGRESINTERFACE_H
The PostgresInterface class Database engine for Postgres.
Definition: postgresinterface.h:35
virtual DBType getDBType()
getDBType
Definition: postgresinterface.h:180
The SQLBase class.
Definition: sqlbase.h:38
virtual void ScratchSql(void)=0
starts a new database
virtual bool ClearAllData(QString dataTable)=0
virtual QString TrendThis(QString subscription)=0
returns the table name for this trend, creates the trend if not there
Definition: sqlbase.h:56