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

#include <sqlimport.h>

Inheritance diagram for SQLImport:
Collaboration diagram for SQLImport:

Classes

class  ColumnConstraints
 
class  TableConstraints
 

Public Member Functions

 SQLImport (CodeImpThread *thread=0)
 
virtual ~SQLImport ()
 
bool parseStmt ()
 
- Public Member Functions inherited from NativeImportBase
 NativeImportBase (const QString &singleLineCommentIntro, CodeImpThread *thread=0)
 
virtual ~NativeImportBase ()
 
- Public Member Functions inherited from ClassImport
 ClassImport (CodeImpThread *thread=0)
 
virtual ~ClassImport ()
 
bool importFiles (const QStringList &fileNames)
 
bool importFile (const QString &fileName)
 
void setRootPath (const QString &path)
 
bool enabled () const
 

Protected Member Functions

virtual QString advance ()
 
void fillSource (const QString &word)
 
bool parseCreateTable (QString &token)
 
bool parseAlterTable (QString &token)
 
QString parseIdentifier (QString &token)
 
QString parseDefaultExpression (QString &token)
 
QStringList parseFieldType (QString &token)
 
QStringList parseIdentifierList (QString &token)
 
ColumnConstraints parseColumnConstraints (QString &token)
 
TableConstraints parseTableConstraints (QString &token)
 
bool parseCreateDefinition (QString &token, UMLEntity *entity)
 
UMLObjectaddDatatype (const QStringList &type)
 
bool addPrimaryKey (UMLEntity *entity, const QString &name, const QStringList &fields)
 
bool addUniqueConstraint (UMLEntity *entity, const QString &name, const QStringList &fields)
 
bool addForeignConstraint (UMLEntity *entityA, const QString &name, const QStringList &fieldNames, const QString &referencedTable, const QStringList &referencedFields)
 
- Protected Member Functions inherited from NativeImportBase
void initialize ()
 
void setMultiLineComment (const QString &intro, const QString &end)
 
void setMultiLineAltComment (const QString &intro, const QString &end)
 
virtual bool parseFile (const QString &filename)
 
virtual void initVars ()
 
void scan (const QString &line)
 
virtual bool preprocess (QString &line)
 
virtual QStringList split (const QString &line)
 
void skipStmt (const QString &until=QLatin1String(";"))
 
bool skipToClosing (QChar opener)
 
QString current ()
 
QString lookAhead ()
 
void pushScope (UMLPackage *p)
 
UMLPackagepopScope ()
 
UMLPackagecurrentScope ()
 
int scopeIndex ()
 
- Protected Member Functions inherited from ClassImport
virtual void initPerFile ()
 
void log (const QString &file, const QString &text)
 
void log (const QString &text)
 

Additional Inherited Members

- Static Public Member Functions inherited from ClassImport
static ClassImportcreateImporterByFileExt (const QString &fileName, CodeImpThread *thread=0)
 
- Protected Attributes inherited from NativeImportBase
QString m_singleLineCommentIntro
 start token of a single line comment More...
 
QStringList m_source
 the scanned lexemes More...
 
int m_srcIndex
 used for indexing m_source More...
 
QList< UMLPackage * > m_scope
 stack of scopes for use by the specific importer More...
 
UMLClassifierm_klass
 class currently being processed More...
 
Uml::Visibility::Enum m_currentAccess
 current access (public/protected/private) More...
 
QString m_comment
 intermediate accumulator for comment text More...
 
bool m_inComment
 
bool m_isAbstract
 accumulator for abstractness More...
 
QString m_multiLineCommentIntro
 multi line comment delimiter intro More...
 
QString m_multiLineCommentEnd
 multi line comment delimiter end More...
 
QString m_multiLineAltCommentIntro
 
QString m_multiLineAltCommentEnd
 
- Protected Attributes inherited from ClassImport
CodeImpThreadm_thread
 thread in which the work of importing is done More...
 
bool m_enabled
 state of importer More...
 
QString m_rootPath
 root path of import More...
 
- Static Protected Attributes inherited from NativeImportBase
static QStringList m_parsedFiles
 

Detailed Description

Postgresql/mysql code import

Author
Ralf Habacker ralf..nosp@m.haba.nosp@m.cker@.nosp@m.free.nosp@m.net.d.nosp@m.e

Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

Constructor & Destructor Documentation

◆ SQLImport()

SQLImport::SQLImport ( CodeImpThread thread = 0)
explicit

Constructor.

Parameters
threadthread in which the code import runs

◆ ~SQLImport()

SQLImport::~SQLImport ( )
virtual

Destructor.

Member Function Documentation

◆ addDatatype()

UMLObject * SQLImport::addDatatype ( const QStringList &  type)
protected
Here is the call graph for this function:

◆ addForeignConstraint()

