Mssql: support varbinary(max) #1484

Closed
opened 2019-11-27 15:26:17 +00:00 by sapk · 5 comments

Similar to #192

MSSQL allow to use the term MAX to define value over 8000 but only allow number under 8000 to be set for VARBINARY(size)

docs: https://docs.microsoft.com/en-us/sql/t-sql/data-types/binary-and-varbinary-transact-sql?redirectedfrom=MSDN&view=sql-server-ver15

Looking very quickly at the code I think a good/easy solution would be to consider VARBINARY without size as VARBINARY(MAX)

A little like https://gitea.com/xorm/xorm/src/branch/master/dialect_mssql.go#L247 where text is converted to VARCHAR(MAX)

I could provide a PR. I just wanted to make sure that it ok to go with that solution before.

Similar to #192 MSSQL allow to use the term `MAX` to define value over 8000 but only allow number under 8000 to be set for VARBINARY(size) docs: https://docs.microsoft.com/en-us/sql/t-sql/data-types/binary-and-varbinary-transact-sql?redirectedfrom=MSDN&view=sql-server-ver15 Looking very quickly at the code I think a good/easy solution would be to consider VARBINARY without size as VARBINARY(MAX) A little like https://gitea.com/xorm/xorm/src/branch/master/dialect_mssql.go#L247 where text is converted to VARCHAR(MAX) I could provide a PR. I just wanted to make sure that it ok to go with that solution before.
Author

For details, currently setting VARBINARY would result in VARBINARY(1) on MSSQL

For details, currently setting VARBINARY would result in VARBINARY(1) on MSSQL
Owner

Please send a PR.

Please send a PR.
lunny added the
kind
enhancement
label 2019-11-28 01:57:56 +00:00
Author

On a more global way, what do you think of setting core.Column.Length to -1 in case of MAX and replace -1 by MAX in xorm https://gitea.com/xorm/xorm/src/branch/master/dialect_mssql.go#L247

On a more global way, what do you think of setting core.Column.Length to -1 in case of MAX and replace -1 by MAX in xorm https://gitea.com/xorm/xorm/src/branch/master/dialect_mssql.go#L247
Owner

@sapk I think it's OK since -1 is undefined.

@sapk I think it's OK since -1 is undefined.
lunny added this to the 1.3.0 milestone 2020-01-20 05:57:38 +00:00
lunny modified the milestone from 1.3.0 to 1.2.1 2021-08-05 03:14:23 +00:00
Owner

This has been resolved.

This has been resolved.
lunny closed this issue 2021-08-05 03:14:30 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1484
No description provided.