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

sqlwriter.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2003 Nikolaus Gradwohl <guru@local-guru.net> *
8 * copyright (C) 2004-2020 *
9 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
10 ***************************************************************************/
11
12 #ifndef SQLWRITER_H
13 #define SQLWRITER_H
14
15 #include "simplecodegenerator.h"
16 #include "umlattributelist.h"
17
18 //forward declarations
19 class UMLEntity;
20 class UMLEntityAttributeList;
21 class UMLClassifierListItemList;
22
29 class SQLWriter : public SimpleCodeGenerator
30 {
31 Q_OBJECT
32 public:
33
34 SQLWriter();
35 virtual ~SQLWriter();
36
37 virtual void writeClass(UMLClassifier *c);
38
39 virtual Uml::ProgrammingLanguage::Enum language() const;
40
41 virtual QStringList defaultDatatypes();
42
43 virtual QStringList reservedKeywords() const;
44
45 protected:
46 QStringList m_enumsGenerated;
47 UMLEntity* m_pEntity;
48
49 virtual void printEntityAttributes(QTextStream& sql, UMLEntityAttributeList entityAttributeList);
50 virtual void printUniqueConstraints(QTextStream& sql, UMLClassifierListItemList constrList);
51 virtual void printForeignKeyConstraints(QTextStream& sql, UMLClassifierListItemList constrList);
52 virtual void printCheckConstraints(QTextStream& sql, UMLClassifierListItemList constrList);
53 virtual void printIndex(QTextStream& sql, UMLEntity* ent, UMLEntityAttributeList entAttList);
54 virtual void printAutoIncrements(QTextStream& sql, UMLEntityAttributeList entAttList);
55 };
56
57 #endif // SQLWRITER_H
UMLForeignKeyConstraint::getUpdateAction
UpdateDeleteAction getUpdateAction() const
Definition: foreignkeyconstraint.cpp:425
SQLWriter::reservedKeywords
virtual QStringList reservedKeywords() const
Definition: sqlwriter.cpp:366
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: foreignkeyconstraint.h:42
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
UMLEntity
Non-graphical Information for an Entity.
Definition: entity.h:35
umlattributelist.h
checkconstraint.h
SimpleCodeGenerator::m_indentation
QString m_indentation
Definition: simplecodegenerator.h:76
Uml::ProgrammingLanguage::Enum
Enum
Definition: basictypes.h:271
Uml::ProgrammingLanguage::PostgreSQL
@ PostgreSQL
Definition: basictypes.h:285
UMLObject::ot_CheckConstraint
@ ot_CheckConstraint
Definition: umlobject.h:107
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
Model_Utils::updateDeleteActionToString
QString updateDeleteActionToString(UMLForeignKeyConstraint::UpdateDeleteAction uda)
Definition: model_utils.cpp:2142
CodeGenerator::getHeadingFile
virtual QString getHeadingFile(const QString &file)
Definition: codegenerator.cpp:407
entity.h
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Definition: codegenerator.cpp:549
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: classifier.cpp:998
UMLObject::ot_ForeignKeyConstraint
@ ot_ForeignKeyConstraint
Definition: umlobject.h:106
operation.h
UMLClassifierListItem::getType
UMLClassifier * getType() const
Definition: classifierlistitem.cpp:102
UMLAttribute::getInitialValue
QString getInitialValue() const
Definition: attribute.cpp:99
foreignkeyconstraint.h
UMLClassifierListItem::getTypeName
virtual QString getTypeName() const
Definition: classifierlistitem.cpp:112
UMLForeignKeyConstraint
Sets up Foreign Key entity constraint information.
Definition: foreignkeyconstraint.h:33
Uml::RoleType::A
@ A
Definition: basictypes.h:239
Uml::ProgrammingLanguage::MySQL
@ MySQL
Definition: basictypes.h:280
SQLWriter
Definition: sqlwriter.h:30
association.h
SQLWriter::printIndex
virtual void printIndex(QTextStream &sql, UMLEntity *ent, UMLEntityAttributeList entAttList)
Definition: sqlwriter.cpp:586
UMLEntity::getEntityAttributes
UMLEntityAttributeList getEntityAttributes() const
Definition: entity.cpp:692
SQLWriter::m_enumsGenerated
QStringList m_enumsGenerated
Definition: sqlwriter.h:46
model_utils.h
UMLEntityAttribute::getAttributes
QString getAttributes() const
Definition: entityattribute.cpp:75
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
SQLWriter::language
virtual Uml::ProgrammingLanguage::Enum language() const
Definition: sqlwriter.cpp:325
UMLObject::asUMLCheckConstraint
UMLCheckConstraint * asUMLCheckConstraint()
Definition: umlobject.cpp:1308
UMLObject::asUMLEnum
UMLEnum * asUMLEnum()
Definition: umlobject.cpp:1316
UMLObject::baseType
ObjectType baseType() const
Definition: umlobject.cpp:397
UMLForeignKeyConstraint::getReferencedEntity
UMLEntity * getReferencedEntity() const
Definition: foreignkeyconstraint.cpp:350
CodeGenerator::forceDoc
bool forceDoc() const
Definition: codegenerator.cpp:765
UMLObject::ot_EnumLiteral
@ ot_EnumLiteral
Definition: umlobject.h:94
UMLObject::asUMLEntity
UMLEntity * asUMLEntity()
Definition: umlobject.cpp:1313
SQLWriter::SQLWriter
SQLWriter()
Definition: sqlwriter.cpp:177
umlclassifierlistitemlist.h
UMLEntityAttribute::getValues
QString getValues() const
Definition: entityattribute.cpp:93
UMLEntityAttribute::getNull
bool getNull() const
Definition: entityattribute.cpp:147
CodeGenerator::showGeneratedFile
void showGeneratedFile(const QString &filename)
Definition: moc_codegenerator.cpp:161
Uml::ProgrammingLanguage::SQL
@ SQL
Definition: basictypes.h:288
SQLWriter::printUniqueConstraints
virtual void printUniqueConstraints(QTextStream &sql, UMLClassifierListItemList constrList)
Definition: sqlwriter.cpp:460
umlentityattributelist.h
attribute.h
a
QString a
Definition: petalnode.cpp:18
SimpleCodeGenerator::m_endl
QString m_endl
Definition: simplecodegenerator.h:78
UMLObject::asUMLForeignKeyConstraint
UMLForeignKeyConstraint * asUMLForeignKeyConstraint()
Definition: umlobject.cpp:1319
reserved_words
static const char * reserved_words[]
Definition: sqlwriter.cpp:36
SQLWriter::printForeignKeyConstraints
virtual void printForeignKeyConstraints(QTextStream &sql, UMLClassifierListItemList constrList)
Definition: sqlwriter.cpp:507
UMLForeignKeyConstraint::getEntityAttributePairs
QMap< UMLEntityAttribute *, UMLEntityAttribute * > getEntityAttributePairs()
Definition: foreignkeyconstraint.cpp:409
CodeGenerator::formatDoc
static QString formatDoc(const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80)
Definition: codegenerator.cpp:712
SimpleCodeGenerator
Definition: simplecodegenerator.h:34
Uml::RoleType::B
@ B
Definition: basictypes.h:240
SQLWriter::printCheckConstraints
virtual void printCheckConstraints(QTextStream &sql, UMLClassifierListItemList constrList)
Definition: sqlwriter.cpp:634
UMLEntity::getFilteredList
UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: entity.cpp:645
UMLObject::ot_UniqueConstraint
@ ot_UniqueConstraint
Definition: umlobject.h:105
SQLWriter::~SQLWriter
virtual ~SQLWriter()
Definition: sqlwriter.cpp:182
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:435
SQLWriter::m_pEntity
UMLEntity * m_pEntity
Definition: sqlwriter.h:47
UMLCanvasObject::getRelationships
UMLAssociationList getRelationships()
Definition: umlcanvasobject.cpp:432
UMLEntityAttributeList
Definition: umlentityattributelist.h:26
UMLCheckConstraint::getCheckCondition
QString getCheckCondition() const
Definition: checkconstraint.h:51
UMLEntityAttribute::Index
@ Index
Definition: entityattribute.h:34
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:27
CodeGenerator::codeGenerated
void codeGenerated(UMLClassifier *concept, bool generated)
Definition: moc_codegenerator.cpp:154
classifier.h
uError
#define uError()
Definition: debug_utils.h:123
UMLObject::asUMLUniqueConstraint
UMLUniqueConstraint * asUMLUniqueConstraint()
Definition: umlobject.cpp:1330
uniqueconstraint.h
UMLObject::ot_Enum
@ ot_Enum
Definition: umlobject.h:88
UMLForeignKeyConstraint::getDeleteAction
UpdateDeleteAction getDeleteAction() const
Definition: foreignkeyconstraint.cpp:417
UMLObject::baseTypeStr
QLatin1String baseTypeStr() const
Definition: umlobject.cpp:405
UMLCheckConstraint
Sets up Check Constraint information for UMLEntities.
Definition: checkconstraint.h:26
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
UMLAssociation
Sets up association information.
Definition: association.h:33
UMLUniqueConstraint::getEntityAttributeList
UMLEntityAttributeList getEntityAttributeList() const
Definition: uniqueconstraint.cpp:310
SQLWriter::printEntityAttributes
virtual void printEntityAttributes(QTextStream &sql, UMLEntityAttributeList entityAttributeList)
Definition: sqlwriter.cpp:384
UMLEntity::isPrimaryKey
bool isPrimaryKey(UMLUniqueConstraint *uConstr) const
Definition: entity.cpp:679
simplecodegenerator.h
UMLEntityAttribute
Sets up entityattribute information.
Definition: entityattribute.h:26
CodeGenerator::forceSections
bool forceSections() const
Definition: codegenerator.cpp:775
SQLWriter::printAutoIncrements
virtual void printAutoIncrements(QTextStream &sql, UMLEntityAttributeList entAttList)
Definition: sqlwriter.cpp:623
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
SQLWriter::defaultDatatypes
virtual QStringList defaultDatatypes()
Definition: sqlwriter.cpp:333
UMLEnum
Non-graphical Information for an Enum.
Definition: enum.h:29
sqlwriter.h
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:18
SQLWriter::writeClass
virtual void writeClass(UMLClassifier *c)
Definition: sqlwriter.cpp:190
SimpleCodeGenerator::findFileName
QString findFileName(UMLPackage *concept, const QString &ext)
Definition: simplecodegenerator.cpp:91
UMLUniqueConstraint
Sets up Unique entity constraint information.
Definition: uniqueconstraint.h:29
CodeGenerator::openFile
bool openFile(QFile &file, const QString &name)
Definition: codegenerator.cpp:523
UMLEntityAttribute::indexType
DBIndex_Type indexType() const
Definition: entityattribute.cpp:129
enum.h