Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-13969 Fix handling of large varbinary in SybaseASE15Dialect #3367

Open
wants to merge 1 commit into
base: master
from

Conversation

@Noupoi
Copy link

Noupoi 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

@@ -30,6 +30,8 @@
public SybaseASE15Dialect() {
super();

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

This comment has been minimized.

@NathanQingyangXu

NathanQingyangXu Sep 5, 2020 Contributor

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

This comment has been minimized.

@gavinking

gavinking Sep 5, 2020 Member

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

This comment has been minimized.

@gavinking

gavinking Sep 5, 2020 Member

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

This comment has been minimized.

@Noupoi

Noupoi Sep 7, 2020 Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.