umbrello: umbrello/codeimport/sqlimport.h Source File

umbrello 2.32.3 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 Copyright 2015 Ralf Habacker <ralf.habacker@freenet.de>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), which shall act as a proxy
10 defined in Section 14 of version 3 of the license.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef SQLIMPORT_H
22 #define SQLIMPORT_H
23
24 #include "nativeimportbase.h"
25
26 class UMLEntity;
27 class UMLObject;
28
36 class SQLImport : public QObject, public NativeImportBase {
37 Q_OBJECT
38 public:
39 explicit SQLImport(CodeImpThread* thread = 0);
40 virtual ~SQLImport();
41
42 bool parseStmt();
43
44 protected:
45 class ColumnConstraints {
46 public:
47 ColumnConstraints()
48 : primaryKey(false),
49 uniqueKey(false),
50 notNullConstraint(false),
51 autoIncrement(false)
52 {
53 }
54
55 bool primaryKey;
56 bool uniqueKey;
57 bool notNullConstraint;
58 bool autoIncrement;
59 QString collate;
60 QString defaultValue;
61 QString constraintName;
62 QString characterSet;
63 };
64
65 class TableConstraints {
66 public:
67 TableConstraints()
68 : primaryKey(false),
69 uniqueKeys(false),
70 notNullConstraint(false),
71 autoIncrement(false),
72 checkConstraint(false)
73 {
74 }
75
76 bool primaryKey;
77 bool uniqueKeys;
78 bool notNullConstraint;
79 bool autoIncrement;
80 bool checkConstraint;
81 QString checkExpression;
82 QStringList primaryKeyFields;
83 QString uniqueKeyName;
84 QStringList uniqueKeysFields;
85 QString collate;
86 QString defaultValue;
87 QString constraintName;
88 };
89
90 virtual QString advance();
91
92 void fillSource(const QString &word);
93 bool parseCreateTable(QString &token);
94 bool parseAlterTable(QString &token);
95 QString parseIdentifier(QString &token);
96 QString parseDefaultExpression(QString &token);
97 QStringList parseFieldType(QString &token);
98 QStringList parseIdentifierList(QString &token);
99 ColumnConstraints parseColumnConstraints(QString &token);
100 TableConstraints parseTableConstraints(QString &token);
101 bool parseCreateDefinition(QString &token, UMLEntity *entity);
102 UMLObject *addDatatype(const QStringList &type);
103 bool addPrimaryKey(UMLEntity *entity, const QString &name, const QStringList &fields);
104 bool addUniqueConstraint(UMLEntity *entity, const QString &name, const QStringList &fields);
105 bool addForeignConstraint(UMLEntity *entityA, const QString &name, const QStringList &fieldNames,
106 const QString &referencedTable, const QStringList &referencedFields);
107 };
108
109 #endif
110
CodeImpThread
Definition: codeimpthread.h:36
NativeImportBase
Base class for native implementations of language import.
Definition: nativeimportbase.h:45
SQLImport::ColumnConstraints
Definition: sqlimport.h:45
SQLImport::ColumnConstraints::autoIncrement
bool autoIncrement
Definition: sqlimport.h:58
SQLImport::ColumnConstraints::constraintName
QString constraintName
Definition: sqlimport.h:61
SQLImport::ColumnConstraints::primaryKey
bool primaryKey
Definition: sqlimport.h:55
SQLImport::ColumnConstraints::notNullConstraint
bool notNullConstraint
Definition: sqlimport.h:57
SQLImport::ColumnConstraints::defaultValue
QString defaultValue
Definition: sqlimport.h:60
SQLImport::ColumnConstraints::ColumnConstraints
ColumnConstraints()
Definition: sqlimport.h:47
SQLImport::ColumnConstraints::uniqueKey
bool uniqueKey
Definition: sqlimport.h:56
SQLImport::ColumnConstraints::characterSet
QString characterSet
Definition: sqlimport.h:62
SQLImport::ColumnConstraints::collate
QString collate
Definition: sqlimport.h:59
SQLImport::TableConstraints
Definition: sqlimport.h:65
SQLImport::TableConstraints::primaryKey
bool primaryKey
Definition: sqlimport.h:76
SQLImport::TableConstraints::autoIncrement
bool autoIncrement
Definition: sqlimport.h:79
SQLImport::TableConstraints::primaryKeyFields
QStringList primaryKeyFields
Definition: sqlimport.h:82
SQLImport::TableConstraints::TableConstraints
TableConstraints()
Definition: sqlimport.h:67
SQLImport::TableConstraints::collate
QString collate
Definition: sqlimport.h:85
SQLImport::TableConstraints::notNullConstraint
bool notNullConstraint
Definition: sqlimport.h:78
SQLImport::TableConstraints::uniqueKeyName
QString uniqueKeyName
Definition: sqlimport.h:83
SQLImport::TableConstraints::checkConstraint
bool checkConstraint
Definition: sqlimport.h:80
SQLImport::TableConstraints::uniqueKeys
bool uniqueKeys
Definition: sqlimport.h:77
SQLImport::TableConstraints::defaultValue
QString defaultValue
Definition: sqlimport.h:86
SQLImport::TableConstraints::checkExpression
QString checkExpression
Definition: sqlimport.h:81
SQLImport::TableConstraints::constraintName
QString constraintName
Definition: sqlimport.h:87
SQLImport::TableConstraints::uniqueKeysFields
QStringList uniqueKeysFields
Definition: sqlimport.h:84
SQLImport
Definition: sqlimport.h:36
SQLImport::parseCreateDefinition
bool parseCreateDefinition(QString &token, UMLEntity *entity)
Definition: sqlimport.cpp:552
SQLImport::parseIdentifierList
QStringList parseIdentifierList(QString &token)
Definition: sqlimport.cpp:153
SQLImport::parseCreateTable
bool parseCreateTable(QString &token)
Definition: sqlimport.cpp:672
SQLImport::~SQLImport
virtual ~SQLImport()
Definition: sqlimport.cpp:73
SQLImport::parseDefaultExpression
QString parseDefaultExpression(QString &token)
Definition: sqlimport.cpp:251
SQLImport::parseIdentifier
QString parseIdentifier(QString &token)
Definition: sqlimport.cpp:123
SQLImport::advance
virtual QString advance()
Definition: sqlimport.cpp:860
SQLImport::fillSource
void fillSource(const QString &word)
Definition: sqlimport.cpp:80
SQLImport::addForeignConstraint
bool addForeignConstraint(UMLEntity *entityA, const QString &name, const QStringList &fieldNames, const QString &referencedTable, const QStringList &referencedFields)
Definition: sqlimport.cpp:973
SQLImport::parseColumnConstraints
ColumnConstraints parseColumnConstraints(QString &token)
Definition: sqlimport.cpp:311
SQLImport::parseTableConstraints
TableConstraints parseTableConstraints(QString &token)
Definition: sqlimport.cpp:492
SQLImport::parseAlterTable
bool parseAlterTable(QString &token)
Definition: sqlimport.cpp:718
SQLImport::parseFieldType
QStringList parseFieldType(QString &token)
Definition: sqlimport.cpp:179
SQLImport::addPrimaryKey
bool addPrimaryKey(UMLEntity *entity, const QString &name, const QStringList &fields)
Definition: sqlimport.cpp:890
SQLImport::addUniqueConstraint
bool addUniqueConstraint(UMLEntity *entity, const QString &name, const QStringList &fields)
Definition: sqlimport.cpp:934
SQLImport::parseStmt
bool parseStmt()
Definition: sqlimport.cpp:804
SQLImport::SQLImport
SQLImport(CodeImpThread *thread=0)
Definition: sqlimport.cpp:65
SQLImport::addDatatype
UMLObject * addDatatype(const QStringList &type)
Definition: sqlimport.cpp:867
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:35
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
nativeimportbase.h