예제 #1
0
        /// <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>();
        }
예제 #2
0
        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();
        }
예제 #3
0
        /// <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>();
        }
예제 #4
0
 /// <summary>
 /// Aggregate this special action with the input
 /// </summary>
 public void CombineSpecialAction(SpecialAction action)
 {
     flags |= ((action?.flags) ?? ActionFlags.None);
 }
예제 #5
0
 /// <summary>
 /// Aggregate this special action with the input
 /// </summary>
 public void CombineSpecialAction(SpecialAction action)
 {
     flags |= action.flags;
 }