/// <summary> /// Creates a new result set and initializes its state /// </summary> /// <param name="ordinal">The ID of the resultset, the ordinal of the result within the batch</param> /// <param name="batchOrdinal">The ID of the batch, the ordinal of the batch within the query</param> /// <param name="factory">Factory for creating a reader/writer</param> public ResultSet(int ordinal, int batchOrdinal, IFileStreamFactory factory) { Id = ordinal; BatchId = batchOrdinal; // Initialize the storage totalBytesWritten = 0; outputFileName = factory.CreateFile(); fileOffsets = new LongList <long>(); specialAction = new SpecialAction(); // Store the factory fileStreamFactory = factory; hasBeenRead = false; SaveTasks = new ConcurrentDictionary <string, Task>(); }
internal Batch(string batchText, SelectionData selection, int ordinalId, IFileStreamFactory outputFileFactory) { // Sanity check for input Validate.IsNotNullOrEmptyString(nameof(batchText), batchText); Validate.IsNotNull(nameof(outputFileFactory), outputFileFactory); Validate.IsGreaterThan(nameof(ordinalId), ordinalId, 0); // Initialize the internal state BatchText = batchText; Selection = selection; executionStartTime = DateTime.Now; HasExecuted = false; Id = ordinalId; resultSets = new List <ResultSet>(); this.outputFileFactory = outputFileFactory; specialAction = new SpecialAction(); }
/// <summary> /// Creates a new result set and initializes its state /// </summary> /// <param name="reader">The reader from executing a query</param> /// <param name="ordinal">The ID of the resultset, the ordinal of the result within the batch</param> /// <param name="batchOrdinal">The ID of the batch, the ordinal of the batch within the query</param> /// <param name="factory">Factory for creating a reader/writer</param> public ResultSet(DbDataReader reader, int ordinal, int batchOrdinal, IFileStreamFactory factory) { // Sanity check to make sure we got a reader Validate.IsNotNull(nameof(reader), SR.QueryServiceResultSetReaderNull); dataReader = new StorageDataReader(reader); Id = ordinal; BatchId = batchOrdinal; // Initialize the storage outputFileName = factory.CreateFile(); fileOffsets = new LongList <long>(); specialAction = new SpecialAction(); // Store the factory fileStreamFactory = factory; hasBeenRead = false; SaveTasks = new ConcurrentDictionary <string, Task>(); }
/// <summary> /// Aggregate this special action with the input /// </summary> public void CombineSpecialAction(SpecialAction action) { flags |= ((action?.flags) ?? ActionFlags.None); }
/// <summary> /// Aggregate this special action with the input /// </summary> public void CombineSpecialAction(SpecialAction action) { flags |= action.flags; }