Skip to content

Commit 6f6210e

Browse files
committed
Test column schema for VECTOR.
Signed-off-by: Bradley Grainger <[email protected]>
1 parent 6af96e4 commit 6f6210e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/MySqlConnector/MySqlDbColumn.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal MySqlDbColumn(int ordinal, ColumnDefinitionPayload column, bool allowZe
1515
var type = columnTypeMetadata.DbTypeMapping.ClrType;
1616
var columnSize = type == typeof(string) || type == typeof(Guid) ?
1717
column.ColumnLength / ProtocolUtility.GetBytesPerCharacter(column.CharacterSet) :
18+
column.ColumnType == ColumnType.Vector ? column.ColumnLength / 4 :
1819
column.ColumnLength;
1920

2021
AllowDBNull = (column.ColumnFlags & ColumnFlags.NotNull) == 0;

tests/IntegrationTests/DataTypes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,9 @@ private static object CreateGeometry(byte[] data)
11431143
[InlineData("Int64", "datatypes_integers", MySqlDbType.Int64, 20, typeof(long), "N", 0, 0)]
11441144
[InlineData("UInt64", "datatypes_integers", MySqlDbType.UInt64, 20, typeof(ulong), "N", 0, 0)]
11451145
[InlineData("value", "datatypes_json_core", MySqlDbType.JSON, int.MaxValue, typeof(string), "LN", 0, 0)]
1146+
#if !MYSQL_DATA
1147+
[InlineData("value", "datatypes_vector", MySqlDbType.Vector, 3, typeof(float[]), "N", 0, 31)]
1148+
#endif
11461149
[InlineData("Single", "datatypes_reals", MySqlDbType.Float, 12, typeof(float), "N", 0, 31)]
11471150
[InlineData("Double", "datatypes_reals", MySqlDbType.Double, 22, typeof(double), "N", 0, 31)]
11481151
[InlineData("SmallDecimal", "datatypes_reals", MySqlDbType.NewDecimal, 7, typeof(decimal), "N", 5, 2)]
@@ -1195,6 +1198,8 @@ private void DoGetSchemaTable(string column, string table, MySqlDbType mySqlDbTy
11951198
{
11961199
if (table == "datatypes_json_core" && !AppConfig.SupportsJson)
11971200
return;
1201+
if (table == "datatypes_vector" && !AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Vector))
1202+
return;
11981203

11991204
var isAutoIncrement = flags.IndexOf('A') != -1;
12001205
var isKey = flags.IndexOf('K') != -1;

0 commit comments

Comments
 (0)