DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Static Public Member Functions | Properties | Static Private Member Functions | Private Attributes | List of all members
Deveel.Data.Sql.Tables.TemporaryTable Class Reference
Inheritance diagram for Deveel.Data.Sql.Tables.TemporaryTable:
Deveel.Data.Sql.Tables.BaseDataTable Deveel.Data.Sql.Tables.RootTable Deveel.Data.Sql.Tables.Table Deveel.Data.Sql.Tables.IRootTable 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

 TemporaryTable (TableInfo tableInfo)
 
 TemporaryTable (IContext context, TableInfo tableInfo)
 
 TemporaryTable (string name, TableInfo sourceTableInfo)
 
 TemporaryTable (IDatabaseContext context, string name, TableInfo sourceTableInfo)
 
 TemporaryTable (IDatabaseContext context, string name, IEnumerable< ColumnInfo > columns)
 
override void Lock ()
 
override void Release ()
 
int NewRow ()
 
int NewRow (DataObject[] row)
 
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...
 
void SetValue (long rowNumber, int columnOffset, DataObject value)
 
void SetValue (int columnOffset, DataObject value)
 
void BuildIndexes ()
 
void BuildIndexes (string indexName)
 
void CopyFrom (ITable table, int row)
 
override IEnumerator< RowGetEnumerator ()
 
- 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...
 

Static Public Member Functions

static TemporaryTable SingleColumnTable (IContext database, string columnName, SqlType columnType)
 

Properties

override TableInfo TableInfo [get]
 
override int RowCount [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]
 

Static Private Member Functions

static TableInfo MakeTableInfo (string tableName, IEnumerable< ColumnInfo > columns)
 

Private Attributes

readonly TableInfo tableInfo
 
int rowCount
 
List< DataObject[]> rows
 

Additional Inherited Members

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

Detailed Description

Definition at line 24 of file TemporaryTable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Tables.TemporaryTable.TemporaryTable ( TableInfo  tableInfo)
inline

Definition at line 29 of file TemporaryTable.cs.

30  : this((IDatabaseContext)null, tableInfo) {
31  }
Deveel.Data.Sql.Tables.TemporaryTable.TemporaryTable ( IContext  context,
TableInfo  tableInfo 
)
inline

Definition at line 33 of file TemporaryTable.cs.

34  : base(context) {
36  rows = new List<DataObject[]>();
37  }
TableInfo AsReadOnly()
Creates a new instance of TableInfo as an immutable copy of this table metadata.
Definition: TableInfo.cs:342
Deveel.Data.Sql.Tables.TemporaryTable.TemporaryTable ( string  name,
TableInfo  sourceTableInfo 
)
inline

Definition at line 39 of file TemporaryTable.cs.

40  : this(null, name, sourceTableInfo) {
41  }
Deveel.Data.Sql.Tables.TemporaryTable.TemporaryTable ( IDatabaseContext  context,
string  name,
TableInfo  sourceTableInfo 
)
inline

Definition at line 43 of file TemporaryTable.cs.

44  : this(context, sourceTableInfo.Alias(new ObjectName(name))) {
45  }
Deveel.Data.Sql.Tables.TemporaryTable.TemporaryTable ( IDatabaseContext  context,
string  name,
IEnumerable< ColumnInfo columns 
)
inline

Definition at line 47 of file TemporaryTable.cs.

48  : this(context, name, MakeTableInfo(name, columns)) {
49  }
static TableInfo MakeTableInfo(string tableName, IEnumerable< ColumnInfo > columns)

Member Function Documentation

void Deveel.Data.Sql.Tables.TemporaryTable.BuildIndexes ( )
inline
void Deveel.Data.Sql.Tables.TemporaryTable.BuildIndexes ( string  indexName)
inline

Definition at line 121 of file TemporaryTable.cs.

121  {
122  SetupIndexes(indexName);
123 
124  for (int i = 0; i < rowCount; i++) {
125  AddRowToIndex(i);
126  }
127  }
void SetupIndexes(string indexTypeName)
void Deveel.Data.Sql.Tables.TemporaryTable.CopyFrom ( ITable  table,
int  row 
)
inline

Definition at line 129 of file TemporaryTable.cs.

