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

Unable to save/load large geometries using MsSql dialect #114

Closed
peetw opened this issue Dec 7, 2019 · 4 comments · Fixed by #113
Closed

Unable to save/load large geometries using MsSql dialect #114

peetw opened this issue Dec 7, 2019 · 4 comments · Fixed by #113

Comments

@peetw
Copy link
Collaborator

peetw commented Dec 7, 2019

Anyone else having issues saving large polygon geometries?

Originally posted by @mikemcdougall in #84 (comment)

@peetw
Copy link
Collaborator Author

peetw commented Dec 7, 2019

@mikemcdougall what issues are you having exactly? Do you have a test case you can share?

Originally posted by @peetw in #84 (comment)

@peetw
Copy link
Collaborator Author

peetw commented Dec 7, 2019

@peetw
I found the issue I was having with large geometries.
The problem is in MsSqlGeometryType.cs in the Set(DbCommand cmd, object value, int index, ISessionImplementor session) function.
I changed to
parameter.SqlDbType = SqlDbType.VarBinary;
parameter.Size = ((byte[]) value).Length;

the SqlDBType.Binary has a max of 8000 bytes. So the value being passed in the parameter was being cut off. Sql server was sending back invalid geometry error. Seems to be working with the above changes.

Would you like me to create PR?

Originally posted by @mikemcdougall in #84 (comment)

@peetw
Copy link
Collaborator Author

peetw commented Dec 7, 2019

@mikemcdougall Great, nice work! I'll try and take a look at the PR ASAP.

Originally posted by @peetw in #84 (comment)

@peetw
Copy link
Collaborator Author

peetw commented Dec 9, 2019

@mikemcdougall Your fix has now been merged in and is included in a new v5.3.0 release, which is now available on NuGet 🎉

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 a pull request may close this issue.

1 participant