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

DB2 dialect enhancements #2058

Merged
merged 9 commits into from
Mar 24, 2019
Merged

DB2 dialect enhancements #2058

merged 9 commits into from
Mar 24, 2019

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented Mar 15, 2019

  • Add schema update capability
  • Fix generating parameter names
  • Register bit operations
  • Fix substring function registration
  • Fix current_timestamp function registration
  • Fix round function registration
  • Fix timestamp resolution in ticks
  • Fix DbType.Guid type registration
  • Fix DbType.Byte handling

Replaces #474

@hazzik hazzik added this to the 5.3 milestone Mar 15, 2019
@hazzik hazzik changed the title DB2 enhancements DB2 dialect enhancements Mar 15, 2019
cmd.Parameters[index].Value = Convert.ToByte(value);
}
var dp = cmd.Parameters[index];
dp.Value = dp.DbType == DbType.Int16 ? Convert.ToInt16(value) : Convert.ToByte(value);
Copy link
Member Author

@hazzik hazzik Mar 18, 2019

Choose a reason for hiding this comment

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

DB2 does not support byte native (as many other RDBMS) and has a problem handling it. If the value is of type byte the provider remaps the parameter as DbType.Binary. Then it throws InvalidCastException trying to cast the value to byte[].

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

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

LGTM.
(Unfortunately for some reasons my local db2 installation is no more working, and reinstalling it has not worked either. So I have not checked the tests myself.)

@hazzik hazzik merged commit 1aeed38 into nhibernate:master Mar 24, 2019
@hazzik
Copy link
Member Author

hazzik commented Mar 24, 2019

my local db2 installation is no more working

I'm using this docker image (gladly they have made it at least working from a first attempt): https://hub.docker.com/_/db2-developer-c-edition (need to "purchase" it). Also, it seems the image accepts only "testdb" as a database name.

And this DB2 driver: IBM.Data.DB2.Core. The packaging is strange and in contradiction to how other packages are working you need to install different versions for Linux or MacOS

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

Successfully merging this pull request may close these issues.

None yet

3 participants