KDbAlterTableHandler::ChangeFieldPropertyAction

Search for usage in LXR

KDbAlterTableHandler::ChangeFieldPropertyAction Class Reference

#include <KDbAlter.h>

Inheritance diagram for KDbAlterTableHandler::ChangeFieldPropertyAction:

Public Member Functions

 ChangeFieldPropertyAction ()
 
 ChangeFieldPropertyAction (const QString &fieldName, const QString &propertyName, const QVariant &newValue, int uid)
 
QString debugString (const DebugOptions &debugOptions=DebugOptions()) override
 
QVariant newValue () const
 
QString propertyName () const
 
bool shouldBeRemoved (ActionDictDict *fieldActions) override
 
void simplifyActions (ActionDictDict *fieldActions) override
 
tristate updateTableSchema (KDbTableSchema *table, KDbField *field, QHash< QString, QString > *fieldHash) override
 
- Public Member Functions inherited from KDbAlterTableHandler::FieldActionBase
 FieldActionBase (const QString &fieldName, int uid)
 
QString fieldName () const
 
void setFieldName (const QString &fieldName)
 
int uid () const
 
- Public Member Functions inherited from KDbAlterTableHandler::ActionBase
void debug (const DebugOptions &debugOptions=DebugOptions())
 
bool isNull () const
 
ChangeFieldPropertyActiontoChangeFieldPropertyAction ()
 
InsertFieldActiontoInsertFieldAction ()
 
MoveFieldPositionActiontoMoveFieldPositionAction ()
 
RemoveFieldActiontoRemoveFieldAction ()
 

Protected Member Functions

 ChangeFieldPropertyAction (bool null)
 
tristate execute (KDbConnection *conn, KDbTableSchema *table) override
 
void updateAlteringRequirements () override
 
- Protected Member Functions inherited from KDbAlterTableHandler::FieldActionBase
 FieldActionBase (bool null)
 
- Protected Member Functions inherited from KDbAlterTableHandler::ActionBase
 ActionBase (bool null)
 
int alteringRequirements () const
 
void setAlteringRequirements (int alteringRequirements)
 

Protected Attributes

QVariant m_newValue
 
QString m_propertyName
 
- Protected Attributes inherited from KDbAlterTableHandler::FieldActionBase
int m_fieldUID
 

Detailed Description

Defines an action for changing a single property value of a table field. Supported properties are currently: "name", "type", "caption", "description", "unsigned", "maxLength", "precision", "defaultWidth", "defaultValue", "primaryKey", "unique", "notNull", "allowEmpty", "autoIncrement", "indexed", "visibleDecimalPlaces"

More to come.

Definition at line 295 of file KDbAlter.h.

Constructor & Destructor Documentation

◆ ChangeFieldPropertyAction() [1/2]

KDbAlterTableHandler::ChangeFieldPropertyAction::ChangeFieldPropertyAction ( )

Creates null action.

Definition at line 202 of file KDbAlter.cpp.

◆ ChangeFieldPropertyAction() [2/2]

KDbAlterTableHandler::ChangeFieldPropertyAction::ChangeFieldPropertyAction ( bool  null)
explicitprotected

, used for constructing null action

Definition at line 207 of file KDbAlter.cpp.

Member Function Documentation

◆ execute()

tristate KDbAlterTableHandler::ChangeFieldPropertyAction::execute ( KDbConnection conn,
KDbTableSchema table 
)
overrideprotectedvirtual

Performs physical execution of this action.

Many of the properties must be applied using a separate algorithm.

Todo:
errmsg
Todo:

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 422 of file KDbAlter.cpp.

◆ shouldBeRemoved()

bool KDbAlterTableHandler::ChangeFieldPropertyAction::shouldBeRemoved ( ActionDictDict fieldActions)
overridevirtual

After calling simplifyActions() for each action, shouldBeRemoved() is called for them as an additional step. This is used for ChangeFieldPropertyAction items so actions that do not change property values are removed.

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 394 of file KDbAlter.cpp.

◆ simplifyActions()

void KDbAlterTableHandler::ChangeFieldPropertyAction::simplifyActions ( ActionDictDict fieldActions)
overridevirtual

Legend: A,B==fields, P==property, [....]==action, (..,..,..) group of actions, <...> internal operation. Case 1. (special) when new action=[rename A to B] and exists=[rename B to C] => remove [rename B to C] and set result to new [rename A to C] and go to 1b. Case 1b. when new action=[rename A to B] and actions exist like [set property P to C in field B] or like [delete field B] or like [move field B] => change B to A for all these actions Case 2. when new action=[change property in field A] (property != name) and exists=[remove A] or exists=[change property in field A] => do not add [change property in field A] because it will be removed anyway or the property will change

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 325 of file KDbAlter.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 9 2023 04:10:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.