Skip to content

Commit b9bc5bb

Browse files
committed
MySql provider changes
1 parent 582ea2b commit b9bc5bb

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

Orm/Xtensive.Orm.MySql/Sql.Drivers.MySql/v5_0/Extractor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ private SqlValueType CreateValueType(IDataRecord row,
655655
if (typeName.StartsWith("DATETIME", StringComparison.Ordinal)) {
656656
return new SqlValueType(SqlType.DateTime);
657657
}
658-
659658
#if NET6_0_OR_GREATER
660659
if (typeName.Equals("TIME", StringComparison.Ordinal) || typeName.StartsWith("TIME(")) {
661660
return new SqlValueType(SqlType.Time);

Orm/Xtensive.Orm.MySql/Sql.Drivers.MySql/v5_6/ServerInfoProvider.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace Xtensive.Sql.Drivers.MySql.v5_6
1111
{
1212
internal class ServerInfoProvider : v5_5.ServerInfoProvider
1313
{
14-
#if NET6_0_OR_GREATER
1514
/// <inheritdoc/>
1615
public override DataTypeCollection GetDataTypesInfo()
1716
{
@@ -22,11 +21,23 @@ public override DataTypeCollection GetDataTypesInfo()
2221

2322
var index = DataTypeFeatures.Indexing | DataTypeFeatures.KeyConstraint;
2423

25-
types.TimeOnly = DataTypeInfo.Range(SqlType.Time, common | index, ValueRange.TimeOnly, "time(6)");
24+
#if NET6_0_OR_GREATER
25+
types.DateTime = DataTypeInfo.Range(SqlType.DateTime, common | index,
26+
new ValueRange<DateTime>(new DateTime(1000, 1, 1), new DateTime(9999, 12, 31)),
27+
"datetime(6)");
28+
29+
types.DateOnly = DataTypeInfo.Range(SqlType.Date, common | index,
30+
new ValueRange<DateOnly>(new DateOnly(1000, 1, 1), new DateOnly(9999, 12, 31)),
31+
"date");
2632

33+
types.TimeOnly = DataTypeInfo.Range(SqlType.Time, common | index, ValueRange.TimeOnly, "time(6)");
34+
#else
35+
types.DateTime = DataTypeInfo.Range(SqlType.DateTime, common | index,
36+
new ValueRange<DateTime>(new DateTime(1000, 1, 1), new DateTime(9999, 12, 31)),
37+
"datetime(6)", "time(6)");
38+
#endif
2739
return types;
2840
}
29-
#endif
3041

3142
// Constructors
3243

Orm/Xtensive.Orm.MySql/Sql.Drivers.MySql/v5_6/Translator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public override void Translate(SqlCompilerContext context, SqlCast node, NodeSec
2121
_ = context.Output.AppendOpeningPunctuation("CAST(");
2222
break;
2323
case NodeSection.Exit:
24-
_ = context.Output.Append("AS ").Append(Translate(node.Type)).Append(")");
24+
_ = context.Output.Append("AS ").Append(Translate(node.Type)).AppendClosingPunctuation(")");
2525
break;
2626
default:
2727
throw new ArgumentOutOfRangeException(nameof(section));

0 commit comments

Comments
 (0)