129  {
130  NewRow();
131 
132  var columnNames = new ObjectName[table.ColumnCount()];
133  for (int i = 0; i < columnNames.Length; ++i) {
134  columnNames[i] = table.GetResolvedColumnName(i);
135  }
136 
137  for (int i = 0; i < ColumnCount; ++i) {
138  var v = GetResolvedColumnName(i);
139  var colName = v.Name;
140 
141  try {
142  int columnOffset = -1;
143  for (int n = 0; n < columnNames.Length || columnOffset == -1; ++n) {
144  if (columnNames[n].Name.Equals(colName)) {
145  columnOffset = n;
146  }
147  }
148 
149  var value = table.GetValue(row, columnOffset);
150  SetValue(rowCount-1, i, value);
151  } catch (Exception e) {
152  throw new InvalidOperationException(e.Message, e);
153  }
154  }
155  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
override ObjectName GetResolvedColumnName(int column)
void SetValue(long rowNumber, int columnOffset, DataObject value)
override IEnumerator<Row> Deveel.Data.Sql.Tables.TemporaryTable.GetEnumerator ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 158 of file TemporaryTable.cs.

158  {
159  return new SimpleRowEnumerator(this);
160  }
override DataObject Deveel.Data.Sql.Tables.TemporaryTable.GetValue ( long  rowNumber,
int  columnOffset 
)
inlinevirtual

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.Table.

Definition at line 93 of file TemporaryTable.cs.

93  {
94  if (rowNumber >= rows.Count)
95  throw new ArgumentOutOfRangeException("rowNumber");
96  if (columnOffset < 0 || columnOffset > ColumnCount)
97  throw new ArgumentOutOfRangeException("columnOffset");
98 
99  var row = rows[(int) rowNumber];
100  return row[columnOffset];
101  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
override void Deveel.Data.Sql.Tables.TemporaryTable.Lock ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 59 of file TemporaryTable.cs.

59  {
60  }
static TableInfo Deveel.Data.Sql.Tables.TemporaryTable.MakeTableInfo ( string  tableName,
IEnumerable< ColumnInfo columns 
)
inlinestaticprivate

Definition at line 65 of file TemporaryTable.cs.

65  {
66  var tableInfo = new TableInfo(ObjectName.Parse(tableName));
67  foreach (var columnInfo in columns) {
68  tableInfo.AddColumn(columnInfo);
69  }
70  return tableInfo;
71  }
void AddColumn(ColumnInfo column)
Adds a new column to the table at the last position of the columns list in the table metadata...
Definition: TableInfo.cs:230
int Deveel.Data.Sql.Tables.TemporaryTable.NewRow ( )
inline

Definition at line 73 of file TemporaryTable.cs.

73  {
74  rows.Add(new DataObject[ColumnCount]);
75  ++rowCount;
76  return rowCount - 1;
77  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
int Deveel.Data.Sql.Tables.TemporaryTable.NewRow ( DataObject[]  row)
inline

Definition at line 79 of file TemporaryTable.cs.

79  {
80  if (row == null)
81  throw new ArgumentNullException("row");
82  if (row.Length != ColumnCount)
83  throw new ArgumentException();
84 
85  var rowNumber = NewRow();
86  for (int i = 0; i < row.Length; i++) {
87  SetValue(rowNumber, i, row[i]);
88  }
89 
90  return rowNumber;
91  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
void SetValue(long rowNumber, int columnOffset, DataObject value)
override void Deveel.Data.Sql.Tables.TemporaryTable.Release ( )
inlinevirtual

Implements Deveel.Data.Sql.Tables.Table.

Definition at line 62 of file TemporaryTable.cs.

62  {
63  }
void Deveel.Data.Sql.Tables.TemporaryTable.SetValue ( long  rowNumber,
int  columnOffset,
DataObject  value 
)
inline

Definition at line 103 of file TemporaryTable.cs.

103  {
104  if (rowNumber < 0 || rowNumber >= rows.Count)
105  throw new ArgumentOutOfRangeException("rowNumber");
106  if (columnOffset < 0 || columnOffset >= ColumnCount)
107  throw new ArgumentOutOfRangeException("columnOffset");
108 
109  var row = rows[(int) rowNumber];
110  row[columnOffset] = value;
111  }
int IQueryTable. ColumnCount
Definition: Table.cs:59
void Deveel.Data.Sql.Tables.TemporaryTable.SetValue ( int  columnOffset,
DataObject  value 
)
inline

Definition at line 113 of file TemporaryTable.cs.

113  {
114  SetValue(rowCount - 1, columnOffset, value);
115  }
void SetValue(long rowNumber, int columnOffset, DataObject value)
static TemporaryTable Deveel.Data.Sql.Tables.TemporaryTable.SingleColumnTable ( IContext  database,
string  columnName,
SqlType  columnType 
)
inlinestatic

Definition at line 162 of file TemporaryTable.cs.

162  {
163  var tableInfo = new TableInfo(new ObjectName("single"));
164  tableInfo.AddColumn(columnName, columnType);
165  tableInfo = tableInfo.AsReadOnly();
166  return new TemporaryTable(database, tableInfo);
167  }

Member Data Documentation

int Deveel.Data.Sql.Tables.TemporaryTable.rowCount
private

Definition at line 26 of file TemporaryTable.cs.

List<DataObject[]> Deveel.Data.Sql.Tables.TemporaryTable.rows
private

Definition at line 27 of file TemporaryTable.cs.

readonly TableInfo Deveel.Data.Sql.Tables.TemporaryTable.tableInfo
private

Definition at line 25 of file TemporaryTable.cs.

Property Documentation

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

Definition at line 55 of file TemporaryTable.cs.

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

Definition at line 51 of file TemporaryTable.cs.


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