HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ORMColumn Class Reference

#include <UT_ORMColumn.h>

+ Inheritance diagram for UT_ORMColumn:

Public Types

enum  Properties {
  Empty = 0, PrimaryKey = 1 << 1, Unique = 1 << 2, NotNull = 1 << 3,
  ForeignKey = 1 << 4, AutoIncrement = 1 << 5, ManyToMany = 1 << 6
}
 
enum  OnDelete { DoNothing = 0, Cascade, SetNull }
 
using Type = UT_ORMColumnType
 

Public Member Functions

 UT_ORMColumn ()=default
 
 UT_ORMColumn (const UT_StringHolder &name, Type type, unsigned props=Properties::Empty, OnDelete on_delete=OnDelete::DoNothing)
 
bool operator== (const UT_ORMColumn &rhs) const
 
bool operator!= (const UT_ORMColumn &rhs) const
 
void sql (const UT_SqlStatement &stmt, UT_WorkBuffer &wbuf)
 
Type type () const
 
UT_ORMColumnsetName (const UT_StringHolder &name)
 
const UT_StringHoldername () const
 
UT_ORMColumnsetNotNull (bool not_null)
 
bool isNotNull () const
 
UT_ORMColumnsetPrimaryKey (bool pk)
 
bool isPrimaryKey () const
 
UT_ORMColumnsetUnique (bool upk)
 
bool isUnique () const
 
UT_ORMColumnsetAutoIncrement (bool inc)
 
bool isAutoIncrement () const
 
bool isTableColumn () const
 
bool isLocal () const
 
unsigned properties () const
 
OnDelete onDelete () const
 
void setOnDelete (OnDelete ondelete)
 
const UT_StringHoldertypeString (const UT_SqlStatement &cursor) const
 
bool isForeignKey () const
 
bool isManyToMany () const
 
