KDbAlterTableHandler::InsertFieldAction

Search for usage in LXR

KDbAlterTableHandler::InsertFieldAction Class Reference

#include <KDbAlter.h>

Inheritance diagram for KDbAlterTableHandler::InsertFieldAction:

Public Member Functions

 InsertFieldAction ()
 
 InsertFieldAction (const InsertFieldAction &action)
 
 InsertFieldAction (int fieldIndex, KDbField *newField, int uid)
 
QString debugString (const DebugOptions &debugOptions=DebugOptions()) override
 
const KDbFieldfield () const
 
int index () const
 
void setField (KDbField *field)
 
void setIndex (int index)
 
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

 InsertFieldAction (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)
 
virtual bool shouldBeRemoved (ActionDictDict *fieldActions)
 

Protected Attributes

int m_index
 
- Protected Attributes inherited from KDbAlterTableHandler::FieldActionBase
int m_fieldUID
 

Detailed Description

Defines an action for inserting a single table field.

Definition at line 360 of file KDbAlter.h.

Constructor & Destructor Documentation

◆ InsertFieldAction() [1/3]

KDbAlterTableHandler::InsertFieldAction::InsertFieldAction ( const InsertFieldAction action)

copy ctor

Definition at line 559 of file KDbAlter.cpp.

◆ InsertFieldAction() [2/3]

KDbAlterTableHandler::InsertFieldAction::InsertFieldAction ( )

Creates null action.

Definition at line 566 of file KDbAlter.cpp.

◆ InsertFieldAction() [3/3]

KDbAlterTableHandler::InsertFieldAction::InsertFieldAction ( bool  null)
explicitprotected

, used for constructing null action

Definition at line 571 of file KDbAlter.cpp.

Member Function Documentation

◆ execute()

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

Performs physical execution of this action.

Todo:

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 703 of file KDbAlter.cpp.

◆ simplifyActions()

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

Legend: A,B==fields, P==property, [....]==action, (..,..,..) group of actions, <...> internal operation.

Case 1: there are "change property" actions after the Insert action. -> change the properties in the Insert action itself and remove the "change property" actions. Examples: [Insert A] && [rename A to B] => [Insert B] [Insert A] && [change property P in field A] => [Insert A with P altered] Comment: we need to do this reduction because otherwise we'd need to do psyhical altering right after [Insert A] if [rename A to B] follows.

Todo:
not checked

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 624 of file KDbAlter.cpp.

◆ updateAlteringRequirements()

void KDbAlterTableHandler::InsertFieldAction::updateAlteringRequirements ( )
overrideprotectedvirtual
Todo:
sometimes add DataConversionRequired (e.g. when relationships require removing orphaned records) ?
Todo:

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 591 of file KDbAlter.cpp.

◆ updateTableSchema()

tristate KDbAlterTableHandler::InsertFieldAction::updateTableSchema ( KDbTableSchema table,
KDbField field,
QHash< QString, QString > *  fieldHash 
)
overridevirtual
Todo:
add it only when there should be fixed value (e.g. default) set for this new field...

Reimplemented from KDbAlterTableHandler::ActionBase.

Definition at line 692 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 Wed Sep 27 2023 04:08:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.