umbrello: SQLImport Class Reference

umbrello 2.31.0 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:

## 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 ()

## 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)
UMLObject * | addDatatype (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 | lookAhead ()
void | pushScope (UMLPackage *p)
UMLPackage * | popScope ()
UMLPackage * | currentScope ()
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 ClassImport * | createImporterByFileExt (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...
UMLClassifier * | m_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
CodeImpThread * | m_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

  thread | thread in which the code import runs

## ◆ ~SQLImport()

SQLImport::~SQLImport | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ addDatatype()

UMLObject * SQLImport::addDatatype | ( | const QStringList & | type | ) |
| protected

## ◆ 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

  entityA | entity object the foreign constraint belongs
  _name | name of foreign constraint
  fieldNames | list of field names
  referencedTable | referenced table name
  referencedFields | list of referenced field names

Returns
  true on success
  false on error

## ◆ addPrimaryKey()

bool SQLImport::addPrimaryKey | ( | UMLEntity * | entity,
|  | const QString & | name,
|  | const QStringList & | fields
| ) |  |
| protected

## ◆ addUniqueConstraint()

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

Add UML object for unique constraint.

Parameters

  entity | entity object
  _name | unique constraint name
  fields | field list

Returns
  true on success
  false on error

## ◆ advance()

QString SQLImport::advance | ( |  | ) |
| protectedvirtual

Implement virtual method

Returns
  string with next token

Reimplemented from NativeImportBase.

## ◆ 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

  token | string with current token

Returns
  true on success
  false on error

## ◆ 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

  token | string with current token

Returns
  column constraints

## ◆ parseCreateDefinition()

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

Parse table create definition.

Parameters

  token | string with current token
  entity | entity to save the definition into

Returns
  true on success
  false on error

## ◆ parseCreateTable()

bool SQLImport::parseCreateTable | ( | QString & | token | ) |
| protected

Parse create table statement.

Parameters

  token | string with current token

Returns
  true on success
  false on error

## ◆ parseDefaultExpression()

QString SQLImport::parseDefaultExpression | ( | QString & | token | ) |
| protected

Parse default expression.

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

Parameters

  token | string with current token

Returns
  string with default expression

## ◆ parseFieldType()

QStringList SQLImport::parseFieldType | ( | QString & | token | ) |
| protected

Parse field type.

Parameters

  token | string with current token

Returns
  string list containing field type (index 0), size/count (index 1) and optional values (index > 2)

## ◆ parseIdentifier()

QString SQLImport::parseIdentifier | ( | QString & | token | ) |
| protected

Parse identifier.

Parameters

  token | string with current token

Returns
  parsed identifier

## ◆ parseIdentifierList()

QStringList SQLImport::parseIdentifierList | ( | QString & | token | ) |
| protected

Parse identifier list.

Parameters

  token | string with current token

Returns
  string list with identifiers

## ◆ parseStmt()

bool SQLImport::parseStmt | ( |  | ) |
| virtual

Implement abstract operation from NativeImportBase.

Implements NativeImportBase.

## ◆ 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

  token | string with current token

Returns
  table constraints

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

- umbrello/codeimport/sqlimport.h
- umbrello/codeimport/sqlimport.cpp