示例#1
0
        public static IChunkDownloader GetDownloader(QueryExecResponseData responseData,
                                                     SFBaseResultSet resultSet,
                                                     CancellationToken cancellationToken)
        {
            if (SFConfiguration.Instance().UseV2ChunkDownloader)
            {
                SFConfiguration.Instance().ChunkDownloaderVersion = 2;
            }

            switch (SFConfiguration.Instance().ChunkDownloaderVersion)
            {
            case 1:
                return(new SFBlockingChunkDownloader(responseData.rowType.Count,
                                                     responseData.chunks,
                                                     responseData.qrmk,
                                                     responseData.chunkHeaders,
                                                     cancellationToken,
                                                     resultSet));

            case 2:
                return(new SFChunkDownloaderV2(responseData.rowType.Count,
                                               responseData.chunks,
                                               responseData.qrmk,
                                               responseData.chunkHeaders,
                                               cancellationToken));

            default:
                return(new SFBlockingChunkDownloaderV3(responseData.rowType.Count,
                                                       responseData.chunks,
                                                       responseData.qrmk,
                                                       responseData.chunkHeaders,
                                                       cancellationToken,
                                                       resultSet));
            }
        }
示例#2
0
        public SFResultSet(QueryExecResponseData responseData, SFStatement sfStatement, CancellationToken cancellationToken)
        {
            columnCount           = responseData.rowType.Count;
            _currentChunkRowIdx   = -1;
            _currentChunkRowCount = responseData.rowSet.GetLength(0);

            this.sfStatement = sfStatement;

            if (responseData.chunks != null)
            {
                // counting the first chunk
                _totalChunkCount = responseData.chunks.Count + 1;
                _chunkDownloader = new SFChunkDownloader(columnCount,
                                                         responseData.chunks,
                                                         responseData.qrmk,
                                                         responseData.chunkHeaders,
                                                         cancellationToken);
            }

            _currentChunk       = new SFResultChunk(responseData.rowSet);
            responseData.rowSet = null;

            sfResultSetMetaData = new SFResultSetMetaData(responseData);

            updateSessionStatus(responseData);
            isClosed = false;
        }
        public SFResultSet(QueryExecResponseData responseData, SFStatement sfStatement)
        {
            execFirstChunkData   = responseData;
            columnCount          = responseData.rowType.Count;
            currentChunkRowIdx   = -1;
            currentChunkRowCount = responseData.rowSet.GetLength(0);
            currentChunkIndex    = 0;

            this.sfStatement = sfStatement;

            if (responseData.chunks != null)
            {
                // counting the first chunk
                totalChunkCount = responseData.chunks.Count + 1;
                chunkDownloader = new SFChunkDownloader(responseData.rowType.Count,
                                                        responseData.chunks,
                                                        responseData.qrmk,
                                                        responseData.chunkHeaders);
            }

            currentChunk = new SFResultChunk(responseData.rowSet);

            sfResultSetMetaData = new SFResultSetMetaData(responseData);

            updateSessionStatus(responseData);
            isClosed = false;
        }
        private void updateSessionStatus(QueryExecResponseData responseData)
        {
            SFSession session = this.sfStatement.SfSession;

            session.database = responseData.finalDatabaseName;
            session.schema   = responseData.finalSchemaName;

            session.UpdateSessionParameterMap(responseData.parameters);
        }
        internal SFResultSetMetaData(QueryExecResponseData queryExecResponseData)
        {
            rowTypes      = queryExecResponseData.rowType;
            columnCount   = rowTypes.Count;
            statementType = findStatementTypeById(queryExecResponseData.statementTypeId);

            foreach (NameValueParameter parameter in queryExecResponseData.parameters)
            {
                switch (parameter.name)
                {
                case "DATE_OUTPUT_FORMAT":
                    dateOutputFormat = parameter.value;
                    break;

                case "TIME_OUTPUT_FORMAT":
                    timeOutputFormat = parameter.value;
                    break;
                }
            }
        }
 public static IChunkDownloader GetDownloader(QueryExecResponseData responseData,
                                              SFBaseResultSet resultSet,
                                              CancellationToken cancellationToken)
 {
     if (SFConfiguration.Instance().UseV2ChunkDownloader)
     {
         return(new SFChunkDownloaderV2(responseData.rowType.Count,
                                        responseData.chunks,
                                        responseData.qrmk,
                                        responseData.chunkHeaders,
                                        cancellationToken));
     }
     else
     {
         return(new SFBlockingChunkDownloader(responseData.rowType.Count,
                                              responseData.chunks,
                                              responseData.qrmk,
                                              responseData.chunkHeaders,
                                              cancellationToken,
                                              resultSet));
     }
 }