umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SQLWriter Class Reference

#include <sqlwriter.h>

Inheritance diagram for SQLWriter:
Collaboration diagram for SQLWriter:

Public Member Functions

 SQLWriter ()
 
virtual ~SQLWriter ()
 
virtual void writeClass (UMLClassifier *c)
 
virtual Uml::ProgrammingLanguage::Enum language () const
 
virtual QStringList defaultDatatypes () const
 
virtual QStringList reservedKeywords () const
 
- Public Member Functions inherited from SimpleCodeGenerator
 SimpleCodeGenerator (bool createDirHierarchyForPackages=true)
 
virtual ~SimpleCodeGenerator ()
 
void writeCodeToFile (UMLClassifierList &concepts)
 
void writeCodeToFile ()
 
- Public Member Functions inherited from CodeGenerator
 CodeGenerator ()
 
virtual ~CodeGenerator ()
 
bool addCodeDocument (CodeDocument *add_object)
 
bool removeCodeDocument (CodeDocument *remove_object)
 
CodeDocumentListgetCodeDocumentList ()
 
QString getUniqueID (CodeDocument *codeDoc)
 
virtual void saveToXMI (QXmlStreamWriter &writer)
 
CodeDocumentfindCodeDocumentByID (const QString &id)
 
void setIncludeHeadings (bool i)
 
bool includeHeadings () const
 
void setHeadingFileDir (const QString &)
 
QString headingFileDir () const
 
void setForceDoc (bool f)
 
bool forceDoc () const
 
void setForceSections (bool f)
 
bool forceSections () const
 
virtual QString getHeadingFile (const QString &file)
 
QString findFileName (CodeDocument *codeDocument)
 
virtual void loadFromXMI (QDomElement &element)
 
CodeDocumentfindCodeDocumentByClassifier (UMLClassifier *classifier)
 
virtual bool isReservedKeyword (const QString &keyword)
 
virtual void createDefaultStereotypes ()
 

Protected Member Functions

virtual void printEntityAttributes (QTextStream &sql, UMLEntityAttributeList entityAttributeList)
 
virtual void printUniqueConstraints (QTextStream &sql, UMLClassifierListItemList constrList)
 
virtual void printForeignKeyConstraints (QTextStream &sql, UMLClassifierListItemList constrList)
 
virtual void printCheckConstraints (QTextStream &sql, UMLClassifierListItemList constrList)
 
virtual void printIndex (QTextStream &sql, UMLEntity *ent, UMLEntityAttributeList entAttList)
 
virtual void printAutoIncrements (QTextStream &sql, UMLEntityAttributeList entAttList)
 
- Protected Member Functions inherited from SimpleCodeGenerator
QString findFileName (UMLPackage *concept, const QString &ext)
 
QString overwritableName (UMLPackage *concept, const QString &name, const QString &ext)
 
bool hasDefaultValueAttr (UMLClassifier *c)
 
bool hasAbstractOps (UMLClassifier *c)
 
QString indent ()
 
virtual void initFromParentDocument ()
 
- Protected Member Functions inherited from CodeGenerator
QString overwritableName (const QString &name, const QString &extension)
 
bool openFile (QFile &file, const QString &name)
 
void writeListedCodeDocsToFile (CodeDocumentList *docs)
 
virtual void finalizeRun ()
 

Protected Attributes

QStringList m_enumsGenerated
 
UMLEntitym_pEntity
 
- Protected Attributes inherited from SimpleCodeGenerator
QString className_
 
QString fileName_
 
QMap< UMLPackage *, QString > m_fileMap
 
bool m_createDirHierarchyForPackages
 
QString m_indentation
 
int m_indentLevel
 
QString m_endl
 
- Protected Attributes inherited from CodeGenerator
QHash< QString, CodeDocument * > m_codeDocumentDictionary
 
bool m_applyToAllRemaining
 
UMLDocm_document
 

Additional Inherited Members

- Public Types inherited from CodeGenerator
enum  GenerationState { Generated , Failed , Skipped }
 
- Public Slots inherited from SimpleCodeGenerator
virtual void syncCodeToDocument ()
 
- Public Slots inherited from CodeGenerator
virtual void syncCodeToDocument ()
 
- Signals inherited from CodeGenerator
void codeGenerated (UMLClassifier *concept, bool generated)
 
