Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Core/Models/SqlTypeConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static class SqlTypeConstants
{ "varbinary", true }, // SqlDbType.VarBinary
{ "varchar", true }, // SqlDbType.VarChar
{ "sql_variant", false }, // SqlDbType.Variant (unsupported)
{ "xml", false }, // SqlDbType.Xml (unsupported)
{ "xml", true }, // SqlDbType.Xml
{ "date", true }, // SqlDbType.Date
{ "time", true }, // SqlDbType.Time
{ "datetime2", true }, // SqlDbType.DateTime2
Expand Down
3 changes: 2 additions & 1 deletion src/Core/Services/TypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public static class TypeHelper
[SqlDbType.TinyInt] = typeof(byte),
[SqlDbType.UniqueIdentifier] = typeof(Guid),
[SqlDbType.VarBinary] = typeof(byte[]),
[SqlDbType.VarChar] = typeof(string)
[SqlDbType.VarChar] = typeof(string),
[SqlDbType.Xml] = typeof(string)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an XML column to the type_table in the test database schema (DatabaseSchema-MsSql.sql) to enable integration testing of XML data type operations. While the unit tests in CLRtoJsonValueTypeUnitTests will validate the type mapping, integration tests would verify actual CRUD operations with XML data.

For example, add to the type_table schema:

xml_types xml

And include test data:

INSERT INTO type_table(..., xml_types) VALUES (..., '<doc><type>report</type></doc>')

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 3ce04b9. The type_table now includes an xml_types xml column with test data:

  • <doc><type>report</type></doc>
  • <author>admin</author>
  • <metadata><key>value</key></metadata>
  • <config><setting enabled="true"/></config>
  • NULL (for row 5)

};

private static Dictionary<SqlDbType, DbType> _sqlDbDateTimeTypeToDbType = new()
Expand Down
15 changes: 8 additions & 7 deletions src/Service.Tests/DatabaseSchema-MsSql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ CREATE TABLE type_table(
smalldatetime_types smalldatetime,
time_types time,
bytearray_types varbinary(max),
uuid_types uniqueidentifier DEFAULT newid()
uuid_types uniqueidentifier DEFAULT newid(),
xml_types xml
);

CREATE TABLE trees (
Expand Down Expand Up @@ -590,21 +591,21 @@ string_types, nvarchar_string_types,
single_types, float_types, decimal_types,
boolean_types,
date_types, datetime_types, datetime2_types, datetimeoffset_types, smalldatetime_types, time_types,
bytearray_types)
bytearray_types, xml_types)
VALUES
(1, 1, 1, 1, 1, '', '', 0.33, 0.33, 0.333333, 1,
'1999-01-08', '1999-01-08 10:23:54', '1999-01-08 10:23:54.9999999', '1999-01-08 10:23:54.9999999-14:00', '1999-01-08 10:23:54', '10:23:54.9999999',
0xABCDEF0123),
0xABCDEF0123, '<doc><type>report</type></doc>'),
(2, 0, -1, -1, -1, 'lksa;jdflasdf;alsdflksdfkldj', 'lksa;jdflasdf;alsdflksdfkldj', -9.2, -9.2, -9.292929, 0,
'1999-01-08', '1999-01-08 10:23:00', '1999-01-08 10:23:00.9999999', '1999-01-08 10:23:00.9999999+13:00', '1999-01-08 10:23:00', '10:23:00.9999999',
0x98AB7511AABB1234),
0x98AB7511AABB1234, '<author>admin</author>'),
(3, 0, -32768, -2147483648, -9223372036854775808, 'null', 'null', -3.4E38, -1.7E308, 2.929292E-19, 1,
'0001-01-01', '1753-01-01 00:00:00.000', '0001-01-01 00:00:00.0000000', '0001-01-01 00:00:00.0000000+0:00', '1900-01-01 00:00:00', '00:00:00.0000000',
0x00000000),
0x00000000, '<metadata><key>value</key></metadata>'),
(4, 255, 32767, 2147483647, 9223372036854775807, 'null', 'null', 3.4E38, 1.7E308, 2.929292E-14, 1,
'9999-12-31', '9999-12-31 23:59:59', '9999-12-31 23:59:59.9999999', '9999-12-31 23:59:59.9999999+14:00', '2079-06-06', '23:59:59.9999999',
0xFFFFFFFF),
(5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
0xFFFFFFFF, '<config><setting enabled="true"/></config>'),
(5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO type_table(id, uuid_types) values(10, 'D1D021A8-47B4-4AE4-B718-98E89C41A161');
SET IDENTITY_INSERT type_table OFF

Expand Down
Loading