You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alexey Lesnyh created an issue — 20th January 2015, 13:25:42:
I develop NHibernate Driver for DBMS Linter SQL and found a problem in file Nhibernate\Mapping\Table.cs. The problem is in the following code:
foreach (UniqueKey uk in UniqueKeyIterator)
{
buf.Append(',').Append(uk.SqlConstraintString(dialect));
}
This code produces unnecessary comma in CREATE TABLE statement if dialect doesn't support not null unique constraints. For example, in test Nhibernate.Test.Component.Basic.ComponentWithUniqueConstraintTests.CanBePersistedWithUniqueValues we have the following query:
create table Employee (Id BIGINT not null, Name VARCHAR(255) null, Dob DATE null, HireDate DATE null, primary key (Id),);
I suggest that we check property dialect.SupportsNotNullUnique before running foreach loop. Something like this:
if (dialect.SupportsNotNullUnique)
{
foreach (UniqueKey uk in UniqueKeyIterator)
{
buf.Append(',').Append(uk.SqlConstraintString(dialect));
}
}
Ricardo Peres added a comment — 20th January 2015, 13:36:30:
Can you submit a pull request with your solution and a unit test? It makes it easier to test and integrate.
Alexey Lesnyh added a comment — 20th January 2015, 13:37:09:
Uh oh!
There was an error while loading. Please reload this page.
Alexey Lesnyh created an issue — 20th January 2015, 13:25:42:
Ricardo Peres added a comment — 20th January 2015, 13:36:30:
Alexey Lesnyh added a comment — 20th January 2015, 13:37:09:
The text was updated successfully, but these errors were encountered: