TBranchingSqlDatabase

SQL database decorator adding branching capabilities.

Inheritance

LevelAncestorDescription
1TObjectUltimate ancestor in a class hierarchy
2TSqlStatementExecutorAbstract base class for a facility that executes a TSqlStatement
3TSqlDatabase Abstract base class for connections to databases that can be queried using SQL statements.
4TLogicalSqlDatabase Abstract base class for TSqlDatabase implementations that manipulate or translate queries before they sent to an actual physical TSqlDatabase.
5TAnnotatingSqlDatabaseA base class for databases that provide tables of an annotation.
6TBranchingSqlDatabase

Source

Sql.Database.Logical.Branching.pas (57)

Description

The branching database adds branch support to the database stack. Rows with the same values are grouped in the database, referring to the branch set to indicate in which branches the row is present.

In order to support this capability, a table should set the TSqlTable.BranchSet inherited from the TSqlTable class, and override the TSqlTable.IsBranching function to return True. A base class is available which provides all functionality: TSqlBranchedPhysicalTable. When branched tables are used in queries through a TBranchingSqlDatabase, the statements are modified to include restrictions on or values of the TBranchSet. Single queries send to the database may result in multiple queries being send to the decorated database for administrative purposes.

When the CurrentBranchSet consists of a single TBranch, database behavior resembles that of a non-branching database, allowing branching capabilities to be added to existing tables with minimal effort on the side of queries.

Fields

ScopeVisibilityTypeNameDescription
InstanceprivateTBranchSetFCurrentBranchSet
InstanceprivateTList<TSqlTable>FBranchedTables
InstanceprivateTBranchSetManagerBranchSetManager

Methods

ScopeVisibilityResultNameDescription
InstanceprivateTSqlExpressionBuilderCreateInSubSetExpression(Column: TSqlTableColumnBuilder)
InstanceprivateTSqlExpressionBuilderCreateInBranchSetSet(BranchSetSubsets: TList<TBranchSet>; Column: TSqlTableColumnBuilder)
InstanceprivateUpdateBranchedTablesAfterBranchDelete(OldId: TInteger; NewId: TInteger)
InstanceprivateDeleteBranchedTableRowsAfterBranchDelete(OldId: TInteger)
InstanceprivateTSqlCaseGenerateCaseStatement(UpdateOperation: TLogicalSqlUpdateOperation)
InstanceprivateTSqlCaseGenerateCaseStatementForBranchIdConversion(From: array of TInteger; ToValues: array of TInteger; CaseColumn: TSqlTableColumnBuilder)
InstanceprotectedStartUpdateOperation(Table: TSqlTable)
InstanceprotectedAddDeleteRestrictions(Delete: TSqlDelete; Table: TSqlTable)
InstanceprotectedAddDeleteAssignments(Update: TSqlUpdate; Table: TSqlTable)
InstanceprotectedAddManagingRestrictions(Expression: TSqlExpression)
InstanceprotectedUpdateManagingColumns(UpdateOperation: TLogicalSqlUpdateOperation)
InstanceprotectedTBooleanIsManaged(Table: TSqlTable)
InstanceprotectedTBooleanIsManaged(Table: TSqlTable; Column: TSqlTableColumn)
InstanceprotectedTLogicalSqlUpdateOperationCreateUpdateOperation(Table: TSqlTable; Columns: TList<TSqlTableColumn>)
InstanceprotectedHandleCreateTable(Statement: TSqlCreateTable)
InstancepublicCreate(CurrentBranchSet: TBranchSet; BranchSetManager: TBranchSetManager; Database: TSqlDatabase; OwnsDecoratedDatabase: TBoolean)
InstancepublicDestroy()
InstancepublicTSqlResultQuery(Statement: TSqlStatement; ResultMethod: TSqlQueryResultMethod)
InstancepublicDeleteBranch(BranchId: TInteger)
InstancepublicInitializeBranchedBasedOnExistingBranch(NewBranch: TInteger; ExistingBranch: TInteger)