OpenPetra
Free Administration Software for Non-Profits
Ict.Tools.DBXML.TTable Class Reference

all information about the structure of a database table More...

Inheritance diagram for Ict.Tools.DBXML.TTable:
Ict.Tools.DBXML.TDataSetTable

Public Member Functions

 TTable ()
 constructor More...
 
void Assign (TTable AOtherTable)
 copy the values from another table; used for generating datasets by deriving from database tables More...
 
TTableField GetField (string s, bool AShowWarningNonExistingField=true)
 return the reference to a column, given by name More...
 
TConstraint GetConstraint (StringCollection fields)
 get the reference to the constraint which is based on the columns that are passed as parameter More...
 
Boolean IsKey (String AFieldname, String AKeyType)
 determine if a given field is part of a certain type of constraint More...
 
bool HasPrimaryKey ()
 determine whether the table has a primary key More...
 
bool HasUniqueKey ()
 determine whether the table has a unique key More...
 
bool HasForeignKey ()
 determine whether the table has any foreign key constraints More...
 
TConstraint GetPrimaryKey ()
 get a reference to the primary key More...
 
TConstraint GetFirstUniqueKey ()
 get a reference to the first unique key More...
 
ArrayList GetReferences ()
 get the list of constraints of other tables, that reference this table More...
 
void AddReference (TConstraint AForeignKey)
 add a foreign key from another table, that is referencing this table More...
 
void PrepareLinks (TDataDefinitionStore db)
 set the references in the tables referenced by the constraints of this table More...
 
void PrepareAutoGeneratedFields ()
 create the auto generated fields (eg. createdby, datemodified) More...
 
Boolean TestIndex (TIndex AIndex)
 
Boolean AddIndex (TIndex AIndex)
 
string PrepareSQLInsertStatement ()
 prepare an INSERT statement for this table More...
 
List< OdbcParameter > PrepareParametersInsertStatement (string line)
 prepare the parameters for an INSERT statement, from a CSV line More...
 

Static Public Member Functions

static string NiceTableName (string s)
 change the name from the sql name to a Delphi class name remove underscores, use capitalised letters More...
 
static string NiceFieldName (TTableField tableField)
 change the name from the sql name to a Delphi variable name remove underscores, remove prefixes and type identifiers, use capitalised letters More...
 
static string NiceFieldName (String tableField)
 format the name of a column using Camelcase and dropping prefix/postfix More...
 
static string NiceKeyName (TConstraint c)
 change the name of the constraint from the sql name to a .net name remove underscores, use capitalised letters, prepend FK or call it PrimaryKey More...
 
static string GetNamespace (string AStrGroup)
 get the namespace for this table, eg. MPersonnel.Units More...
 

Public Attributes

List< TTableFieldgrpTableField
 the columns of the table More...
 
List< TIndexgrpIndex
 the indexes in the table More...
 
List< TConstraintgrpConstraint
 the constraints (foreign, unique, primary) of the table More...
 
string strName
 the name of the table (as it is in the database) More...
 
int iOrder
 order of the table More...
 
string strDotNetName
 the name of the table as it should be used in dotnet More...
 
string strVariableNameInDataset = null
 the name of the table when it is used in a dataset; empty otherwise. More...
 
string strDumpName
 the name used for dumping the table More...
 
string strDescription
 a description of the table More...
 
string strArea
 define which area in the db this table belongs to More...
 
string strLabel
 even shorter description than strDescription More...
 
Boolean ExistsStrLabel
 is there a label at all? More...
 
string strGroup
 each table belongs to a certain group, which helps with the HTML documentation of the database structure More...
 
bool bWithoutCRMDFields
 created / modified fields More...
 
bool bCatchUpdateException
 attempt an insert instead of failed update in SubmitChanges in DataAccess More...
 
ArrayList FReferenced
 references to this table from other tables list of TConstraints More...
 
String CustomReportPermission
 which permission is needed to access this table with a custom report More...
 
Boolean AvailableForCustomReport
 is this table available for custom reports More...
 

