Skip to content

Commit 2d03230

Browse files
committed
Merge 0.69.6 into 1.0.
Conflicts: docs/content/overview/version-history.md src/Directory.Build.props src/MySqlConnector/Core/TypeMapper.cs
2 parents f41fb8f + a9bfb2b commit 2d03230

File tree

4 files changed

+52
-11
lines changed

4 files changed

+52
-11
lines changed

docs/content/overview/version-history.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Version History
4141
* Add `net5.0` target framework.
4242
* Reduce memory allocations when hashing passwords (during login).
4343

44+
### 0.69.6
45+
46+
* Support `GEOMCOLLECTION` data type alias in MySQL Server 8.0: [#845](https://github.com/mysql-net/MySqlConnector/issues/845).
47+
4448
### 0.69.5
4549

4650
* Improve robustness of OK packet parsing: [#842](https://github.com/mysql-net/MySqlConnector/issues/842).

src/MySqlConnector/Core/TypeMapper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private TypeMapper()
8989
AddColumnTypeMetadata(new("MULTILINESTRING", typeBinary, MySqlDbType.Geometry, binary: true));
9090
AddColumnTypeMetadata(new("MULTIPOLYGON", typeBinary, MySqlDbType.Geometry, binary: true));
9191
AddColumnTypeMetadata(new("GEOMETRYCOLLECTION", typeBinary, MySqlDbType.Geometry, binary: true));
92+
AddColumnTypeMetadata(new("GEOMCOLLECTION", typeBinary, MySqlDbType.Geometry, binary: true));
9293

9394
// date/time
9495
var typeDate = AddDbTypeMapping(new(typeof(DateTime), new[] { DbType.Date }));

tests/SideBySide/DataTypes.cs

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,17 +969,24 @@ public void GetMySqlDateTime(string columnName)
969969
}
970970
}
971971

