-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynodb.h
69 lines (51 loc) · 2.27 KB
/
dynodb.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef DYNO_DB_H
#define DYNO_DB_H
#include <QtSql>
#include "datatypes.h"
class Predicate;
class PredicateElement;
#include "class.h"
#include "relation.h"
class DynoDB
{
public:
static DynoDB* getInstance();
DynoDB(QString hostName,
QString databaseName,
QString userName,
QString password);
quint32 addPredicate(Predicate* predicate);
QList<QPair<quint32, QMap<QString, QString>>> processQuery(Predicate const* predicate);
Class* getClass(QString name);
bool isValid() const;
private:
static DynoDB* instance_;
bool initialize();
bool createInstance(quint32 classId, quint32 instanceId);
bool hasTable(quint32 classId);
bool hasTable(quint32 relationId, quint32 relationGroupId);
bool makeClassTable(quint32 classId);
bool makeRelationTable(quint32 relationId, quint32 relationGroupId);
quint32 createGibly();
bool deleteGibly(quint32 id);
bool createClass(quint32 id, QString className);
bool isClass(quint32 id);
bool isLiteral(quint32 id);
bool createLiteral(quint32 id, QString literalName, quint32 typeId);
bool addRelation(quint32 id, quint32 literalId, QVariant literal);
bool addRelation(quint32 giblyId, quint32 relationId, quint32 relationGroupId, QList<quint32> classIds, QList<quint32> quantities, QList<quint32> giblyIds);
quint32 getClass(quint32 id);
BuiltInDataType getLiteralType(quint32 id);
bool hasColumn(quint32 classId, quint32 columnId);
bool addColumn(quint32 classId, quint32 columnId, BuiltInDataType dataType);
bool hasColumn(quint32 relationId, quint32 relationGroupId, quint32 columnId, quint32 quantityIndex);
bool addColumn(quint32 relationId, quint32 relationGroupId, quint32 columnId, quint32 quantityIndex, BuiltInDataType dataType);
QList<quint32> processInternalQuery(Predicate const* predicate);
quint32 relationTypeExists(quint32 relationId, quint32 classId);
quint32 relationTypeExists(quint32 relationId, QList<quint32> classIds, QList<quint32> quantities);
quint32 registerRelationType(quint32 relationId,quint32 classId);
quint32 registerRelationType(quint32 relationId, QList<quint32> classIds, QList<quint32> quantities);
bool valid;
QSqlDatabase database;
};
#endif // DYNO_DB_H