Static Public Attributes

static Boolean GEnabledLoggingMissingFields = true
 this for debugging; it helps to find columns that are missing More...
 

Detailed Description

all information about the structure of a database table

Constructor & Destructor Documentation

◆ TTable()

Ict.Tools.DBXML.TTable.TTable ( )
inline

constructor

Member Function Documentation

◆ AddIndex()

Boolean Ict.Tools.DBXML.TTable.AddIndex ( TIndex  AIndex)
inline

only add the index if it does not exist yet

◆ AddReference()

void Ict.Tools.DBXML.TTable.AddReference ( TConstraint  AForeignKey)
inline

add a foreign key from another table, that is referencing this table

Parameters
AForeignKeyforeign key to add

◆ Assign()

void Ict.Tools.DBXML.TTable.Assign ( TTable  AOtherTable)
inline

copy the values from another table; used for generating datasets by deriving from database tables

Parameters
AOtherTable

◆ GetConstraint()

TConstraint Ict.Tools.DBXML.TTable.GetConstraint ( StringCollection  fields)
inline

get the reference to the constraint which is based on the columns that are passed as parameter

Parameters
fieldsthe fields that are part of the constraint that we look for
Returns
the reference to the constraint

◆ GetField()

TTableField Ict.Tools.DBXML.TTable.GetField ( string  s,
bool  AShowWarningNonExistingField = true 
)
inline

return the reference to a column, given by name

Parameters
sname of the column
AShowWarningNonExistingFieldshow warning if there is no field with that name; only takes effect if GEnabledLoggingMissingFields is true
Returns
reference to the column

◆ GetFirstUniqueKey()

TConstraint Ict.Tools.DBXML.TTable.GetFirstUniqueKey ( )
inline

get a reference to the first unique key

Returns
the first unique key of the table

◆ GetNamespace()

static string Ict.Tools.DBXML.TTable.GetNamespace ( string  AStrGroup)
inlinestatic

get the namespace for this table, eg. MPersonnel.Units

◆ GetPrimaryKey()

TConstraint Ict.Tools.DBXML.TTable.GetPrimaryKey ( )
inline

get a reference to the primary key

Returns
the primary key of the table

◆ GetReferences()

ArrayList Ict.Tools.DBXML.TTable.GetReferences ( )
inline

get the list of constraints of other tables, that reference this table

Returns
the list of constraints of other tables, that reference this table

◆ HasForeignKey()

bool Ict.Tools.DBXML.TTable.HasForeignKey ( )
inline

determine whether the table has any foreign key constraints

Returns
true if the table has at least one foreign key constraint

◆ HasPrimaryKey()

bool Ict.Tools.DBXML.TTable.HasPrimaryKey ( )
inline

determine whether the table has a primary key

Returns
true if the table has a primary key constraint

◆ HasUniqueKey()

bool Ict.Tools.DBXML.TTable.HasUniqueKey ( )
inline

determine whether the table has a unique key

Returns
true if the table has a unique key constraint

◆ IsKey()

Boolean Ict.Tools.DBXML.TTable.IsKey ( String  AFieldname,
String  AKeyType 
)
inline

determine if a given field is part of a certain type of constraint

Parameters
AFieldnamethe field in question
AKeyTypea type of constraint, eg. unique, primary, foreign key
Returns
true if the field is part of a key of the given type

◆ NiceFieldName() [1/2]

static string Ict.Tools.DBXML.TTable.NiceFieldName ( String  tableField)
inlinestatic

format the name of a column using Camelcase and dropping prefix/postfix

Parameters
tableFieldthe name to format
Returns
nice name

◆ NiceFieldName() [2/2]

static string Ict.Tools.DBXML.TTable.NiceFieldName ( TTableField  tableField)
inlinestatic

change the name from the sql name to a Delphi variable name remove underscores, remove prefixes and type identifiers, use capitalised letters

Parameters
tableFieldthe reference to the column which you want the nice name of
Returns
the column name without prefix and postfix

◆ NiceKeyName()