void setAsForeignKey (const UT_StringHolder &foreign_model, const UT_StringHolder &table_name, const UT_StringHolder &col, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
void setAsForeignKey (const UT_StringHolder &foreign_model, const UT_StringHolder &table_name, const UT_StringArray &cols, UT_ORMColumn::OnDelete ondelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
void setAsForeignKey (const UT_ORMModelMeta &meta, const UT_StringHolder &col=UT_StringHolder::theEmptyString, UT_ORMColumn::OnDelete=UT_ORMColumn::OnDelete::Cascade, const UT_StringHolder &related_name=UT_StringHolder::theEmptyString)
 
const UT_StringHolderforeignTable () const
 
const UT_StringHolderforeignTableModelName () const
 
const UT_StringHolderforeignFieldName () const
 
const UT_StringArrayforeignColumns () const
 
bool isForeignKeyToModel (const UT_ORMModelMeta &model) const
 
void setRelatedName (const UT_StringHolder &related)
 
const UT_StringHolderrelatedName () const
 

Static Public Member Functions

static const UT_StringHoldertypeToDisplayName (Type type)
 

Protected Attributes

unsigned myProperties = Properties::Empty
 
OnDelete myOnDelete = OnDelete::DoNothing
 
Type myType
 
UT_StringHolder myName
 
UT_StringHolder myForeignTable
 
UT_StringHolder myForeignModelName
 
UT_StringArray myForeignColumns
 
UT_StringHolder myRelated
 

Detailed Description

Definition at line 27 of file UT_ORMColumn.h.

Member Typedef Documentation

Definition at line 30 of file UT_ORMColumn.h.

Member Enumeration Documentation

Enumerator
DoNothing 
Cascade 
SetNull 

Definition at line 43 of file UT_ORMColumn.h.

Enumerator
Empty 
PrimaryKey 
Unique 
NotNull 
ForeignKey 
AutoIncrement 
ManyToMany 

Definition at line 32 of file UT_ORMColumn.h.

Constructor & Destructor Documentation

UT_ORMColumn::UT_ORMColumn ( )
default
UT_ORMColumn::UT_ORMColumn ( const UT_StringHolder name,
Type  type,
unsigned  props = Properties::Empty,
OnDelete  on_delete = OnDelete::DoNothing 
)
inline

Definition at line 51 of file UT_ORMColumn.h.

Member Function Documentation

const UT_StringArray& UT_ORMColumn::foreignColumns ( ) const
inline

Definition at line 178 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::foreignFieldName ( ) const
inline

Definition at line 174 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::foreignTable ( ) const
inline

Definition at line 169 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::foreignTableModelName ( ) const
inline

Definition at line 170 of file UT_ORMColumn.h.

bool UT_ORMColumn::isAutoIncrement ( ) const
inline

Definition at line 115 of file UT_ORMColumn.h.

bool UT_ORMColumn::isForeignKey ( ) const
inline

Definition at line 133 of file UT_ORMColumn.h.

bool UT_ORMColumn::isForeignKeyToModel ( const UT_ORMModelMeta model) const
bool UT_ORMColumn::isLocal ( ) const
inline

Definition at line 120 of file UT_ORMColumn.h.

bool UT_ORMColumn::isManyToMany ( ) const
inline

Definition at line 134 of file UT_ORMColumn.h.

bool UT_ORMColumn::isNotNull ( ) const
inline

Definition at line 85 of file UT_ORMColumn.h.

bool UT_ORMColumn::isPrimaryKey ( ) const
inline

Definition at line 94 of file UT_ORMColumn.h.

bool UT_ORMColumn::isTableColumn ( ) const
inline

Definition at line 119 of file UT_ORMColumn.h.

bool UT_ORMColumn::isUnique ( ) const
inline

Definition at line 106 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::name ( void  ) const
inline

Definition at line 76 of file UT_ORMColumn.h.

OnDelete UT_ORMColumn::onDelete ( ) const
inline

Definition at line 124 of file UT_ORMColumn.h.

bool UT_ORMColumn::operator!= ( const UT_ORMColumn rhs) const
inline

Definition at line 66 of file UT_ORMColumn.h.

bool UT_ORMColumn::operator== ( const UT_ORMColumn rhs) const
inline

Definition at line 60 of file UT_ORMColumn.h.

unsigned UT_ORMColumn::properties ( ) const
inline

Definition at line 122 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::relatedName ( ) const
inline

Definition at line 181 of file UT_ORMColumn.h.

void UT_ORMColumn::setAsForeignKey ( const UT_StringHolder foreign_model,
const UT_StringHolder table_name,
const UT_StringHolder col,
UT_ORMColumn::OnDelete  ondelete = UT_ORMColumn::OnDelete::Cascade,
const UT_StringHolder related_name = UT_StringHolder::theEmptyString 
)
inline

Definition at line 135 of file UT_ORMColumn.h.

void UT_ORMColumn::setAsForeignKey ( const UT_StringHolder foreign_model,
const UT_StringHolder table_name,
const UT_StringArray cols,
UT_ORMColumn::OnDelete  ondelete = UT_ORMColumn::OnDelete::Cascade,
const UT_StringHolder related_name = UT_StringHolder::theEmptyString 
)
inline

Definition at line 150 of file UT_ORMColumn.h.

void UT_ORMColumn::setAsForeignKey ( const UT_ORMModelMeta meta,
const UT_StringHolder col = UT_StringHolder::theEmptyString,
UT_ORMColumn::OnDelete  = UT_ORMColumn::OnDelete::Cascade,
const UT_StringHolder related_name = UT_StringHolder::theEmptyString 
)
UT_ORMColumn& UT_ORMColumn::setAutoIncrement ( bool  inc)
inline

Definition at line 107 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setName ( const UT_StringHolder name)
inline

Definition at line 71 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setNotNull ( bool  not_null)
inline

Definition at line 77 of file UT_ORMColumn.h.

void UT_ORMColumn::setOnDelete ( OnDelete  ondelete)
inline

Definition at line 125 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setPrimaryKey ( bool  pk)
inline

Definition at line 86 of file UT_ORMColumn.h.

void UT_ORMColumn::setRelatedName ( const UT_StringHolder related)
UT_ORMColumn& UT_ORMColumn::setUnique ( bool  upk)
inline

Definition at line 98 of file UT_ORMColumn.h.

void UT_ORMColumn::sql ( const UT_SqlStatement stmt,
UT_WorkBuffer wbuf 
)
Type UT_ORMColumn::type ( ) const
inline

Definition at line 70 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::typeString ( const UT_SqlStatement cursor) const
static const UT_StringHolder& UT_ORMColumn::typeToDisplayName ( Type  type)
static

This is only a humar readable label. If you want the actual typename you have to use UT_SqlStatement as the underlying typename may be different for various sql backends.

Member Data Documentation

UT_StringArray UT_ORMColumn::myForeignColumns
protected

Definition at line 191 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myForeignModelName
protected

Definition at line 190 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myForeignTable
protected

Definition at line 189 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myName
protected

Definition at line 187 of file UT_ORMColumn.h.

OnDelete UT_ORMColumn::myOnDelete = OnDelete::DoNothing
protected

Definition at line 185 of file UT_ORMColumn.h.

unsigned UT_ORMColumn::myProperties = Properties::Empty
protected

Definition at line 184 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myRelated
protected

Definition at line 192 of file UT_ORMColumn.h.

Type UT_ORMColumn::myType
protected

Definition at line 186 of file UT_ORMColumn.h.


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