/// <summary>
        ///     Processes the <see cref="SelectExpression"/> based on nullability of nodes to apply null semantics in use and
        ///     optimize it for given parameter values.
        /// </summary>
        /// <param name="selectExpression"> A select expression to optimize. </param>
        /// <param name="parametersValues"> A dictionary of parameter values to use. </param>
        /// <param name="canCache"> A bool value indicating if the select expression can be cached. </param>
        /// <returns> A processed select expression. </returns>
        protected virtual SelectExpression ProcessSqlNullability(
            [NotNull] SelectExpression selectExpression, [NotNull] IReadOnlyDictionary <string, object> parametersValues, out bool canCache)
        {
            Check.NotNull(selectExpression, nameof(selectExpression));
            Check.NotNull(parametersValues, nameof(parametersValues));

            return(_sqlNullabilityProcessor.Process(selectExpression, parametersValues, out canCache));
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override SelectExpression ProcessSqlNullability(
            SelectExpression selectExpression, IReadOnlyDictionary <string, object> parametersValues, out bool canCache)
        {
            Check.NotNull(selectExpression, nameof(selectExpression));
            Check.NotNull(parametersValues, nameof(parametersValues));

            selectExpression = _sqlNullabilityProcessor.Process(selectExpression, parametersValues, out canCache);

            if (_options.IndexOptimizedBooleanColumns)
            {
                selectExpression = (SelectExpression) new MySqlBoolOptimizingExpressionVisitor(Dependencies.SqlExpressionFactory).Visit(selectExpression);
            }

            // Run the compatibility checks as late in the query pipeline (before the actual SQL translation happens) as reasonable.
            selectExpression = (SelectExpression) new MySqlCompatibilityExpressionVisitor(_options).Visit(selectExpression);

            return(selectExpression);
        }