static string Ict.Tools.DBXML.TTable.NiceKeyName ( TConstraint  c)
inlinestatic

change the name of the constraint from the sql name to a .net name remove underscores, use capitalised letters, prepend FK or call it PrimaryKey

Parameters
cthe constraint
Returns
nice name for the key

◆ NiceTableName()

static string Ict.Tools.DBXML.TTable.NiceTableName ( string  s)
inlinestatic

change the name from the sql name to a Delphi class name remove underscores, use capitalised letters

Parameters
sturn the table name into CamelCase
Returns

◆ PrepareAutoGeneratedFields()

void Ict.Tools.DBXML.TTable.PrepareAutoGeneratedFields ( )
inline

create the auto generated fields (eg. createdby, datemodified)

◆ PrepareLinks()

void Ict.Tools.DBXML.TTable.PrepareLinks ( TDataDefinitionStore  db)
inline

set the references in the tables referenced by the constraints of this table

Parameters
db

◆ PrepareParametersInsertStatement()

List< OdbcParameter > Ict.Tools.DBXML.TTable.PrepareParametersInsertStatement ( string  line)
inline

prepare the parameters for an INSERT statement, from a CSV line

◆ PrepareSQLInsertStatement()

string Ict.Tools.DBXML.TTable.PrepareSQLInsertStatement ( )
inline

prepare an INSERT statement for this table

◆ TestIndex()

Boolean Ict.Tools.DBXML.TTable.TestIndex ( TIndex  AIndex)
inline

checks if all the fields of the index exist in the table

Member Data Documentation

◆ AvailableForCustomReport

Boolean Ict.Tools.DBXML.TTable.AvailableForCustomReport

is this table available for custom reports

◆ bCatchUpdateException

bool Ict.Tools.DBXML.TTable.bCatchUpdateException

attempt an insert instead of failed update in SubmitChanges in DataAccess

◆ bWithoutCRMDFields

bool Ict.Tools.DBXML.TTable.bWithoutCRMDFields

created / modified fields

◆ CustomReportPermission

String Ict.Tools.DBXML.TTable.CustomReportPermission

which permission is needed to access this table with a custom report

◆ ExistsStrLabel

Boolean Ict.Tools.DBXML.TTable.ExistsStrLabel

is there a label at all?

◆ FReferenced

ArrayList Ict.Tools.DBXML.TTable.FReferenced

references to this table from other tables list of TConstraints

◆ GEnabledLoggingMissingFields

Boolean Ict.Tools.DBXML.TTable.GEnabledLoggingMissingFields = true
static

this for debugging; it helps to find columns that are missing

◆ grpConstraint

List<TConstraint> Ict.Tools.DBXML.TTable.grpConstraint

the constraints (foreign, unique, primary) of the table

◆ grpIndex

List<TIndex> Ict.Tools.DBXML.TTable.grpIndex

the indexes in the table

◆ grpTableField

List<TTableField> Ict.Tools.DBXML.TTable.grpTableField

the columns of the table

◆ iOrder

int Ict.Tools.DBXML.TTable.iOrder

order of the table

◆ strArea

string Ict.Tools.DBXML.TTable.strArea

define which area in the db this table belongs to

◆ strDescription

string Ict.Tools.DBXML.TTable.strDescription

a description of the table

◆ strDotNetName

string Ict.Tools.DBXML.TTable.strDotNetName

the name of the table as it should be used in dotnet

◆ strDumpName

string Ict.Tools.DBXML.TTable.strDumpName

the name used for dumping the table

◆ strGroup

string Ict.Tools.DBXML.TTable.strGroup

each table belongs to a certain group, which helps with the HTML documentation of the database structure

◆ strLabel

string Ict.Tools.DBXML.TTable.strLabel

even shorter description than strDescription

◆ strName

string Ict.Tools.DBXML.TTable.strName

the name of the table (as it is in the database)

◆ strVariableNameInDataset

string Ict.Tools.DBXML.TTable.strVariableNameInDataset = null

the name of the table when it is used in a dataset; empty otherwise.


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