@@ -35,10 +35,16 @@ pub enum DataType {
35
35
Uuid ,
36
36
/// Large character object e.g. CLOB(1000)
37
37
Clob ( u64 ) ,
38
- /// Fixed-length binary type e.g. BINARY(10)
39
- Binary ( u64 ) ,
40
- /// Variable-length binary type e.g. VARBINARY(10)
41
- Varbinary ( u64 ) ,
38
+ /// Fixed-length binary type with optional length e.g. [standard], [MS SQL Server]
39
+ ///
40
+ /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#binary-string-type
41
+ /// [MS SQL Server]: https://learn.microsoft.com/pt-br/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver16
42
+ Binary ( Option < u64 > ) ,
43
+ /// Variable-length binary with optional length type e.g. [standard], [MS SQL Server]
44
+ ///
45
+ /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#binary-string-type
46
+ /// [MS SQL Server]: https://learn.microsoft.com/pt-br/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver16
47
+ Varbinary ( Option < u64 > ) ,
42
48
/// Large binary object e.g. BLOB(1000)
43
49
Blob ( u64 ) ,
44
50
/// Decimal type with optional precision and scale e.g. DECIMAL(10,2)
@@ -126,8 +132,10 @@ impl fmt::Display for DataType {
126
132
}
127
133
DataType :: Uuid => write ! ( f, "UUID" ) ,
128
134
DataType :: Clob ( size) => write ! ( f, "CLOB({})" , size) ,
129
- DataType :: Binary ( size) => write ! ( f, "BINARY({})" , size) ,
130
- DataType :: Varbinary ( size) => write ! ( f, "VARBINARY({})" , size) ,
135
+ DataType :: Binary ( size) => format_type_with_optional_length ( f, "BINARY" , size, false ) ,
136
+ DataType :: Varbinary ( size) => {
137
+ format_type_with_optional_length ( f, "VARBINARY" , size, false )
138
+ }
131
139
DataType :: Blob ( size) => write ! ( f, "BLOB({})" , size) ,
132
140
DataType :: Decimal ( precision, scale) => {
133
141
if let Some ( scale) = scale {
0 commit comments