bool SQLImport::addForeignConstraint ( UMLEntity entityA,
const QString &  _name,
const QStringList &  fieldNames,
const QString &  referencedTable,
const QStringList &  referencedFields 
)
protected

Add UML object foreign constraint.

Parameters
entityAentity object the foreign constraint belongs
_namename of foreign constraint
fieldNameslist of field names
referencedTablereferenced table name
referencedFieldslist of referenced field names
Returns
true on success
false on error
Here is the call graph for this function:

◆ addPrimaryKey()

bool SQLImport::addPrimaryKey ( UMLEntity entity,
const QString &  name,
const QStringList &  fields 
)
protected
Here is the call graph for this function:

◆ addUniqueConstraint()

bool SQLImport::addUniqueConstraint ( UMLEntity entity,
const QString &  _name,
const QStringList &  fields 
)
protected

Add UML object for unique constraint.

Parameters
entityentity object
_nameunique constraint name
fieldsfield list
Returns
true on success
false on error
Here is the call graph for this function:

◆ advance()

QString SQLImport::advance ( )
protectedvirtual

Implement virtual method

Returns
string with next token

Reimplemented from NativeImportBase.

Here is the call graph for this function:

◆ fillSource()

void SQLImport::fillSource ( const QString &  word)
protectedvirtual

Implement abstract operation from NativeImportBase.

Implements NativeImportBase.

◆ parseAlterTable()

bool SQLImport::parseAlterTable ( QString &  token)
protected

Parse alter table statement.

Parameters
tokenstring with current token
Returns
true on success
false on error
Here is the call graph for this function:

◆ parseColumnConstraints()

SQLImport::ColumnConstraints SQLImport::parseColumnConstraints ( QString &  token)
protected

Parse column constraint.

pgsql: [ CONSTRAINT constraint_name ] { NOT NULL | NULL | CHECK ( expression ) | COLLATE collation | DEFAULT default_expr | UNIQUE index_parameters | PRIMARY KEY index_parameters | REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]

mysql: [ PRIMARY KEY index_parameters | KEY key_name ( fields ) CHARACTER SET charset_name | COLLATE collation ]

Parameters
tokenstring with current token
Returns
column constraints
Here is the call graph for this function:

◆ parseCreateDefinition()

bool SQLImport::parseCreateDefinition ( QString &  token,
UMLEntity entity 
)
protected

Parse table create definition.

Parameters
tokenstring with current token
entityentity to save the definition into
Returns
true on success
false on error
Here is the call graph for this function:

◆ parseCreateTable()

bool SQLImport::parseCreateTable ( QString &  token)
protected

Parse create table statement.

Parameters
tokenstring with current token
Returns
true on success
false on error
Here is the call graph for this function:

◆ parseDefaultExpression()

QString SQLImport::parseDefaultExpression ( QString &  token)
protected

Parse default expression.

The expression could be in the form (expression)::<type> function(expression)

Parameters
tokenstring with current token
Returns
string with default expression
Here is the call graph for this function:

◆ parseFieldType()

QStringList SQLImport::parseFieldType ( QString &  token)
protected

Parse field type.

Parameters
tokenstring with current token
Returns
string list containing field type (index 0), size/count (index 1) and optional values (index > 2)
Here is the call graph for this function:

◆ parseIdentifier()

QString SQLImport::parseIdentifier ( QString &  token)
protected

Parse identifier.

Parameters
tokenstring with current token
Returns
parsed identifier
Here is the call graph for this function:

◆ parseIdentifierList()

QStringList SQLImport::parseIdentifierList ( QString &  token)
protected

Parse identifier list.

Parameters
tokenstring with current token
Returns
string list with identifiers
Here is the call graph for this function:

◆ parseStmt()

bool SQLImport::parseStmt ( )
virtual

Implement abstract operation from NativeImportBase.

Implements NativeImportBase.

Here is the call graph for this function:

◆ parseTableConstraints()

SQLImport::TableConstraints SQLImport::parseTableConstraints ( QString &  token)
protected

Parse table constraint.

pgsql:

[ CONSTRAINT constraint_name ] { CHECK ( expression ) | UNIQUE ( column_name [, ... ] ) index_parameters | PRIMARY KEY ( column_name [, ... ] ) index_parameters | EXCLUDE [ USING index_method ] ( exclude_element WITH operator [, ... ] ) index_parameters [ WHERE ( predicate ) ] | FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE action ] } [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]

mysql: PRIMARY KEY (`uid`, `pid`) | KEY `t3ver_oid` (`t3ver_oid`,`t3ver_wsid`) UNIQUE KEY `entry_identifier` (`entry_namespace`,`entry_key`)

Parameters
tokenstring with current token
Returns
table constraints
Here is the call graph for this function:

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