18 using System.Collections.Generic;
22 namespace Deveel.Data.Sql.Tables {
27 private OuterTable(IEnumerable<ITable> tables, IList<IList<int>> rows)
28 : base(tables, rows) {
29 outerRows =
new IList<int>[rows.Count];
33 var baseTable = inputTable.GetRawTableInfo();
34 var tables = baseTable.GetTables();
35 var rows = baseTable.GetRows();
40 public override int RowCount {
41 get {
return base.RowCount + outerRowCount; }
45 var rawTableInfo = outsideTable.GetRawTableInfo();
48 var baseTables = ReferenceTables;
49 IList<int>[] baseRows = ReferenceRows;
52 var tables = rawTableInfo.GetTables();
53 var rows = rawTableInfo.GetRows();
55 outerRowCount = rows[0].Count;
57 for (
int i = 0; i < baseTables.Length; ++i) {
58 var btable = baseTables[i];
60 for (
int n = 0; n < tables.Length && index == -1; ++n) {
61 if (btable == tables[n]) {
70 List<int> list =
new List<int>(outerRowCount);
73 IList<int> toMerge = rows[index];
74 if (toMerge.Count != outerRowCount)
75 throw new InvalidOperationException(
"Wrong size for rows being merged in.");
77 list.AddRange(toMerge);
83 if (ColumnIndices[column] == null) {
86 ColumnIndices[column] = index.GetSubset(
this, column);
90 return ColumnIndices[column];
92 return ColumnIndices[column].GetSubset(table, originalColumn);
96 int tableNum = ColumnTable[columnOffset];
97 var parentTable = ReferenceTables[tableNum];
99 if (rowNumber >= outerRowCount) {
100 rowNumber = ReferenceRows[tableNum][(int)rowNumber - outerRowCount];
101 return parentTable.GetValue(rowNumber, ColumnFilter[columnOffset]);
104 if (outerRows[tableNum] == null)
108 rowNumber = outerRows[tableNum][(int)rowNumber];
109 return parentTable.GetValue(rowNumber, ColumnFilter[columnOffset]);
Defines the contract to access the data contained into a table of a database.
override DataObject GetValue(long rowNumber, int columnOffset)
Gets a single cell within the table that is located at the given column offset and row...
OuterTable(IEnumerable< ITable > tables, IList< IList< int >> rows)
static OuterTable Create(ITable inputTable)
override ColumnIndex GetIndex(int column, int originalColumn, ITable table)
void MergeIn(ITable outsideTable)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
readonly IList< int >[] outerRows
Defines the metadata properties of a table existing within a database.