umbrello: umbrello/codeimport/sqlimport.h Source File

umbrello 25.08.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

sqlimport.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2015 Ralf Habacker <ralf.habacker@freenet.de>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5*/
6
7#ifndef SQLIMPORT_H
8#define SQLIMPORT_H
9
10#include "nativeimportbase.h"
11
12class UMLEntity;
13class UMLObject;
14
22 class SQLImport : public NativeImportBase {
23public:
24 explicit SQLImport(CodeImpThread *thread = nullptr);
25 virtual ~SQLImport();
26
27 bool parseStmt();
28
29protected:
30 class ColumnConstraints {
31 public:
32 ColumnConstraints()
33 : primaryKey(false),
34 uniqueKey(false),
35 notNullConstraint(false),
36 autoIncrement(false)
37 {
38 }
39
40 bool primaryKey;
41 bool uniqueKey;
42 bool notNullConstraint;
43 bool autoIncrement;
44 QString collate;
45 QString defaultValue;
46 QString constraintName;
47 QString characterSet;
48 };
49
50 class TableConstraints {
51 public:
52 TableConstraints()
53 : primaryKey(false),
54 uniqueKeys(false),
55 notNullConstraint(false),
56 autoIncrement(false),
57 checkConstraint(false)
58 {
59 }
60
61 bool primaryKey;
62 bool uniqueKeys;
63 bool notNullConstraint;
64 bool autoIncrement;
65 bool checkConstraint;
66 QString checkExpression;
67 QStringList primaryKeyFields;
68 QString uniqueKeyName;
69 QStringList uniqueKeysFields;
70 QString collate;
71 QString defaultValue;
72 QString constraintName;
73 };
74
75 virtual QString advance();
76
77 void fillSource(const QString &word);
78 bool parseCreateTable(QString &token);
79 bool parseAlterTable(QString &token);
80 QString parseIdentifier(QString &token);
81 QString parseDefaultExpression(QString &token);
82 QStringList parseFieldType(QString &token);
83 QStringList parseIdentifierList(QString &token);
84 ColumnConstraints parseColumnConstraints(QString &token);
85 TableConstraints parseTableConstraints(QString &token);
86 bool parseCreateDefinition(QString &token, UMLEntity *entity);
87 UMLObject *addDatatype(const QStringList &type);
88 bool addPrimaryKey(UMLEntity *entity, const QString &name, const QStringList &fields);
89 bool addUniqueConstraint(UMLEntity *entity, const QString &name, const QStringList &fields);
90 bool addForeignConstraint(UMLEntity *entityA, const QString &name, const QStringList &fieldNames,
91 const QString &referencedTable, const QStringList &referencedFields);
92
93 static bool equiv(const QString &word, const QString &stringlit);
94};
95
96#endif
97
CodeImpThread
Definition codeimpthread.h:22
NativeImportBase::NativeImportBase
NativeImportBase(const QString &singleLineCommentIntro, CodeImpThread *thread=nullptr)
Definition nativeimportbase.cpp:33
SQLImport::ColumnConstraints
Definition sqlimport.h:30
SQLImport::ColumnConstraints::autoIncrement
bool autoIncrement
Definition sqlimport.h:43
SQLImport::ColumnConstraints::constraintName
QString constraintName
Definition sqlimport.h:46
SQLImport::ColumnConstraints::primaryKey
bool primaryKey
Definition sqlimport.h:40
SQLImport::ColumnConstraints::notNullConstraint
bool notNullConstraint
Definition sqlimport.h:42
SQLImport::ColumnConstraints::defaultValue
QString defaultValue
Definition sqlimport.h:45
SQLImport::ColumnConstraints::ColumnConstraints
ColumnConstraints()
Definition sqlimport.h:32
SQLImport::ColumnConstraints::uniqueKey
bool uniqueKey
Definition sqlimport.h:41
SQLImport::ColumnConstraints::characterSet
QString characterSet
Definition sqlimport.h:47
SQLImport::ColumnConstraints::collate
QString collate
Definition sqlimport.h:44
SQLImport::TableConstraints
Definition sqlimport.h:50
SQLImport::TableConstraints::primaryKey
bool primaryKey
Definition sqlimport.h:61
SQLImport::TableConstraints::autoIncrement
bool autoIncrement
Definition sqlimport.h:64
SQLImport::TableConstraints::primaryKeyFields
QStringList primaryKeyFields
Definition sqlimport.h:67
SQLImport::TableConstraints::TableConstraints
TableConstraints()
Definition sqlimport.h:52
SQLImport::TableConstraints::collate
QString collate
Definition sqlimport.h:70
SQLImport::TableConstraints::notNullConstraint
bool notNullConstraint
Definition sqlimport.h:63
SQLImport::TableConstraints::uniqueKeyName
QString uniqueKeyName
Definition sqlimport.h:68
SQLImport::TableConstraints::checkConstraint
bool checkConstraint
Definition sqlimport.h:65
SQLImport::TableConstraints::uniqueKeys
bool uniqueKeys
Definition sqlimport.h:62
SQLImport::TableConstraints::defaultValue
QString defaultValue
Definition sqlimport.h:71
SQLImport::TableConstraints::checkExpression
QString checkExpression
Definition sqlimport.h:66
SQLImport::TableConstraints::constraintName
QString constraintName
Definition sqlimport.h:72
SQLImport::TableConstraints::uniqueKeysFields
QStringList uniqueKeysFields
Definition sqlimport.h:69
SQLImport::parseCreateDefinition
bool parseCreateDefinition(QString &token, UMLEntity *entity)
Definition sqlimport.cpp:531
SQLImport::parseIdentifierList
QStringList parseIdentifierList(QString &token)
Definition sqlimport.cpp:132
SQLImport::parseCreateTable
bool parseCreateTable(QString &token)
Definition sqlimport.cpp:652
SQLImport::~SQLImport
virtual ~SQLImport()
Definition sqlimport.cpp:52
SQLImport::SQLImport
SQLImport(CodeImpThread *thread=nullptr)
Definition sqlimport.cpp:44
SQLImport::parseDefaultExpression
QString parseDefaultExpression(QString &token)
Definition sqlimport.cpp:230
SQLImport::parseIdentifier
QString parseIdentifier(QString &token)
Definition sqlimport.cpp:102
SQLImport::advance
virtual QString advance()
Definition sqlimport.cpp:841
SQLImport::fillSource
void fillSource(const QString &word)
Definition sqlimport.cpp:59
SQLImport::addForeignConstraint
bool addForeignConstraint(UMLEntity *entityA, const QString &name, const QStringList &fieldNames, const QString &referencedTable, const QStringList &referencedFields)
Definition sqlimport.cpp:955
SQLImport::parseColumnConstraints
ColumnConstraints parseColumnConstraints(QString &token)
Definition sqlimport.cpp:290
SQLImport::parseTableConstraints
TableConstraints parseTableConstraints(QString &token)
Definition sqlimport.cpp:471
SQLImport::parseAlterTable
bool parseAlterTable(QString &token)
Definition sqlimport.cpp:699
SQLImport::parseFieldType
QStringList parseFieldType(QString &token)
Definition sqlimport.cpp:158
SQLImport::addPrimaryKey
bool addPrimaryKey(UMLEntity *entity, const QString &name, const QStringList &fields)
Definition sqlimport.cpp:871
SQLImport::addUniqueConstraint
bool addUniqueConstraint(UMLEntity *entity, const QString &name, const QStringList &fields)
Definition sqlimport.cpp:915
SQLImport::parseStmt
bool parseStmt()
Definition sqlimport.cpp:785
SQLImport::addDatatype
UMLObject * addDatatype(const QStringList &type)
Definition sqlimport.cpp:848
SQLImport::equiv
static bool equiv(const QString &word, const QString &stringlit)
Definition sqlimport.cpp:1014
UMLEntity
Non-graphical Information for an Entity.
Definition entity.h:30
UMLObject
The base class for UML objects.
Definition umlobject.h:70
nativeimportbase.h