Ejemplo n.º 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));
            }
        }
 public static IChunkParser GetParser(Stream stream)
 {
     if (!SFConfiguration.Instance().UseV2JsonParser)
     {
         return(new ChunkDeserializer(stream));
     }
     else
     {
         return(new ChunkStreamingParser(stream));
     }
 }
Ejemplo n.º 3
0
        public void TestUseV2ChunkDownloader()
        {
            SFConfiguration.Instance().UseV2ChunkDownloader = true;

            using (IDbConnection conn = new SnowflakeDbConnection())
            {
                conn.ConnectionString = ConnectionString;

                conn.Open();

                IDbCommand cmd = conn.CreateCommand();
                cmd.CommandText = "select seq4(), uniform(1, 10, 42) from table(generator(rowcount => 200000)) v order by 1";
                IDataReader reader  = cmd.ExecuteReader();
                int         counter = 0;
                while (reader.Read())
                {
                    Assert.AreEqual(counter.ToString(), reader.GetString(0));
                    counter++;
                }
                conn.Close();
            }
        }
 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));
     }
 }