972-
[Fact]
973-
public void QueryGeometry()
972+
[Theory]
973+
[InlineData("Geometry", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63 })]
974+
[InlineData("Point", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63 })]
975+
[InlineData("LineString", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64 })]
976+
[InlineData("Polygon", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 3, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })]
977+
[InlineData("MultiPoint", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 4, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 0, 0, 0, 0, 0, 0, 8, 64 })]
978+
[InlineData("MultiLineString", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 5, 0, 0, 0, 2, 0, 0, 0, 1, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 52, 64, 0, 0, 0, 0, 0, 0, 52, 64, 1, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 64, 0, 0, 0, 0, 0, 0, 46, 64, 0, 0, 0, 0, 0, 0, 62, 64, 0, 0, 0, 0, 0, 0, 46, 64 })]
979+
[InlineData("MultiPolygon", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 6, 0, 0, 0, 2, 0, 0, 0, 1, 3, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 64, 0, 0, 0, 0, 0, 0, 20, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 20, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 20, 64, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, 20, 64, 0, 0, 0, 0, 0, 0, 20, 64 })]
980+
[InlineData("GeometryCollection", "GEOMETRY", new byte[] { 0, 0, 0, 0, 1, 7, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 64, 0, 0, 0, 0, 0, 0, 36, 64, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 64, 0, 0, 0, 0, 0, 0, 62, 64, 1, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 64, 0, 0, 0, 0, 0, 0, 46, 64, 0, 0, 0, 0, 0, 0, 52, 64, 0, 0, 0, 0, 0, 0, 52, 64 })]
981+
public void QueryGeometry(string columnName, string dataTypeName, byte[] expected)
974982
{
975983
var geometryData = new byte[][]
976984
{
977985
null,
978-
new byte[] { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63 },
979-
new byte[] { 0, 0, 0, 0, 1, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64 }
986+
expected,
980987
};
981988

982-
DoQuery("geometry", "Geometry", "GEOMETRY", geometryData.ToArray(),
989+
DoQuery("geometry", columnName, dataTypeName, geometryData.ToArray(),
983990
#if !BASELINE
984991
GetBytes
985992
#else
@@ -988,7 +995,7 @@ public void QueryGeometry()
988995
#endif
989996
);
990997

991-
DoQuery<GetGeometryWhenNullException>("geometry", "Geometry", "GEOMETRY", geometryData.Select(CreateGeometry).ToArray(),
998+
DoQuery<GetGeometryWhenNullException>("geometry", columnName, dataTypeName, geometryData.Select(CreateGeometry).ToArray(),
992999
reader => reader.GetMySqlGeometry(0),
9931000
matchesDefaultType: false,
9941001
#if BASELINE
@@ -1075,6 +1082,13 @@ private static object CreateGeometry(byte[] data)
10751082
[InlineData("Year", "datatypes_times", MySqlDbType.Year, 4, typeof(int), "N", 0, 0)]
10761083
#endif
10771084
[InlineData("Geometry", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1085+
[InlineData("Point", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1086+
[InlineData("LineString", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1087+
[InlineData("Polygon", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1088+
[InlineData("MultiPoint", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1089+
[InlineData("MultiLineString", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1090+
[InlineData("MultiPolygon", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
1091+
[InlineData("GeometryCollection", "datatypes_geometry", MySqlDbType.Geometry, int.MaxValue, typeof(byte[]), "LN", 0, 0)]
10781092
public void GetSchemaTable(string column, string table, MySqlDbType mySqlDbType, int columnSize, Type dataType, string flags, int precision, int scale) =>
10791093
DoGetSchemaTable(column, table, mySqlDbType, columnSize, dataType, flags, precision, scale);
10801094

@@ -1245,6 +1259,13 @@ public void GetSchemaTableAfterNextResult()
12451259
[InlineData("Time", "datatypes_times", MySqlDbType.Time, "TIME", 17, typeof(TimeSpan), "N", -1, 6)]
12461260
[InlineData("Year", "datatypes_times", MySqlDbType.Year, "YEAR", 4, typeof(int), "N", -1, 0)]
12471261
[InlineData("Geometry", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1262+
[InlineData("Point", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1263+
[InlineData("LineString", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1264+
[InlineData("Polygon", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1265+
[InlineData("MultiPoint", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1266+
[InlineData("MultiLineString", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1267+
[InlineData("MultiPolygon", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
1268+
[InlineData("GeometryCollection", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", int.MaxValue, typeof(byte[]), "LN", -1, 0)]
12481269
public void GetColumnSchema(string column, string table, MySqlDbType mySqlDbType, string dataTypeName, int columnSize, Type dataType, string flags, int precision, int scale)
12491270
{
12501271
if (table == "datatypes_json_core" && !AppConfig.SupportsJson)
@@ -1337,6 +1358,13 @@ public void GetColumnSchema(string column, string table, MySqlDbType mySqlDbType
13371358
#if !BASELINE
13381359
[InlineData("value", "datatypes_json_core", MySqlDbType.JSON, "JSON", typeof(string), 4, "[]")]
13391360
[InlineData("Geometry", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRY", typeof(byte[]), 2, null)]
1361+
[InlineData("Point", "datatypes_geometry", MySqlDbType.Geometry, "POINT", typeof(byte[]), 2, null)]
1362+
[InlineData("LineString", "datatypes_geometry", MySqlDbType.Geometry, "LINESTRING", typeof(byte[]), 2, null)]
1363+
[InlineData("Polygon", "datatypes_geometry", MySqlDbType.Geometry, "POLYGON", typeof(byte[]), 2, null)]
1364+
[InlineData("MultiPoint", "datatypes_geometry", MySqlDbType.Geometry, "MULTIPOINT", typeof(byte[]), 2, null)]
1365+
[InlineData("MultiLineString", "datatypes_geometry", MySqlDbType.Geometry, "MULTILINESTRING", typeof(byte[]), 2, null)]
1366+
[InlineData("MultiPolygon", "datatypes_geometry", MySqlDbType.Geometry, "MULTIPOLYGON", typeof(byte[]), 2, null)]
1367+
[InlineData("GeometryCollection", "datatypes_geometry", MySqlDbType.Geometry, "GEOMETRYCOLLECTION", typeof(byte[]), 2, null)]
13401368
#endif
13411369
public void StoredProcedureOutParameter(string column, string table, MySqlDbType mySqlDbType, string dataTypeName, Type dataType, int rowid, object expectedValue)
13421370
{

tests/SideBySide/DataTypesFixture.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,22 @@ insert into datatypes_guids (char38, char38bin, `text`, `blob`)
202202
drop table if exists datatypes_geometry;
203203
create table datatypes_geometry (
204204
rowid integer not null primary key auto_increment,
205-
`Geometry` geometry null
205+
`Geometry` geometry null,
206+
`Point` point null,
207+
`LineString` linestring null,
208+
`Polygon` polygon null,
209+
`MultiPoint` multipoint null,
210+
`MultiLineString` multilinestring null,
211+
`MultiPolygon` multipolygon null,
212+
`GeometryCollection` geometrycollection null
206213
);
207214
208-
insert into datatypes_geometry (`Geometry`)
215+
insert into datatypes_geometry (`Geometry`, `Point`, `LineString`, `Polygon`, `MultiPoint`, `MultiLineString`, `MultiPolygon`, `GeometryCollection`)
209216
values
210-
(null),
211-
(ST_GeomFromText('POINT(1 1)')),
212-
(ST_GeomFromText('LINESTRING(0 0,1 1,2 2)'));
217+
(null, null, null, null, null, null, null, null),
218+
(ST_GeomFromText('POINT(1 1)'), ST_PointFromText('POINT(1 1)'), ST_LineFromText('LINESTRING(0 0,1 1,2 2)'), ST_PolyFromText('POLYGON((0 0,1 0,1 1,0 1,0 0))'),
219+
ST_GeomFromText('MULTIPOINT(1 1, 2 2, 3 3)'), ST_GeomFromText('MULTILINESTRING((10 10, 20 20), (15 15, 30 15))'), ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7, 5 5)))'),
220+
ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(10 10), POINT(30 30), LINESTRING(15 15, 20 20))'));
213221
");
214222

215223
if (AppConfig.SupportsJson)

0 commit comments

Comments
 (0)