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
191
191
base . VisitSqlConstant ( sqlConstantExpression ) ;
192
192
if ( shouldExplicitStringLiteralTypes )
193
193
{
194
+ var isUnicode = FbTypeMappingSource . IsUnicode ( sqlConstantExpression . TypeMapping ) ;
194
195
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 ) ) ;
196
197
Sql . Append ( ")" ) ;
197
198
}
198
199
return sqlConstantExpression ;
Original file line number Diff line number Diff line change @@ -27,11 +27,15 @@ public FbSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependenc
27
27
: base ( dependencies )
28
28
{ }
29
29
30
- public virtual string StringLiteralQueryType ( string s )
30
+ public virtual string StringLiteralQueryType ( string s , bool isUnicode = true )
31
31
{
32
32
var length = MinimumStringQueryTypeLength ( s ) ;
33
33
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 } )";
35
39
}
36
40
37
41
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;
22
22
23
23
public interface IFbSqlGenerationHelper : ISqlGenerationHelper
24
24
{
25
- string StringLiteralQueryType ( string s ) ;
25
+ string StringLiteralQueryType ( string s , bool isUnicode ) ;
26
26
string StringParameterQueryType ( bool isUnicode ) ;
27
27
void GenerateBlockParameterName ( StringBuilder builder , string name ) ;
28
28
string AlternativeStatementTerminator { get ; }
You can’t perform that action at this time.
0 commit comments