|
LibEngsas
|
Represents an sql table.This class is used with ESqlInit to define database schemas. More...
#include <esqltable.h>
Inheritance diagram for ESqlTable:
Collaboration diagram for ESqlTable:Public Types | |
| enum | FkAction { NoAction, SetNull, Cascade, Restrict } |
| Actions, which are done, if an foreign key is changed. More... | |
Public Member Functions | |
| ESqlTable (QString name="") | |
| ~ESqlTable () | |
| bool | isValid () |
| QString | name () |
| void | setName (QString name) |
| QList< ESqlField * > | fields () |
| void | appendField (ESqlField *append) |
| ESqlField * | appendField (QString name="", ESqlField::Type type=ESqlField::NoType, bool notNull=false, bool autoIncrement=false) |
| Adds a new field (also called column) to the table. More... | |
| void | appendFieldId (QString name="id") |
| ESqlField * | appendFieldVarchar (QString name="", uint length=45, bool notNull=false) |
Appends a field of type ESqlField::Varchar with lenght length. More... | |
| bool | appendValues (QStringList value) |
| QList< QStringList > | values () |
| void | addForeignKey (QString fieldName, QString refTable, QString refFieldName="id", ESqlTable::FkAction del=ESqlTable::NoAction, ESqlTable::FkAction update=ESqlTable::NoAction) |
Changes column fieldName from this table to reference another table. More... | |
| void | addForeignKey (ESqlField *ourField, ESqlTable *refTable, ESqlTable::FkAction del=ESqlTable::NoAction, ESqlTable::FkAction update=ESqlTable::NoAction) |
Changes ourField to reference another table. More... | |
| void | addForeignKey (ESqlTable *refTable, QString newFieldName=QString(), ESqlTable::FkAction del=ESqlTable::NoAction, ESqlTable::FkAction update=ESqlTable::NoAction, QString idFieldName="id") |
Adds renamed field from refTable to reference that table. More... | |
| QString | sqlConstraintsString (EngSaS::SQL::DatabaseType type=EngSaS::SQL::Other) |
| void | addIndex (QString fieldName, unsigned int length=0, Qt::SortOrder order=Qt::AscendingOrder) |
| void | addIndex (ESqlField *field, unsigned int length=0, Qt::SortOrder order=Qt::AscendingOrder) |
| QString | indizes () |
| QString | createStatement (QString dbName, EngSaS::SQL::DatabaseType type) |
| Creates the SQL statements which are needed to create this table. More... | |
Public Member Functions inherited from EObject | |
| EObject (QObject *parent=0) | |
| virtual | ~EObject () |
| void | connectByPass (QObject *object) |
Private Attributes | |
| QString | tableName |
| QList< ESqlField * > | myFields |
| QList< QStringList > | myValues |
| QList< QStringList > | constraints |
| QStringList | myIndizes |
| QMultiHash< ESqlTable::FkAction, QString > | fkActionMap |
Additional Inherited Members | |
Public Slots inherited from EObject | |
| virtual void | reloadSettings () |
| Used to reload the settings. More... | |
Signals inherited from EObject | |
| void | error (const QString &message) |
| void | warning (const QString &message) |
| void | information (const QString &message) |
| void | reloadEnableActions () |
| Request reloading of enabled actions in EMainWindow. More... | |
| void | addMenu (QMenu *newMenu, const QString &parent, QString before=QString()) |
| void | addAction (QAction *newAction, const QString &parent, QString before=QString()) |
| void | addToolBar (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea) |
| void | addNewDockWidget (QDockWidget *widget, const Qt::DockWidgetArea &area) |
| void | setCentralWidget (QWidget *centralWidget) |
| void | showSettings () |
| void | showHelp (const QString &page) |
| void | showStatusWidget (QWidget *widget) |
| void | reloadSettingsRequest () |
| Indicates, that a reload of the settings is needed. More... | |
| void | doReloadSettings () |
| Emitted to bring the reload request back to the farest child. More... | |
Static Public Member Functions inherited from EObject | |
| static void | connectByPass (QObject *parent, QObject *child) |
Protected Slots inherited from EObject | |
| virtual void | errorByPass (const QString &message) |
| virtual void | warningByPass (const QString &message) |
| virtual void | informationByPass (const QString &message) |
| virtual void | reloadEnableActionsByPass () |
| virtual void | addMenuByPass (QMenu *newMenu, const QString &parent, QString before=QString()) |
| virtual void | addActionByPass (QAction *newAction, const QString &parent, QString before=QString()) |
| virtual void | addToolBarByPass (QToolBar *newToolBar, Qt::ToolBarArea area=Qt::TopToolBarArea) |
| virtual void | addNewDockWidgetByPass (QDockWidget *widget, const Qt::DockWidgetArea &area) |
| virtual void | setCentralWidgetByPass (QWidget *centralWidget) |
| virtual void | showSettingsByPass () |
| virtual void | showHelpByPass (const QString &page) |
| virtual void | showStatusWidgetByPass (QWidget *widget) |
| virtual void | reloadSettingsRequestByPass () |
Protected Member Functions inherited from EObject | |
| void | addManagedDockWidget (QDockWidget *widget, const Qt::DockWidgetArea &area, QString actionLabel=QString(), QString actionParent=QString()) |
Adds an dock widget via addNewDockWidget() and adds widget to the list of managed dock widgets. More... | |
Represents an sql table.
This class is used with ESqlInit to define database schemas.
| enum ESqlTable::FkAction |
| ESqlTable::ESqlTable | ( | QString | name = "" | ) |
Here is the call graph for this function:| ESqlTable::~ESqlTable | ( | ) |
| void ESqlTable::addForeignKey | ( | QString | fieldName, |
| QString | refTable, | ||
| QString | refFieldName = "id", |
||
| ESqlTable::FkAction | del = ESqlTable::NoAction, |
||
| ESqlTable::FkAction | update = ESqlTable::NoAction |
||
| ) |
Changes column fieldName from this table to reference another table.
The added column will have the name fieldName and references the field refFieldName at the table refTable. With del and update, you can specify actions on deletion and update of the referenced field.
Here is the caller graph for this function:| void ESqlTable::addForeignKey | ( | ESqlField * | ourField, |
| ESqlTable * | refTable, | ||
| ESqlTable::FkAction | del = ESqlTable::NoAction, |
||
| ESqlTable::FkAction | update = ESqlTable::NoAction |
||
| ) |
Changes ourField to reference another table.
The field ourField at this table is changed to reference the standard id field of the table refTable. With del and update, you can specify actions on deletion and update of the referenced field.
Here is the call graph for this function:| void ESqlTable::addForeignKey | ( | ESqlTable * | refTable, |
| QString | newFieldName = QString(), |
||
| ESqlTable::FkAction | del = ESqlTable::NoAction, |
||
| ESqlTable::FkAction | update = ESqlTable::NoAction, |
||
| QString | idFieldName = "id" |
||
| ) |
Adds renamed field from refTable to reference that table.
Tries to add a copy of the id field of refTable to this table. It renames the field to "refTableNameId" or if given to newFieldName. Also an foreignkey entry is added for the newly added field. With del and update, you can specify actions on deletion and update of the referenced field. With idFieldName, the name of the used field name in refTable can be changed from the default value into another value.
Here is the call graph for this function:| void ESqlTable::addIndex | ( | QString | fieldName, |
| unsigned int | length = 0, |
||
| Qt::SortOrder | order = Qt::AscendingOrder |
||
| ) |
overlaods addIndex(field length, order), to use it without ESqlFields
Here is the call graph for this function:
Here is the caller graph for this function:| void ESqlTable::addIndex | ( | ESqlField * | field, |
| unsigned int | length = 0, |
||
| Qt::SortOrder | order = Qt::AscendingOrder |
||
| ) |
adds an Index to field field The Index gets the length length, if length is greater null. The used sortorder is order
Here is the call graph for this function:| void ESqlTable::appendField | ( | ESqlField * | append | ) |
Here is the call graph for this function:
Here is the caller graph for this function:| ESqlField * ESqlTable::appendField | ( | QString | name = "", |
| ESqlField::Type | type = ESqlField::NoType, |
||
| bool | notNull = false, |
||
| bool | autoIncrement = false |
||
| ) |
Adds a new field (also called column) to the table.
To add fields of type ESqlField::Varchar, you may want to use appendFieldVarchar().
Here is the call graph for this function:| void ESqlTable::appendFieldId | ( | QString | name = "id" | ) |
append's the id standard field name: id type: unsigned integer autoincremented, not null
Here is the call graph for this function:
Here is the caller graph for this function:| ESqlField * ESqlTable::appendFieldVarchar | ( | QString | name = "", |
| uint | length = 45, |
||
| bool | notNull = false |
||
| ) |
Appends a field of type ESqlField::Varchar with lenght length.
It's a shorter form for
Here is the call graph for this function:| bool ESqlTable::appendValues | ( | QStringList | value | ) |
| QString ESqlTable::createStatement | ( | QString | dbName, |
| EngSaS::SQL::DatabaseType | type | ||
| ) |
Creates the SQL statements which are needed to create this table.
With dbName a database can be given, in which the table should be created. If sqlite is set to true, it respects sqlite specific behaviour.
Here is the call graph for this function:
Here is the caller graph for this function:| QList< ESqlField * > ESqlTable::fields | ( | ) |
Here is the caller graph for this function:| QString ESqlTable::indizes | ( | ) |
Here is the caller graph for this function:| bool ESqlTable::isValid | ( | ) |
Here is the call graph for this function:| QString ESqlTable::name | ( | ) |
Here is the caller graph for this function:| void ESqlTable::setName | ( | QString | name | ) |
Here is the call graph for this function:
Here is the caller graph for this function:| QString ESqlTable::sqlConstraintsString | ( | EngSaS::SQL::DatabaseType | type = EngSaS::SQL::Other | ) |
Here is the call graph for this function:
Here is the caller graph for this function:| QList< QStringList > ESqlTable::values | ( | ) |
Here is the caller graph for this function:
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.15