Summary

Class:CBAM.SQL.Implementation.SQLConnectionFunctionalitySU`1
Assembly:CBAM.SQL.Implementation
File(s):/repo-dir/contents/Source/Code/CBAM.SQL.Implementation/Connection.Stream.cs
Covered lines:11
Uncovered lines:0
Coverable lines:11
Total lines:104
Line coverage:100%
Branch coverage:87.5%

Coverage History

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
.ctor(...)101%0%
ExecuteStatement()601%1%
GetInformationFromStatement(...)201%0.5%

File(s)

/repo-dir/contents/Source/Code/CBAM.SQL.Implementation/Connection.Stream.cs

#LineLine coverage
 1/*
 2 * Copyright 2017 Stanislav Muhametsin. All rights Reserved.
 3 *
 4 * Licensed  under the  Apache License,  Version 2.0  (the "License");
 5 * you may not use  this file  except in  compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 *   http://www.apache.org/licenses/LICENSE-2.0
 9 *
 10 * Unless required by applicable law or agreed to in writing, software
 11 * distributed  under the  License is distributed on an "AS IS" BASIS,
 12 * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
 13 * implied.
 14 *
 15 * See the License for the specific language governing permissions and
 16 * limitations under the License.
 17 */
 18using AsyncEnumeration.Abstractions;
 19using AsyncEnumeration.Implementation.Enumerable;
 20using CBAM.Abstractions.Implementation;
 21using System;
 22using System.Collections.Generic;
 23using System.Text;
 24using System.Threading;
 25using System.Threading.Tasks;
 26using UtilPack;
 27
 28namespace CBAM.SQL.Implementation
 29{
 30   using TStatementExecutionTaskParameter = System.ValueTuple<SQLStatementExecutionResult, Func<ValueTask<(Boolean, SQLS
 31
 32   /// <summary>
 33   /// This class extends <see cref="ConnectionFunctionalitySU{TStatement, TStatementInformation, TStatementCreationArgs
 34   /// </summary>
 35   /// <typeparam name="TVendor">The actual type of <see cref="SQLConnectionVendorFunctionality"/>.</typeparam>
 36   public abstract class SQLConnectionFunctionalitySU<TVendor> : ConnectionFunctionalitySU<SQLStatementBuilder, SQLState
 37      where TVendor : SQLConnectionVendorFunctionality
 38   {
 39
 40      /// <summary>
 41      /// Initializes new instance of <see cref="SQLConnectionFunctionalitySU{TVendor}"/> with given vendor.
 42      /// </summary>
 43      /// <param name="vendor">The vendor functionality.</param>
 44      /// <param name="asyncProvider">The <see cref="IAsyncProvider"/> to use.</param>
 45      public SQLConnectionFunctionalitySU( TVendor vendor, IAsyncProvider asyncProvider )
 2446         : base( vendor, asyncProvider )
 47      {
 2448      }
 49
 50      /// <summary>
 51      /// This method implements <see cref="ConnectionFunctionalitySU{TStatement, TStatementInformation, TStatementCreat
 52      /// </summary>
 53      /// <param name="stmt">The <see cref="SQLStatementBuilderInformation"/> to use.</param>
 54      /// <param name="reservationObject">The <see cref="ReservedForStatement"/> object of this execution.</param>
 55      /// <returns>The result of <see cref="ExecuteStatementAsBatch(SQLStatementBuilderInformation, ReservedForStatement
 56      protected override async ValueTask<(SQLStatementExecutionResult, Boolean, Func<ValueTask<(Boolean, SQLStatementExe
 57      {
 9158         var retVal = await ( stmt.HasBatchParameters() ?
 9159            this.ExecuteStatementAsBatch( stmt, reservationObject ) : (
 9160               stmt.SQLParameterCount > 0 ?
 9161                  this.ExecuteStatementAsPrepared( stmt, reservationObject ) :
 9162                  this.ExecuteStatementAsSimple( stmt, reservationObject )
 9163            ) );
 64
 9865         return (retVal.Item1, retVal.Item1 != null, retVal.Item2);
 9866      }
 67
 68      /// <summary>
 69      /// Implements <see cref="DefaultConnectionFunctionality{TStatement, TStatementInformation, TStatementCreationArgs
 70      /// </summary>
 71      /// <param name="statement">The <see cref="SQLStatementBuilder"/>.</param>
 72      /// <returns>The result of <see cref="SQLStatementBuilder.StatementBuilderInformation"/>.</returns>
 73      protected override SQLStatementBuilderInformation GetInformationFromStatement( SQLStatementBuilder statement )
 74      {
 9475         return statement?.StatementBuilderInformation;
 76      }
 77
 78      /// <summary>
 79      /// Derived classes should implement this method in order to execute <see cref="SQLStatementBuilderInformation"/> 
 80      /// </summary>
 81      /// <param name="stmt">The <see cref="SQLStatementBuilderInformation"/> to use.</param>
 82      /// <param name="reservationObject">The <see cref="ReservedForStatement"/> object of this execution.</param>
 83      /// <returns>Asynchronously returns the tuple of <see cref="SQLStatementExecutionResult"/> resulted from executing
 84      protected abstract ValueTask<TStatementExecutionTaskParameter> ExecuteStatementAsSimple( SQLStatementBuilderInform
 85
 86      /// <summary>
 87      /// Derived classes should implement this method in order to execute <see cref="SQLStatementBuilderInformation"/> 
 88      /// </summary>
 89      /// <param name="stmt">The <see cref="SQLStatementBuilderInformation"/> to use.</param>
 90      /// <param name="reservationObject">The <see cref="ReservedForStatement"/> object of this execution.</param>
 91      /// <returns>Asynchronously returns the tuple of <see cref="SQLStatementExecutionResult"/> resulted from executing
 92      protected abstract ValueTask<TStatementExecutionTaskParameter> ExecuteStatementAsPrepared( SQLStatementBuilderInfo
 93
 94      /// <summary>
 95      /// Derived classes should implement this method in order to execute <see cref="SQLStatementBuilderInformation"/> 
 96      /// </summary>
 97      /// <param name="stmt">The <see cref="SQLStatementBuilderInformation"/> to use.</param>
 98      /// <param name="reservationObject">The <see cref="ReservedForStatement"/> object of this execution.</param>
 99      /// <returns>Asynchronously returns the tuple of <see cref="SQLStatementExecutionResult"/> resulted from executing
 100      protected abstract ValueTask<TStatementExecutionTaskParameter> ExecuteStatementAsBatch( SQLStatementBuilderInforma
 101
 102   }
 103
 104}