protected override void InternalReset() { _sourceTable.Reset(); _sourceCounter = 0; _lastCompareRow.ClearValues(); _hasLastCompareRow = false; }
protected void FindUniqueKey() { if (!(_table.BOF() || _table.EOF())) { if (_uniqueKey == null) { _uniqueKey = BuildUniqueKeyRow(); } else { _uniqueKey.ClearValues(); } _table.Select(_uniqueKey); } else if (_uniqueKey != null) { _uniqueKey.Dispose(); _uniqueKey = null; } }
protected override bool InternalNext() { if (!_scan.Next()) { ITable table; while (_sourceTables.Count > 0) { // Retrieve the current cursor to be iterated table = (ITable)_sourceTables[0]; bool contextPopped = false; bool contextPushed = false; if (_sourceTables.Count > 1) { // Push it's parent row context, if necessary Program.Stack.Push(_parentRows.Peek(0)); contextPushed = true; } try { if (table.Next()) { _sequence++; table.Select(_sourceRow); if (contextPushed) { contextPopped = true; Program.Stack.Pop(); } _targetRow.ClearValues(); for (int index = 0; index < _sourceRow.DataType.Columns.Count; index++) { _targetRow[index] = _sourceRow[index]; } if (Node.LevelColumnIndex >= 0) { _targetRow[Node.LevelColumnIndex] = _sourceTables.Count; } if (_sequenceColumnIndex >= 0) { _targetRow[_sequenceColumnIndex] = _sequence; } _buffer.Insert(Manager, _targetRow); if (!_scan.FindKey(_targetRow)) { throw new RuntimeException(RuntimeException.Codes.NewRowNotFound); } // Use the current row to push a new cursor looking for children of this row PushSourceTable(_sourceRow); return(true); } else { // The current cursor has been exhausted, pop it. PopSourceTable(); } } finally { if (contextPushed && !contextPopped) { Program.Stack.Pop(); } } } return(false); } return(true); }