umbrello: umbrello/codeimport/sqlimport.h Source File

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

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

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 QObject, public NativeImportBase {
23 Q_OBJECT
24public:
25 explicit SQLImport(CodeImpThread* thread = 0);
26 virtual ~SQLImport();
27
28 bool parseStmt();
29
30protected:
31 class ColumnConstraints {
32 public:
33 ColumnConstraints()
34 : primaryKey(false),
35 uniqueKey(false),
36 notNullConstraint(false),
37 autoIncrement(false)
38 {
39 }
40
41 bool primaryKey;
42 bool uniqueKey;
43 bool notNullConstraint;
44 bool autoIncrement;
45 QString collate;
46 QString defaultValue;
47 QString constraintName;
48 QString characterSet;
49 };
50
51 class TableConstraints {
52 public:
53 TableConstraints()
54 : primaryKey(false),
55 uniqueKeys(false),
56 notNullConstraint(false),
57 autoIncrement(false),
58 checkConstraint(false)
59 {
60 }
61
62 bool primaryKey;
63 bool uniqueKeys;
64 bool notNullConstraint;
65 bool autoIncrement;
66 bool checkConstraint;
67 QString checkExpression;
68 QStringList primaryKeyFields;
69 QString uniqueKeyName;
70 QStringList uniqueKeysFields;
71 QString collate;
72 QString defaultValue;
73 QString constraintName;
74 };
75
76 virtual QString advance();
77
78 void fillSource(const QString &word);
79 bool parseCreateTable(QString &token);
80 bool parseAlterTable(QString &token);
81 QString parseIdentifier(QString &token);
82 QString parseDefaultExpression(QString &token);
83 QStringList parseFieldType(QString &token);
84 QStringList parseIdentifierList(QString &token);
85 ColumnConstraints parseColumnConstraints(QString &token);
86 TableConstraints parseTableConstraints(QString &token);
87 bool parseCreateDefinition(QString &token, UMLEntity *entity);
88 UMLObject *addDatatype(const QStringList &type);
89 bool addPrimaryKey(UMLEntity *entity, const QString &name, const QStringList &fields);
90 bool addUniqueConstraint(UMLEntity *entity, const QString &name, const QStringList &fields);
91 bool addForeignConstraint(UMLEntity *entityA, const QString &name, const QStringList &fieldNames,
92 const QString &referencedTable, const QStringList &referencedFields);
93};
94
95#endif
96
CodeImpThread
Definition codeimpthread.h:22
NativeImportBase
Base class for native implementations of language import.
Definition nativeimportbase.h:40
SQLImport::ColumnConstraints
Definition sqlimport.h:31
SQLImport::ColumnConstraints::autoIncrement
bool autoIncrement
Definition sqlimport.h:44
SQLImport::ColumnConstraints::constraintName
QString constraintName
Definition sqlimport.h:47
SQLImport::ColumnConstraints::primaryKey
bool primaryKey
Definition sqlimport.h:41
SQLImport::ColumnConstraints::notNullConstraint
bool notNullConstraint
Definition sqlimport.h:43
SQLImport::ColumnConstraints::defaultValue
QString defaultValue
Definition sqlimport.h:46
SQLImport::ColumnConstraints::ColumnConstraints
ColumnConstraints()
Definition sqlimport.h:33
SQLImport::ColumnConstraints::uniqueKey
bool uniqueKey
Definition sqlimport.h:42
SQLImport::ColumnConstraints::characterSet
QString characterSet
Definition sqlimport.h:48
SQLImport::ColumnConstraints::collate
QString collate
Definition sqlimport.h:45
SQLImport::TableConstraints
Definition sqlimport.h:51
SQLImport::TableConstraints::primaryKey
bool primaryKey
Definition sqlimport.h:62
SQLImport::TableConstraints::autoIncrement
bool autoIncrement
Definition sqlimport.h:65
SQLImport::TableConstraints::primaryKeyFields
QStringList primaryKeyFields
Definition sqlimport.h:68
SQLImport::TableConstraints::TableConstraints
TableConstraints()
Definition sqlimport.h:53
SQLImport::TableConstraints::collate
QString collate
Definition sqlimport.h:71
SQLImport::TableConstraints::notNullConstraint
bool notNullConstraint
Definition sqlimport.h:64
SQLImport::TableConstraints::uniqueKeyName
QString uniqueKeyName
Definition sqlimport.h:69
SQLImport::TableConstraints::checkConstraint
bool checkConstraint
Definition sqlimport.h:66
SQLImport::TableConstraints::uniqueKeys
bool uniqueKeys
Definition sqlimport.h:63
SQLImport::TableConstraints::defaultValue
QString defaultValue
Definition sqlimport.h:72
SQLImport::TableConstraints::checkExpression
QString checkExpression
Definition sqlimport.h:67
SQLImport::TableConstraints::constraintName
QString constraintName
Definition sqlimport.h:73
SQLImport::TableConstraints::uniqueKeysFields
QStringList uniqueKeysFields
Definition sqlimport.h:70
SQLImport
Definition sqlimport.h:22
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::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::SQLImport
SQLImport(CodeImpThread *thread=0)
Definition sqlimport.cpp:44
SQLImport::addDatatype
UMLObject * addDatatype(const QStringList &type)
Definition sqlimport.cpp:848
UMLEntity
Non-graphical Information for an Entity.
Definition entity.h:30
UMLObject
The base class for UML objects.
Definition umlobject.h:70
nativeimportbase.h