File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
src/FirebirdSql.EntityFrameworkCore.Firebird Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,9 @@ protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstant
191191 base . VisitSqlConstant ( sqlConstantExpression ) ;
192192 if ( shouldExplicitStringLiteralTypes )
193193 {
194+ var isUnicode = FbTypeMappingSource . IsUnicode ( sqlConstantExpression . TypeMapping ) ;
194195 Sql . Append ( " AS " ) ;
195- Sql . Append ( ( ( IFbSqlGenerationHelper ) Dependencies . SqlGenerationHelper ) . StringLiteralQueryType ( sqlConstantExpression . Value as string ) ) ;
196+ Sql . Append ( ( ( IFbSqlGenerationHelper ) Dependencies . SqlGenerationHelper ) . StringLiteralQueryType ( sqlConstantExpression . Value as string , isUnicode ) ) ;
196197 Sql . Append ( ")" ) ;
197198 }
198199 return sqlConstantExpression ;
Original file line number Diff line number Diff line change @@ -27,11 +27,15 @@ public FbSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependenc
2727 : base ( dependencies )
2828 { }
2929
30- public virtual string StringLiteralQueryType ( string s )
30+ public virtual string StringLiteralQueryType ( string s , bool isUnicode = true )
3131 {
3232 var length = MinimumStringQueryTypeLength ( s ) ;
3333 EnsureStringLiteralQueryTypeLength ( length ) ;
34- return $ "VARCHAR({ length } ) CHARACTER SET UTF8";
34+ if ( isUnicode )
35+ {
36+ return $ "VARCHAR({ length } ) CHARACTER SET UTF8";
37+ }
38+ return $ "VARCHAR({ length } )";
3539 }
3640
3741 public virtual string StringParameterQueryType ( bool isUnicode )
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ namespace FirebirdSql.EntityFrameworkCore.Firebird.Storage.Internal;
2222
2323public interface IFbSqlGenerationHelper : ISqlGenerationHelper
2424{
25- string StringLiteralQueryType ( string s ) ;
25+ string StringLiteralQueryType ( string s , bool isUnicode ) ;
2626 string StringParameterQueryType ( bool isUnicode ) ;
2727 void GenerateBlockParameterName ( StringBuilder builder , string name ) ;
2828 string AlternativeStatementTerminator { get ; }
You can’t perform that action at this time.
0 commit comments