Skip to content

Conversation

@Dan-Cao
Copy link

@Dan-Cao Dan-Cao commented Apr 22, 2020

https://hibernate.atlassian.net/browse/HHH-13969

Updates the handling of the VARBINARY type so when a using column size larger than what Sybase accepts, the image type is used instead.

This change mirrors the behaviour of other Transact-SQL dialects such as SQLServerDialect.

Document on varbinary - size only goes up to 16K:
https://wiki.ispirer.com/sqlways/sybase/data-types/varbinary

Document on the image type:
https://wiki.ispirer.com/sqlways/sybase/data-types/image

super();

registerColumnType( Types.VARBINARY, "image" );
registerColumnType( Types.VARBINARY, 8000, "varbinary($l)" );
Copy link
Contributor

Choose a reason for hiding this comment

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

8000 is the max length for SQLServer. Should we use 32767 instead here?

Copy link
Member

Choose a reason for hiding this comment

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

That's what I decided it should be for Sybase Anywhere. (But apparently for ASE it depends on the version.)

Copy link
Member

Choose a reason for hiding this comment

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

Actually it also depends on the page size which can be as small as 2k.

Copy link
Author

Choose a reason for hiding this comment

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

Yep, it's based on the database page size which is configurable.

On reflection, we should look up and use the actual page size instead of a fixed value of 8000.

I couldn't find a quick way to do this after looking through the other dialects.

Can you give any pointers to how this would be done? I would be happy to give that a go.

@NathanQingyangXu
Copy link
Contributor

NathanQingyangXu commented Sep 7, 2020 via email

Base automatically changed from master to main March 19, 2021 16:00
@gavinking
Copy link
Member

This is now handled differently, and the max is set to 16_384 in SybaseASEDialect.

@gavinking gavinking closed this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants