Beispiel #1
0
        private MySqlCollateExpression ApplyTypeMappingOnCollate(MySqlCollateExpression collateExpression)
        {
            var inferredTypeMapping = ExpressionExtensions.InferTypeMapping(collateExpression.ValueExpression)
                                      ?? _typeMappingSource.FindMapping(collateExpression.ValueExpression.Type);

            return(new MySqlCollateExpression(
                       ApplyTypeMapping(collateExpression.ValueExpression, inferredTypeMapping),
                       collateExpression.Charset,
                       collateExpression.Collation,
                       inferredTypeMapping ?? collateExpression.TypeMapping));
        }
Beispiel #2
0
        public Expression VisitMySqlCollateExpression(MySqlCollateExpression mySqlCollateExpression)
        {
            Check.NotNull(mySqlCollateExpression, nameof(mySqlCollateExpression));

            Sql.Append("CONVERT(");

            Visit(mySqlCollateExpression.ValueExpression);

            Sql.Append($" USING {mySqlCollateExpression.Charset}) COLLATE {mySqlCollateExpression.Collation}");

            return(mySqlCollateExpression);
        }
 private SqlExpression ApplyNewTypeMapping(SqlExpression sqlExpression, RelationalTypeMapping typeMapping)
 {
     return(sqlExpression switch
     {
         MySqlComplexFunctionArgumentExpression e => ApplyTypeMappingOnComplexFunctionArgument(e),
         MySqlCollateExpression e => ApplyTypeMappingOnCollate(e),
         MySqlRegexpExpression e => ApplyTypeMappingOnRegexp(e),
         MySqlBinaryExpression e => ApplyTypeMappingOnMySqlBinary(e, typeMapping),
         MySqlMatchExpression e => ApplyTypeMappingOnMatch(e),
         MySqlJsonArrayIndexExpression e => e.ApplyTypeMapping(typeMapping),
         _ => base.ApplyTypeMapping(sqlExpression, typeMapping)
     });