DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Sql.Tables.UserContextTable Class Reference

A wrapper around a table that fires triggers on table events. More...

Inheritance diagram for Deveel.Data.Sql.Tables.UserContextTable:
Deveel.Data.Sql.Tables.BaseDataTable Deveel.Data.Sql.Tables.IMutableTable Deveel.Data.Sql.Tables.RootTable Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.Tables.Table Deveel.Data.Sql.Tables.IRootTable Deveel.Data.Sql.IDbObject Deveel.Data.Sql.Tables.IQueryTable Deveel.Data.Transactions.ILockable Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.IDbObject Deveel.Data.Sql.IDbObject

Public Member Functions

 UserContextTable (IQuery context, ITable table)
 
override IEnumerator< RowGetEnumerator ()
 
override DataObject GetValue (long rowNumber, int columnOffset)
 Gets a single cell within the table that is located at the given column offset and row. More...
 
override void Lock ()
 
override void Release ()
 
RowId AddRow (Row row)
 Persists a new row to the table. More...
 
void UpdateRow (Row row)
 Updates the values of a row into the table. More...
 
bool RemoveRow (RowId rowId)
 Deletes row identified by the given coordinates from the table. More...
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.BaseDataTable
void AddToIndex (int rowNumber, int columnNumber)
 
void AddRowToIndex (int rowNumber)
 
void RemoveRowFromIndex (int rowNumber)
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.RootTable
bool TypeEquals (IRootTable other)
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.Table
void Dispose ()
 
ColumnIndex GetIndex (int columnOffset)
 Gets an index for given column that can be used to select values from this table. More...
 

Protected Member Functions

override IEnumerable< int > ResolveRows (int column, IEnumerable< int > rowSet, ITable ancestor)
 
override ColumnIndex GetColumnIndex (int columnOffset)
 
override void SetupIndexes (Type indexType)
 
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.BaseDataTable
 BaseDataTable ()
 
 BaseDataTable (IContext context)
 
override ObjectName GetResolvedColumnName (int column)
 
override int IndexOfColumn (ObjectName columnName)
 
override ColumnIndex GetIndex (int column, int originalColumn, ITable table)
 
void SetupIndexes (string indexTypeName)
 
override RawTableInfo GetRawTableInfo (RawTableInfo rootInfo)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.RootTable
virtual bool IsSameTable (RootTable other)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.Table
virtual void OnLockAcquired (Lock @lock)
 
virtual void OnLockReleased (Lock @lock)
 
int FindColumn (ObjectName columnName)
 

Properties

ITable Table [get, private set]
 
IQuery Context [get, private set]
 
IMutableTable MutableTable [get]
 
bool IsMutable [get]
 
override TableInfo TableInfo [get]
 
override int RowCount [get]
 
override int ColumnCount [get]
 
