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  Type {
  Type::Error, Type::Nullptr, Type::String, Type::Int32,
  Type::Int64, Type::Bool, Type::Real, Type::DateTime,
  Type::Blob
}
 
enum  Properties {
  Empty = 0, PrimaryKey = 1 << 1, Unique = 1 << 2, NotNull = 1 << 3,
  ForeignKey = 1 << 4, AutoIncrement = 1 << 5
}
 
enum  OnDelete { DoNothing = 0, Cascade, SetNull }
 

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
 
unsigned properties () const
 
OnDelete onDelete () const
 
void setOnDelete (OnDelete ondelete)
 
const UT_StringHoldertypeString (const UT_SqlStatement &cursor) const
 
bool isForeignKey () const
 
void setAsForeignKey (const UT_StringHolder &table_name, const UT_StringHolder &col)
 
void setAsForeignKey (const UT_StringHolder &table_name, const UT_StringArray &cols)
 
const UT_StringHolderforeignTable () const
 
const UT_StringArrayforeignColumns () const
 

Static Public Member Functions

static const UT_StringHoldertypeToString (Type type)
 

Protected Attributes

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

Detailed Description

Definition at line 24 of file UT_ORMColumn.h.

Member Enumeration Documentation

Enumerator
DoNothing 
Cascade 
SetNull 

Definition at line 50 of file UT_ORMColumn.h.

Enumerator
Empty 
PrimaryKey 
Unique 
NotNull 
ForeignKey 
AutoIncrement 

Definition at line 40 of file UT_ORMColumn.h.

enum UT_ORMColumn::Type
strong
Enumerator
Error 
Nullptr 
String 
Int32 
Int64 
Bool 
Real 
DateTime 
Blob 

Definition at line 27 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 58 of file UT_ORMColumn.h.

Member Function Documentation

const UT_StringArray& UT_ORMColumn::foreignColumns ( ) const
inline

Definition at line 155 of file UT_ORMColumn.h.

const UT_StringHolder& UT_ORMColumn::foreignTable ( ) const
inline

Definition at line 154 of file UT_ORMColumn.h.

bool UT_ORMColumn::isAutoIncrement ( ) const
inline

Definition at line 123 of file UT_ORMColumn.h.

bool UT_ORMColumn::isForeignKey ( ) const
inline

Definition at line 136 of file UT_ORMColumn.h.

bool UT_ORMColumn::isNotNull ( ) const
inline

Definition at line 92 of file UT_ORMColumn.h.

bool UT_ORMColumn::isPrimaryKey ( ) const
inline

Definition at line 101 of file UT_ORMColumn.h.

bool UT_ORMColumn::isUnique ( ) const
inline

Definition at line 114 of file UT_ORMColumn.h.

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

Definition at line 83 of file UT_ORMColumn.h.

OnDelete UT_ORMColumn::onDelete ( ) const
inline

Definition at line 130 of file UT_ORMColumn.h.

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

Definition at line 73 of file UT_ORMColumn.h.

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

Definition at line 67 of file UT_ORMColumn.h.

unsigned UT_ORMColumn::properties ( ) const
inline

Definition at line 128 of file UT_ORMColumn.h.

void UT_ORMColumn::setAsForeignKey ( const UT_StringHolder table_name,
const UT_StringHolder col 
)
inline

Definition at line 137 of file UT_ORMColumn.h.

void UT_ORMColumn::setAsForeignKey ( const UT_StringHolder table_name,
const UT_StringArray cols 
)
inline

Definition at line 146 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setAutoIncrement ( bool  inc)
inline

Definition at line 115 of file UT_ORMColumn.h.

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

Definition at line 78 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setNotNull ( bool  not_null)
inline

Definition at line 84 of file UT_ORMColumn.h.

void UT_ORMColumn::setOnDelete ( OnDelete  ondelete)
inline

Definition at line 131 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setPrimaryKey ( bool  pk)
inline

Definition at line 93 of file UT_ORMColumn.h.

UT_ORMColumn& UT_ORMColumn::setUnique ( bool  upk)
inline

Definition at line 106 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 77 of file UT_ORMColumn.h.

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

Member Data Documentation

UT_StringArray UT_ORMColumn::myForeignColumns
protected

Definition at line 164 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myForeignTable
protected

Definition at line 163 of file UT_ORMColumn.h.

UT_StringHolder UT_ORMColumn::myName
protected

Definition at line 161 of file UT_ORMColumn.h.

OnDelete UT_ORMColumn::myOnDelete = OnDelete::DoNothing
protected

Definition at line 159 of file UT_ORMColumn.h.

unsigned UT_ORMColumn::myProperties = Properties::Empty
protected

Definition at line 158 of file UT_ORMColumn.h.

Type UT_ORMColumn::myType
protected

Definition at line 160 of file UT_ORMColumn.h.


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