Exemplo n.º 1
0
        public async Task <IStatementResultCursor> RunInExplicitTransactionAsync(IConnection connection,
                                                                                 Statement statement, bool reactive)
        {
            var summaryBuilder = new SummaryBuilder(statement, connection.Server);
            var streamBuilder  = new StatementResultCursorBuilder(summaryBuilder, connection.ReceiveOneAsync, null, null, null);
            var runHandler     = new V1.RunResponseHandler(streamBuilder, summaryBuilder);
            var pullAllHandler = new V1.PullResponseHandler(streamBuilder, summaryBuilder);
            await connection.EnqueueAsync(new RunMessage(statement), runHandler, PullAll, pullAllHandler)
            .ConfigureAwait(false);

            await connection.SendAsync().ConfigureAwait(false);

            return(streamBuilder.CreateCursor());
        }
Exemplo n.º 2
0
        public async Task <IStatementResultCursor> RunInAutoCommitTransactionAsync(IConnection connection,
                                                                                   Statement statement, bool reactive, IBookmarkTracker bookmarkTracker,
                                                                                   IResultResourceHandler resultResourceHandler,
                                                                                   Bookmark ignored, TransactionConfig txConfig)
        {
            AssertNullOrEmptyTransactionConfig(txConfig);
            var summaryBuilder = new SummaryBuilder(statement, connection.Server);
            var streamBuilder  = new StatementResultCursorBuilder(summaryBuilder, connection.ReceiveOneAsync, null, null,
                                                                  resultResourceHandler);
            var runHandler     = new V1.RunResponseHandler(streamBuilder, summaryBuilder);
            var pullAllHandler = new V1.PullResponseHandler(streamBuilder, summaryBuilder);
            await connection.EnqueueAsync(new RunMessage(statement), runHandler, PullAll, pullAllHandler)
            .ConfigureAwait(false);

            await connection.SendAsync().ConfigureAwait(false);

            return(streamBuilder.CreateCursor());
        }