59 var merge2 = info.GetSortedItems();
66 if (merge1.Length != merge2.Length)
67 throw new InvalidOperationException(
"Incorrect format in table union");
71 for (
int i = 0; i < merge1.Length; ++i) {
73 size1 = merge1[i].Rows.Count;
75 if (size1 != merge1[i].Rows.Count)
76 throw new InvalidOperationException(
"Incorrect format in table union");
82 for (
int i = 0; i < merge2.Length; ++i) {
84 if (!merge2[i].
Table.TypeEquals(merge1[i].Table))
85 throw new InvalidOperationException(
"Incorrect format in table union");
88 size2 = merge2[i].Rows.Count;
90 if (size2 != merge2[i].Rows.Count)
91 throw new InvalidOperationException(
"Incorrect format in table union");
98 if (size1 == -1 || size2 == -1)
99 throw new InvalidOperationException(
"Incorrect format in table union");
104 var resultItems =
new List<RawTableItem>();
108 int mergeSize = size1 + size2;
109 var elems =
new RawRowItem[mergeSize];
112 for (
int i = 0; i < size1; ++i) {
113 var itemRows =
new int[colCount];
115 for (
int n = 0; n < colCount; ++n) {
116 itemRows[n] = merge1[n].Rows[i];
119 elems[elemsIndex] =
new RawRowItem(itemRows);
123 for (
int i = 0; i < size2; ++i) {
124 var itemRows =
new int[colCount];
126 for (
int n = 0; n < colCount; ++n) {
127 itemRows[n] = merge2[n].Rows[i];
130 elems[elemsIndex] =
new RawRowItem(itemRows);
140 for (
int i = 0; i < colCount; ++i) {
141 merge1[i].Rows.Clear();
144 RawRowItem previous = null;
145 for (
int n = 0; n < mergeSize; ++n) {
146 var current = elems[n];
151 if (previous == null || previous.CompareTo(current) != 0) {
152 for (
int i = 0; i < colCount; ++i) {
153 merge1[i].Rows.Add(current.RowValues[i]);
159 for (
int i = 0; i < colCount; ++i) {
160 resultItems.Add(merge1[i]);
readonly List< RawTableItem > tableItems
RawTableItem[] GetSortedItems()
A TABLE object in a database.