private Row EnsureKeyRow(Row AKey) { Row LKey = AKey; bool LIsKeyRow = AKey.DataType.Columns.Count <= FAccessPath.KeyRowType.Columns.Count; for (int LIndex = 0; LIndex < FAccessPath.KeyRowType.Columns.Count; LIndex++) { if (LIndex >= AKey.DataType.Columns.Count) { break; } else { if (!Schema.Object.NamesEqual(AKey.DataType.Columns[LIndex].Name, FAccessPath.KeyRowType.Columns[LIndex].Name)) { LIsKeyRow = false; break; } } } if (!LIsKeyRow) { LKey = FProcess.RowManager.RequestRow(FProcess, FAccessPath.KeyRowType); AKey.CopyTo(LKey); } return(LKey); }
protected override bool InternalNext() { if (Node.DistinctRequired) { while (true) { if (_sourceTable.Next()) { _sourceTable.Select(_currentRow); if (_crack) { _crack = false; break; } Program.Stack.Push(_currentRow); try { Program.Stack.Push(_lastRow); try { object equal = Node.EqualNode.Execute(Program); if ((equal == null) || !(bool)equal) { break; } } finally { Program.Stack.Pop(); } } finally { Program.Stack.Pop(); } } else { _crack = true; _lastRow.ClearValues(); return(false); } } _currentRow.CopyTo(_lastRow); return(true); } else { return(_sourceTable.Next()); } }
protected override void InternalSelect(IRow row) { var localRow = new Row(Manager, _map.Index.DataRowType, _enumerator.Current.Value); try { localRow.CopyTo(row); } finally { localRow.Dispose(); } }
public override void CopyData(ServerProcess AProcess, Stream ASourceData, Stream ATargetData) { Row LSourceRow = AProcess.RowManager.RequestRow(AProcess, FDataRowType, ASourceData); try { Row LTargetRow = AProcess.RowManager.RequestRow(AProcess, FDataRowType, ATargetData); try { LSourceRow.CopyTo(LTargetRow); } finally { AProcess.RowManager.ReleaseRow(LTargetRow); } } finally { AProcess.RowManager.ReleaseRow(LSourceRow); } }
public override void CopyKey(ServerProcess AProcess, Stream ASourceKey, Stream ATargetKey) { Row LSourceKey = AProcess.RowManager.RequestRow(AProcess, FKeyRowType, ASourceKey); try { Row LTargetKey = AProcess.RowManager.RequestRow(AProcess, FKeyRowType, ATargetKey); try { LSourceKey.CopyTo(LTargetKey); } finally { AProcess.RowManager.ReleaseRow(LTargetKey); } } finally { AProcess.RowManager.ReleaseRow(LSourceKey); } }
protected override void InternalSelect(IRow row) { _sourceTable.Select(_sourceRow); _sourceRow.CopyTo(row); }
public void GetRow(Row ARow) { CheckActive(); CheckNotCrack(); if ((FAccessPath.IsClustered) || IsSubset(ARow, FAccessPath)) { Row LRow = FProcess.RowManager.RequestRow(FProcess, FAccessPath.KeyRowType, FIndexNode.Key(FEntryNumber)); try { LRow.CopyTo(ARow); } finally { FProcess.RowManager.ReleaseRow(LRow); } LRow = FProcess.RowManager.RequestRow(FProcess, FAccessPath.DataRowType, FIndexNode.Data(FEntryNumber)); try { LRow.CopyTo(ARow); } finally { FProcess.RowManager.ReleaseRow(LRow); } } else { using (SearchPath LSearchPath = new SearchPath()) { int LEntryNumber; bool LResult = FTable.ClusteredIndex.FindKey(FProcess, FIndexNode.Data(FEntryNumber), null, LSearchPath, out LEntryNumber); if (LResult) { Row LRow = FProcess.RowManager.RequestRow(FProcess, FTable.ClusteredIndex.KeyRowType, LSearchPath.DataNode.Key(LEntryNumber)); try { LRow.CopyTo(ARow); } finally { FProcess.RowManager.ReleaseRow(LRow); } LRow = FProcess.RowManager.RequestRow(FProcess, FTable.ClusteredIndex.DataRowType, LSearchPath.DataNode.Data(LEntryNumber)); try { LRow.CopyTo(ARow); } finally { FProcess.RowManager.ReleaseRow(LRow); } } else { throw new ScanException(ScanException.Codes.ClusteredRowNotFound); } } } }
public void GetRow(IRow row) { #if SAFETABLES CheckActive(); #endif CheckNotCrack(); if ((_accessPath.IsClustered) || IsSubset(row, _accessPath)) { Row localRow = new Row(_manager, _accessPath.KeyRowType, _indexNode.Node.Keys[_entryNumber]); try { localRow.CopyTo(row); } finally { localRow.Dispose(); } localRow = new Row(_manager, _accessPath.DataRowType, _indexNode.DataNode.Rows[_entryNumber]); try { localRow.CopyTo(row); } finally { localRow.Dispose(); } } else { using (RowTreeSearchPath searchPath = new RowTreeSearchPath()) { int entryNumber; bool result = _table.ClusteredIndex.FindKey(_manager, _table.ClusteredIndex.KeyRowType, _indexNode.DataNode.Rows[_entryNumber], searchPath, out entryNumber); if (result) { Row localRow = new Row(_manager, _table.ClusteredIndex.KeyRowType, searchPath.DataNode.Node.Keys[entryNumber]); try { localRow.CopyTo(row); } finally { localRow.Dispose(); } localRow = new Row(_manager, _table.ClusteredIndex.DataRowType, searchPath.DataNode.DataNode.Rows[entryNumber]); try { localRow.CopyTo(row); } finally { localRow.Dispose(); } } else { throw new ScanException(ScanException.Codes.ClusteredRowNotFound); } } } }