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/3]

KDbAlterTableHandler::ChangeFieldPropertyAction::ChangeFieldPropertyAction ( const QString & fieldName,
const QString & propertyName,
const QVariant & newValue,
int uid )

Definition at line 194 of file KDbAlter.cpp.

◆ ChangeFieldPropertyAction() [2/3]

KDbAlterTableHandler::ChangeFieldPropertyAction::ChangeFieldPropertyAction ( )

Creates null action.

Definition at line 202 of file KDbAlter.cpp.

◆ ~ChangeFieldPropertyAction()

KDbAlterTableHandler::ChangeFieldPropertyAction::~ChangeFieldPropertyAction ( )
override

Definition at line 212 of file KDbAlter.cpp.

◆ ChangeFieldPropertyAction() [3/3]

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

, used for constructing null action

Definition at line 207 of file KDbAlter.cpp.

Member Function Documentation

◆ debugString()

QString KDbAlterTableHandler::ChangeFieldPropertyAction::debugString ( const DebugOptions & debugOptions = DebugOptions())
overridevirtual

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 221 of file KDbAlter.cpp.

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

◆ newValue()

QVariant KDbAlterTableHandler::ChangeFieldPropertyAction::newValue ( ) const
inline

Definition at line 309 of file KDbAlter.h.

◆ propertyName()

QString KDbAlterTableHandler::ChangeFieldPropertyAction::propertyName ( ) const
inline

Definition at line 306 of file KDbAlter.h.

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

◆ updateAlteringRequirements()

void KDbAlterTableHandler::ChangeFieldPropertyAction::updateAlteringRequirements ( )
overrideprotectedvirtual

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 216 of file KDbAlter.cpp.

◆ updateTableSchema()

tristate KDbAlterTableHandler::ChangeFieldPropertyAction::updateTableSchema ( KDbTableSchema * table,
KDbField * field,
QHash< QString, QString > * fieldHash )
overridevirtual

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 400 of file KDbAlter.cpp.

Member Data Documentation

◆ m_newValue

QVariant KDbAlterTableHandler::ChangeFieldPropertyAction::m_newValue
protected

Definition at line 331 of file KDbAlter.h.

◆ m_propertyName

QString KDbAlterTableHandler::ChangeFieldPropertyAction::m_propertyName
protected

Definition at line 330 of file KDbAlter.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.