DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | List of all members
Deveel.Data.SystemTableContainer Class Referenceabstract
Inheritance diagram for Deveel.Data.SystemTableContainer:
Deveel.Data.Sql.Tables.ITableContainer Deveel.Data.Routines.RoutineManager.RoutinesTableContainer Deveel.Data.Sql.Triggers.TriggerManager.TriggersTableContainer Deveel.Data.Sql.Views.ViewManager.ViewTableContainer

Public Member Functions

int FindByName (ObjectName name)
 Finds the index in this container of the given table by its name. More...
 
ObjectName GetTableName (int offset)
 Gets the name of the table at the given index in this container. More...
 
abstract TableInfo GetTableInfo (int offset)
 Gets the information of the table at the given offset in this container. More...
 
abstract string GetTableType (int offset)
 Gets the type of the table at the given offset. More...
 
bool ContainsTable (ObjectName name)
 Checks if a table with the given name is contained in the current context. More...
 
abstract ITable GetTable (int offset)
 Gets the table contained at the given offset within the context. More...
 

Protected Member Functions

 SystemTableContainer (ITransaction transaction, ObjectName tableName)
 

Properties

ITransaction Transaction [get, private set]
 
ObjectName TableName [get, private set]
 
int TableCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.ITableContainer
int TableCount [get]
 Returns the total count of tables that this object is maintaining. More...
 

Detailed Description

Definition at line 24 of file SystemTableContainer.cs.

Constructor & Destructor Documentation

Deveel.Data.SystemTableContainer.SystemTableContainer ( ITransaction  transaction,
ObjectName  tableName 
)
inlineprotected

Definition at line 25 of file SystemTableContainer.cs.

25  {
26  Transaction = transaction;
27  TableName = tableName;
28  }
The system implementation of a transaction model that handles isolated operations within a database c...
Definition: Transaction.cs:35

Member Function Documentation

bool Deveel.Data.SystemTableContainer.ContainsTable ( ObjectName  name)
inline

Checks if a table with the given name is contained in the current context.

Parameters
nameThe name of the table to search.
Returns
Returns true if any table with the given name was found in the container, false otherwise.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Definition at line 87 of file SystemTableContainer.cs.

87  {
88  // This set can not contain the table that is backing it, so we always
89  // return false for that. This check stops an annoying recursive
90  // situation for table name resolution.
91  if (name.Equals(TableName))
92  return false;
93 
94  return FindByName(name) != -1;
95  }
override bool Equals(object obj)
Definition: ObjectName.cs:241
int FindByName(ObjectName name)
Finds the index in this container of the given table by its name.
int Deveel.Data.SystemTableContainer.FindByName ( ObjectName  name)
inline

Finds the index in this container of the given table by its name.

Parameters
nameThe name of the table to find.
Returns
Returns a zero-based index that represents the offset of the table identified by the given name within the context, ot -1 of not found.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Definition at line 38 of file SystemTableContainer.cs.

38  {
39  if (Transaction.RealTableExists(TableName)) {
40  // Search the table. We assume that the schema and name of the object
41  // are in columns 0 and 1 respectively.
42  var table = Transaction.GetTable(TableName);
43  var rowE = table.GetEnumerator();
44  int p = 0;
45  while (rowE.MoveNext()) {
46  int rowIndex = rowE.Current.RowId.RowNumber;
47  var obName = table.GetValue(rowIndex, 1);
48  if (obName.Value.ToString().Equals(name.Name)) {
49  var obSchema = table.GetValue(rowIndex, 0);
50  if (obSchema.Value.ToString().Equals(name.ParentName)) {
51  // Match so return this
52  return p;
53  }
54  }
55  ++p;
56  }
57  }
58 
59  return -1;
60  }
The system implementation of a transaction model that handles isolated operations within a database c...
Definition: Transaction.cs:35
string Name
Gets the name of the object being referenced.
Definition: ObjectName.cs:108
abstract ITable Deveel.Data.SystemTableContainer.GetTable ( int  offset)
pure virtual

Gets the table contained at the given offset within the context.

Parameters
offsetThe zero-based offset of the table to return.
Returns
Returns an instance of ITable that provides access to the backed informaion for an object provided by the context.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Implemented in Deveel.Data.Sql.Triggers.TriggerManager.TriggersTableContainer, Deveel.Data.Sql.Views.ViewManager.ViewTableContainer, and Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.

abstract TableInfo Deveel.Data.SystemTableContainer.GetTableInfo ( int  offset)
pure virtual

Gets the information of the table at the given offset in this container.

Parameters
offsetThe zero-based offset of the table whose information to return.
Returns
Returns an instance of
See also
TableInfo
that describes the metadata of a table at the given offset within the context.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Implemented in Deveel.Data.Sql.Triggers.TriggerManager.TriggersTableContainer, Deveel.Data.Sql.Views.ViewManager.ViewTableContainer, and Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.

ObjectName Deveel.Data.SystemTableContainer.GetTableName ( int  offset)
inline

Gets the name of the table at the given index in this container.

Parameters
offsetThe zero-based offset of the table whose name to return.
Returns
Returns a
See also
ObjectName
that identifies the table.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Definition at line 62 of file SystemTableContainer.cs.

62  {
63  if (Transaction.RealTableExists(TableName)) {
64  // Search the table. We assume that the schema and name of the object
65  // are in columns 0 and 1 respectively.
66  var table = Transaction.GetTable(TableName);
67  var rowE = table.GetEnumerator();
68  int p = 0;
69  while (rowE.MoveNext()) {
70  int rowIndex = rowE.Current.RowId.RowNumber;
71  if (offset == p) {
72  var obSchema = table.GetValue(rowIndex, 0);
73  var obName = table.GetValue(rowIndex, 1);
74  return new ObjectName(new ObjectName(obSchema.Value.ToString()), obName.Value.ToString());
75  }
76  ++p;
77  }
78  }
79 
80  throw new Exception("Out of bounds.");
81  }
override string ToString()
Definition: ObjectName.cs:225
The system implementation of a transaction model that handles isolated operations within a database c...
Definition: Transaction.cs:35
Describes the name of an object within a database.
Definition: ObjectName.cs:44
abstract string Deveel.Data.SystemTableContainer.GetTableType ( int  offset)
pure virtual

Gets the type of the table at the given offset.

Parameters
offsetThe zero-based offset of the table whose type to return.
Returns
Returns a String that describes the type of table at the given offset.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.Sql.Tables.ITableContainer.

Implemented in Deveel.Data.Sql.Triggers.TriggerManager.TriggersTableContainer, Deveel.Data.Sql.Views.ViewManager.ViewTableContainer, and Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.

Property Documentation

int Deveel.Data.SystemTableContainer.TableCount
get

Definition at line 34 of file SystemTableContainer.cs.

ObjectName Deveel.Data.SystemTableContainer.TableName
getprivate set

Definition at line 32 of file SystemTableContainer.cs.

ITransaction Deveel.Data.SystemTableContainer.Transaction
getprivate set

Definition at line 30 of file SystemTableContainer.cs.


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