TableEventRegistry IMutableTable. EventRegistry [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.BaseDataTable
override IContext Context [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.RootTable
ObjectName TableName [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.Table
abstract IContext Context [get]
 
abstract TableInfo TableInfo [get]
 
bool IsLocked [get, private set]
 
object ILockable. RefId [get]
 
int IQueryTable. ColumnCount [get]
 
virtual int ColumnCount [get]
 
abstract int RowCount [get]
 
ObjectName FullName [get]
 
DbObjectType IDbObject. ObjectType [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.IQueryTable
int ColumnCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.ITable
IContext Context [get]
 
TableInfo TableInfo [get]
 Gets the metadata information of the table, used to resolve the column sources. More...
 
int RowCount [get]
 Gets the total number of rows in the table. More...
 
- Properties inherited from Deveel.Data.Sql.IDbObject
ObjectName FullName [get]
 Gets the fully qualified name of the object used to resolve it uniquely within the database. More...
 
DbObjectType ObjectType [get]
 Gets the type of database object that the implementation is for More...
 
- Properties inherited from Deveel.Data.Transactions.ILockable
object RefId [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.IMutableTable
TableEventRegistry EventRegistry [get]
 

Private Member Functions

void OnTableEvent (TriggerEventType eventType, RowId rowId, Row row)
 
void IMutableTable. AddLock ()
 
void IMutableTable. RemoveLock ()
 
void IMutableTable. FlushIndexes ()
 Flushes all changes made on this table to the backing index scheme. More...
 
void IMutableTable. AssertConstraints ()
 Performs all constraint integrity checks and actions to any modifications based on any changes that happened to the table since that last call to this method. More...
 

Detailed Description

A wrapper around a table that fires triggers on table events.

Definition at line 27 of file UserContextTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.UserContextTable.UserContextTable ( IQuery  context,
ITable  table 
)
inline

Definition at line 28 of file UserContextTable.cs.

Member Function Documentation

void IMutableTable. Deveel.Data.Sql.Tables.UserContextTable.AddLock ( )
inlineprivate
RowId Deveel.Data.Sql.Tables.UserContextTable.AddRow ( Row  row)
inline

Persists a new row to the table.

The row to be added must belong to the table context, otherwise an exception will be thrown.

Parameters
rowThe row to be persisted.
Returns
Returns a RowId that is the pointer to the row established in the table.
Exceptions
ArgumentExceptionIf the gven row does not belong to the table context.
ArgumentNullExceptionIf the given row is null.

Implements Deveel.Data.Sql.Tables.IMutableTable.

Definition at line 106 of file UserContextTable.cs.

106  {
107  OnTableEvent(TriggerEventType.BeforeInsert, RowId.Null, row);
108 
109  var newRowId = MutableTable.AddRow(row);
110 
111  OnTableEvent(TriggerEventType.AfterInsert, newRowId, row);
112 
113  return newRowId;
114  }
TriggerEventType
The different types of high layer trigger events.
void OnTableEvent(TriggerEventType eventType, RowId rowId, Row row)
RowId AddRow(Row row)
Persists a new row to the table.
void IMutableTable. Deveel.Data.Sql.Tables.UserContextTable.AssertConstraints ( )
inlineprivate

Performs all constraint integrity checks and actions to any modifications based on any changes that happened to the table since that last call to this method.

It is important that is called after any call to AddRow, RemoveRow or UpdateRow.

Any constraints that are marked as ConstraintDeferrability.InitiallyImmediate are checked when this is called, otherwise the constraint is checked at commit time.

Any referential actions are performed when this method is called. If a referential action causes a modification to another table, this method is recursively called on the table modified.

If a referential integrity constraint is violated and a referential action is unable to maintain the integrity of the database, any changes made to the table are reverted.

Implements Deveel.Data.Sql.Tables.IMutableTable.

Definition at line 144 of file UserContextTable.cs.

144  {
146  }
void AssertConstraints()
Performs all constraint integrity checks and actions to any modifications based on any changes that h...
override void Deveel.Data.Sql.Tables.UserContextTable.Dispose ( bool  disposing)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.Table.

Definition at line 148 of file UserContextTable.cs.

148  {
149  Context = null;
150  Table = null;
151 
152  base.Dispose(disposing);
153  }
void IMutableTable. Deveel.Data.Sql.Tables.UserContextTable.FlushIndexes ( )
inlineprivate

Flushes all changes made on this table to the backing index scheme.

This is used during the commit phase of this objects lifetime. The transaction control mechanism has found that there are no clashes and now we need to commit the current table view to the conglomerate. Because this object may not update index information immediately, we call this to flush all the changes to the table to the backing index set.

When this method returns, the backing index-set of this view will be completely up to date.

Implements Deveel.Data.Sql.Tables.IMutableTable.

Definition at line 140 of file UserContextTable.cs.

140  {
142  }
void FlushIndexes()
Flushes all changes made on this table to the backing index scheme.
override ColumnIndex Deveel.Data.Sql.Tables.UserContextTable.GetColumnIndex ( int  columnOffset)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.BaseDataTable.

Definition at line 73 of file UserContextTable.cs.

73  {
74  return Table.GetIndex(columnOffset);
75  }
ColumnIndex GetIndex(int columnOffset)
Gets an index for given column that can be used to select values from this table. ...
override IEnumerator<Row> Deveel.Data.Sql.Tables.UserContextTable.GetEnumerator ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 45 of file UserContextTable.cs.

45  {
46  return Table.GetEnumerator();
47  }
override DataObject Deveel.Data.Sql.Tables.UserContextTable.GetValue ( long  rowNumber,
int  columnOffset 
)
inline

Gets a single cell within the table that is located at the given column offset and row.

Parameters
rowNumberThe unique number of the row where the cell is located.
columnOffsetThe zero-based offset of the column of the cell to return.
Returns
Returns an instance of DataObject that is contained in the cell located by the row and column coordinates provided.
Exceptions
ArgumentOutOfRangeExceptionIf the given columnOffset is less than zero or greater or equal than the number of columns defined in the table metadata.
See also
Tables.TableInfo.IndexOfColumn(string)

Implements Deveel.Data.Sql.Tables.ITable.

Definition at line 80 of file UserContextTable.cs.

80  {
81  return Table.GetValue(rowNumber, columnOffset);
82  }
DataObject GetValue(long rowNumber, int columnOffset)
Gets a single cell within the table that is located at the given column offset and row...
override void Deveel.Data.Sql.Tables.UserContextTable.Lock ( )
inlinevirtual
void Deveel.Data.Sql.Tables.UserContextTable.OnTableEvent ( TriggerEventType  eventType,
RowId  rowId,
Row  row 
)
inlineprivate

Definition at line 61 of file UserContextTable.cs.

61  {
62  Context.FireTriggers(new TableEvent(this, eventType, rowId, row));
63  }
Exposes the context of an event fired on a table.
Definition: TableEvent.cs:26
override void Deveel.Data.Sql.Tables.UserContextTable.Release ( )
inlinevirtual
void IMutableTable. Deveel.Data.Sql.Tables.UserContextTable.RemoveLock ( )
inlineprivate
bool Deveel.Data.Sql.Tables.UserContextTable.RemoveRow ( RowId  rowId)
inline

Deletes row identified by the given coordinates from the table.

Parameters
rowIdThe unique identifier of the row to be removed.
Returns
Returns true if the row identified was found and removed, false otherwise.
Exceptions
ArgumentExceptionThrown if the given rowId does not belong to this table.

Implements Deveel.Data.Sql.Tables.IMutableTable.

Definition at line 129 of file UserContextTable.cs.

129  {
130  OnTableEvent(TriggerEventType.BeforeDelete, rowId, null);
131 
132  // TODO: Maybe we should return the row removed here
133  var result = MutableTable.RemoveRow(rowId);
134 
135  OnTableEvent(TriggerEventType.AfterDelete, rowId, null);
136 
137  return result;
138  }
TriggerEventType
The different types of high layer trigger events.
void OnTableEvent(TriggerEventType eventType, RowId rowId, Row row)
bool RemoveRow(RowId rowId)
Deletes row identified by the given coordinates from the table.
override IEnumerable<int> Deveel.Data.Sql.Tables.UserContextTable.ResolveRows ( int  column,
IEnumerable< int >  rowSet,
ITable  ancestor 
)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.BaseDataTable.

Definition at line 65 of file UserContextTable.cs.

65  {
66  if (!TableName.Equals(ancestor.TableInfo.TableName) &&
67  !ancestor.TableInfo.TableName.Equals(Table.TableInfo.TableName))
68  throw new Exception("Method routed to incorrect table ancestor.");
69 
70  return rowSet;
71  }
override bool Equals(object obj)
Definition: ObjectName.cs:241
ObjectName TableName
Gets the fully qualified name of the table that is ensured to be unique within the system...
Definition: TableInfo.cs:97
TableInfo TableInfo
Gets the metadata information of the table, used to resolve the column sources.
Definition: ITable.cs:47
override void Deveel.Data.Sql.Tables.UserContextTable.SetupIndexes ( Type  indexType)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.BaseDataTable.

Definition at line 77 of file UserContextTable.cs.

77  {
78  }
void Deveel.Data.Sql.Tables.UserContextTable.UpdateRow ( Row  row)
inline

Updates the values of a row into the table.

Parameters
rowThe object containing the values to update.
Exceptions
ArgumentNullExceptionIf the given row is null.

Implements Deveel.Data.Sql.Tables.IMutableTable.

Definition at line 116 of file UserContextTable.cs.

116  {
117  if (row == null)
118  throw new ArgumentNullException("row");
119 
120  var rowId = row.RowId;
121  if (rowId.IsNull)
122  throw new ArgumentException("Cannot update a row with NULL ROWID");
123 
124  OnTableEvent(TriggerEventType.BeforeUpdate, rowId, row);
125 
126  MutableTable.UpdateRow(row);
127  }
TriggerEventType
The different types of high layer trigger events.
void OnTableEvent(TriggerEventType eventType, RowId rowId, Row row)
void UpdateRow(Row row)
Updates the values of a row into the table.

Property Documentation

override int Deveel.Data.Sql.Tables.UserContextTable.ColumnCount
getprotected

Definition at line 57 of file UserContextTable.cs.

IQuery Deveel.Data.Sql.Tables.UserContextTable.Context
getprivate set

Definition at line 35 of file UserContextTable.cs.

TableEventRegistry IMutableTable. Deveel.Data.Sql.Tables.UserContextTable.EventRegistry
getprivate

Definition at line 94 of file UserContextTable.cs.

bool Deveel.Data.Sql.Tables.UserContextTable.IsMutable
getprivate

Definition at line 41 of file UserContextTable.cs.

IMutableTable Deveel.Data.Sql.Tables.UserContextTable.MutableTable
getprivate

Definition at line 37 of file UserContextTable.cs.

override int Deveel.Data.Sql.Tables.UserContextTable.RowCount
get

Definition at line 53 of file UserContextTable.cs.

ITable Deveel.Data.Sql.Tables.UserContextTable.Table
getprivate set

Definition at line 33 of file UserContextTable.cs.

override TableInfo Deveel.Data.Sql.Tables.UserContextTable.TableInfo
get

Definition at line 49 of file UserContextTable.cs.


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