Skip to content

Commit

Permalink
Fix length -1 on varchar(max) parameters (#4632)
Browse files Browse the repository at this point in the history
* Handle Length = -1

* Update Source/LinqToDB/SchemaProvider/SchemaProviderBase.cs

Co-authored-by: MaceWindu <[email protected]>

---------

Co-authored-by: Anders Lindström <[email protected]>
Co-authored-by: MaceWindu <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2024
1 parent ab9e8da commit e5ccf92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/LinqToDB/SchemaProvider/SchemaProviderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ protected virtual List<DataTypeInfo> GetDataTypes(DataConnection dataConnection)
{
case "size" :
case "length" : paramValues[i] = length; break;
case "max length" : paramValues[i] = length == int.MaxValue ? "max" : length?.ToString(NumberFormatInfo.InvariantInfo); break;
// -1: https://learn.microsoft.com/en-us/sql/relational-databases/system-information-schema-views/parameters-transact-sql
case "max length" : paramValues[i] = length is int.MaxValue or -1 ? "max" : length?.ToString(NumberFormatInfo.InvariantInfo); break;
case "precision" : paramValues[i] = precision; break;
case "scale" : paramValues[i] = scale.HasValue || paramNames.Length == 2 ? scale : precision; break;
}
Expand Down

0 comments on commit e5ccf92

Please sign in to comment.