18 using System.Collections.Generic;
21 namespace Deveel.Data.Sql.Tables {
27 : this(tables, null) {
30 public VirtualTable(IEnumerable<ITable> tables, IList<IList<int>> rows)
41 SetRows(
new []{rows});
44 private void SetRows(IList<IList<int>> rows) {
45 var tableList = ReferenceTables.ToList();
47 for (
int i = 0; i < tableList.Count; ++i) {
48 rowList[i] =
new List<int>(rows[i]);
51 rowCount = rows[0].Count();
55 protected override void Init(IEnumerable<ITable> tables) {
56 var tableList = tables.ToList();
59 int tableCount = tableList.Count;
60 rowList =
new IList<int>[tableCount];
61 for (
int i = 0; i < tableCount; ++i) {
62 rowList[i] =
new List<int>();
66 public override int RowCount {
67 get {
return rowCount; }
70 protected IList<int>[] ReferenceRows {
71 get {
return rowList; }
75 var rowSet = rows.ToList();
76 IList<int> curRowList = rowList[tableNum];
77 for (
int n = rowSet.Count - 1; n >= 0; --n) {
79 int bb = curRowList[aa];
83 return rowSet.ToArray();
Defines the contract to access the data contained into a table of a database.
override IEnumerable< int > ResolveRowsForTable(IEnumerable< int > rows, int tableNum)
VirtualTable(ITable table, IList< int > rows)
override void Init(IEnumerable< ITable > tables)
VirtualTable(ITable table)
void SetRows(IList< IList< int >> rows)
VirtualTable(IEnumerable< ITable > tables)
VirtualTable(IEnumerable< ITable > tables, IList< IList< int >> rows)