Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 795b51b

Browse files
Add isUnicode parameter to StringLiteralQueryType function (#1192)
1 parent 4d174f3 commit 795b51b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

‎src/FirebirdSql.EntityFrameworkCore.Firebird/Query/Internal/FbQuerySqlGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

‎src/FirebirdSql.EntityFrameworkCore.Firebird/Storage/Internal/FbSqlGenerationHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public FbSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependenc
2727
: base(dependencies)
2828
{ }
2929

30-
public virtual string StringLiteralQueryType(string s)
30+
public virtual string StringLiteralQueryType(string s,boolisUnicode=true)
3131
{
3232
var length = MinimumStringQueryTypeLength(s);
33-
EnsureStringLiteralQueryTypeLength(length);
34-
return $"VARCHAR({length}) CHARACTER SET UTF8";
33+
varcharset=isUnicode?" CHARACTER SET UTF8":string.Empty;
34+
return $"VARCHAR({length}){charset}";
3535
}
3636

3737
public virtual string StringParameterQueryType(bool isUnicode)

‎src/FirebirdSql.EntityFrameworkCore.Firebird/Storage/Internal/IFbSqlGenerationHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace FirebirdSql.EntityFrameworkCore.Firebird.Storage.Internal;
2222

2323
public interface IFbSqlGenerationHelper : ISqlGenerationHelper
2424
{
25-
string StringLiteralQueryType(string s);
25+
string StringLiteralQueryType(string s,boolisUnicode);
2626
string StringParameterQueryType(bool isUnicode);
2727
void GenerateBlockParameterName(StringBuilder builder, string name);
2828
string AlternativeStatementTerminator { get; }

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /