Skip to content

Commit 4b89d37

Browse files
committed
SqlServer: Fixed reading some constants of types such as byte, short, Guid
1 parent cea53c7 commit 4b89d37

File tree

1 file changed

+6
-2
lines changed
  • Orm/Xtensive.Orm.SqlServer/Sql.Drivers.SqlServer/v09

1 file changed

+6
-2
lines changed

Orm/Xtensive.Orm.SqlServer/Sql.Drivers.SqlServer/v09/Translator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,12 @@ public override string Translate(SqlCompilerContext context, object literalValue
539539
builder.AppendHexArray(array);
540540
return builder.ToString();
541541
}
542-
if (literalType==typeof(Guid))
543-
return QuoteString(literalValue.ToString());
542+
if (literalType == typeof(Guid))
543+
return string.Format("CAST ({0} AS UNIQUEIDENTIFIER)", QuoteString(literalValue.ToString()));
544+
if (literalType == typeof(byte))
545+
return string.Format("CAST({0} as TINYINT)", base.Translate(context, literalValue));
546+
if (literalType == typeof(short))
547+
return string.Format("CAST({0} as SMALLINT)", base.Translate(context, literalValue));
544548
if (literalType==typeof (Int64))
545549
return String.Format("CAST({0} as BIGINT)", literalValue);
546550
return base.Translate(context, literalValue);

0 commit comments

Comments
 (0)