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)); } }
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));
}
}