void codeGenerated (UMLClassifier *concept, CodeGenerator::GenerationState result)
 
void showGeneratedFile (const QString &filename)
 
- Static Public Member Functions inherited from CodeGenerator
static QString cleanName (const QString &name)
 
static QString formatDoc (const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80)
 
static QString formatSourceCode (const QString &code, const QString &indentation)
 
static void findObjectsRelated (UMLClassifier *c, UMLPackageList &cList)
 

Detailed Description

Class SQLWriter is a code generator for UMLClassifier objects. Create an instance of this class, and feed it a UMLClassifier when calling writeClass and it will generate a sql source file for that concept.

Constructor & Destructor Documentation

◆ SQLWriter()

SQLWriter::SQLWriter ( )

◆ ~SQLWriter()

SQLWriter::~SQLWriter ( )
virtual

Member Function Documentation

◆ defaultDatatypes()

QStringList SQLWriter::defaultDatatypes ( ) const
virtual

Reimplement method from CodeGenerator.

Reimplemented from CodeGenerator.

Reimplemented in MySQLWriter, and PostgreSQLWriter.

◆ language()

Uml::ProgrammingLanguage::Enum SQLWriter::language ( ) const
virtual

Returns "SQL".

Implements CodeGenerator.

Reimplemented in MySQLWriter, and PostgreSQLWriter.

◆ printAutoIncrements()

void SQLWriter::printAutoIncrements ( QTextStream &  sql,
UMLEntityAttributeList  entAttList 
)
protectedvirtual

Handles AutoIncrements. The derived classes provide the actual body.

Parameters
sqlThe Stream we should print to
entAttListThe List of Entity Attributes that we want to auto increment

Reimplemented in MySQLWriter, and PostgreSQLWriter.

◆ printCheckConstraints()

void SQLWriter::printCheckConstraints ( QTextStream &  sql,
UMLClassifierListItemList  constrList 
)
protectedvirtual

Prints out Check Constraints as "ALTER TABLE" statements.

Parameters
sqlThe stream we should print to
constrListThe checkConstraints to be printed

Reimplemented in MySQLWriter.

Here is the call graph for this function:

◆ printEntityAttributes()

void SQLWriter::printEntityAttributes ( QTextStream &  sql,
UMLEntityAttributeList  entityAttributeList 
)
protectedvirtual

Prints out attributes as columns in the table.

Parameters
sqlthe stream we should print to
entityAttributeListthe attributes to be printed
Here is the call graph for this function:

◆ printForeignKeyConstraints()

void SQLWriter::printForeignKeyConstraints ( QTextStream &  sql,
UMLClassifierListItemList  constrList 
)
protectedvirtual

Prints out foreign key constraints as "ALTER TABLE" statements.

Parameters
sqlthe stream we should print to
constrListthe foreignkey constraints to be printed

Reimplemented in MySQLWriter.

Here is the call graph for this function:

◆ printIndex()

void SQLWriter::printIndex ( QTextStream &  sql,
UMLEntity ent,
UMLEntityAttributeList  entAttList 
)
protectedvirtual

Prints out Indexes as "CREATE INDEX " statements.

Parameters
sqlThe Stream we should print to
entThe Entity's attributes on which we want to create an Index
entAttListThe list of entityattributes to create an index upon
Here is the call graph for this function:

◆ printUniqueConstraints()

void SQLWriter::printUniqueConstraints ( QTextStream &  sql,
UMLClassifierListItemList  constrList 
)
protectedvirtual

Prints out unique constraints (including primary key) as "ALTER TABLE" statements.

Parameters
sqlthe stream we should print to
constrListthe unique constraints to be printed
Here is the call graph for this function:

◆ reservedKeywords()

QStringList SQLWriter::reservedKeywords ( ) const
virtual

Get list of reserved keywords.

Reimplemented from CodeGenerator.

◆ writeClass()

void SQLWriter::writeClass ( UMLClassifier c)
virtual

Call this method to generate sql code for a UMLClassifier.

Parameters
cthe class to generate code for

Implements SimpleCodeGenerator.

Here is the call graph for this function:

Member Data Documentation

◆ m_enumsGenerated

QStringList SQLWriter::m_enumsGenerated
protected

◆ m_pEntity

UMLEntity* SQLWriter::m_pEntity
protected

The documentation for this class was generated from the following files: