Skip to content

NH-3975 - Synchronize some features dialect support properties #591

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

Merged
merged 2 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/NHibernate.Test/Hql/Ast/BulkManipulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,8 @@ public void UpdateOnManyToOne()
ITransaction t = s.BeginTransaction();

s.CreateQuery("update Animal a set a.mother = null where a.id = 2").ExecuteUpdate();
if (! (Dialect is MySQLDialect))
if (Dialect.SupportsSubqueryOnMutatingTable)
{
// MySQL does not support (even un-correlated) subqueries against the update-mutating table
s.CreateQuery("update Animal a set a.mother = (from Animal where id = 1) where a.id = 2").ExecuteUpdate();
}

Expand Down Expand Up @@ -624,9 +623,8 @@ public void UpdateOnAnimal()
.ExecuteUpdate();
Assert.That(count, Is.EqualTo(6), "incorrect count on 'complex' update assignment");

if (! (Dialect is MySQLDialect))
if (Dialect.SupportsSubqueryOnMutatingTable)
{
// MySQL does not support (even un-correlated) subqueries against the update-mutating table
s.CreateQuery("update Animal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate();
}

Expand Down Expand Up @@ -682,9 +680,8 @@ public void UpdateOnMammal()
count = s.CreateQuery("update Mammal set bodyWeight = 25").ExecuteUpdate();
Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy");

if (! (Dialect is MySQLDialect))
if (Dialect.SupportsSubqueryOnMutatingTable)
{
// MySQL does not support (even un-correlated) subqueries against the update-mutating table
count = s.CreateQuery("update Mammal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate();
Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy");
}
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test/SqlTest/Custom/MySQL/MySQLTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected override IList Mappings

protected override bool AppliesTo(Dialect.Dialect dialect)
{
return dialect is MySQL5Dialect || dialect is MySQLDialect;
return dialect is MySQLDialect;
Copy link
Member Author

Choose a reason for hiding this comment

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

MySQL5Dialect inherits MySQLDialect, so I have just simplified this.

}
}
}
14 changes: 14 additions & 0 deletions src/NHibernate/Dialect/DB2Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,19 @@ public override string ForUpdateString
{
get { return " for read only with rs"; }
}

#region Overridden informational metadata

public override bool SupportsEmptyInList => false;

public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor => false;

public override bool SupportsLobValueChangePropogation => false;

public override bool SupportsExistsInSelect => false;

public override bool DoesReadCommittedCauseWritersToBlockReaders => true;

#endregion
}
}
8 changes: 4 additions & 4 deletions src/NHibernate/Dialect/Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ public virtual bool SupportsParametersInInsertSelect

/// <summary>
/// Does this dialect require that references to result variables
/// (i.e, select expresssion aliases) in an ORDER BY clause be
/// (i.e, select expression aliases) in an ORDER BY clause be
/// replaced by column positions (1-origin) as defined by the select clause?
/// </summary>
/// <returns>
Expand Down Expand Up @@ -2050,8 +2050,6 @@ public virtual bool SupportsBindAsCallableArgument
get { return true; }
}

#endregion

/// <summary>
/// Does this dialect support subselects?
/// </summary>
Expand All @@ -2060,6 +2058,8 @@ public virtual bool SupportsSubSelects
get { return true; }
}

#endregion

/// <summary>
/// Retrieve a set of default Hibernate properties for this database.
/// </summary>
Expand Down Expand Up @@ -2136,7 +2136,7 @@ public virtual string CreateTemporaryTablePostfix
/// <summary>
/// Should the value returned by <see cref="CurrentTimestampSelectString"/>
/// be treated as callable. Typically this indicates that JDBC escape
/// sytnax is being used...
/// syntax is being used...
/// </summary>
public virtual bool IsCurrentTimestampSelectStringCallable
{
Expand Down
6 changes: 6 additions & 0 deletions src/NHibernate/Dialect/Ingres9Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@ public override SqlString GetLimitString(SqlString queryString, SqlString offset

return pagingBuilder.ToSqlString();
}

#region Overridden informational metadata

public override bool DoesRepeatableReadCauseReadersToBlockWriters => true;

#endregion
}
}
12 changes: 12 additions & 0 deletions src/NHibernate/Dialect/IngresDialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,17 @@ public IngresDialect()

DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.IngresDriver";
}

#region Overridden informational metadata

public override bool SupportsEmptyInList => false;

public override bool SupportsSubselectAsInPredicateLHS => false;

public override bool SupportsExpectedLobUsagePattern => false;

public override bool DoesReadCommittedCauseWritersToBlockReaders => true;

#endregion
}
}
17 changes: 17 additions & 0 deletions src/NHibernate/Dialect/MsSql2000Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,23 @@ public override bool SupportsSqlBatches
get { return true; }
}

#region Overridden informational metadata

public override bool SupportsEmptyInList => false;

public override bool AreStringComparisonsCaseInsensitive => true;

public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor => false;

// note: at least SQL Server 2005 Express shows this not working...
public override bool SupportsLobValueChangePropogation => false;

public override bool DoesReadCommittedCauseWritersToBlockReaders => true;

public override bool DoesRepeatableReadCauseReadersToBlockWriters => true;

#endregion

public override bool IsKnownToken(string currentToken, string nextToken)
{
return currentToken == "n" && nextToken == "'"; // unicode character
Expand Down
16 changes: 16 additions & 0 deletions src/NHibernate/Dialect/MsSql2005Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,21 @@ public override string AppendLockHint(LockMode lockMode, string tableName)

return tableName;
}

#region Overridden informational metadata

/// <summary>
/// We assume that applications using this dialect are using
/// SQL Server 2005 snapshot isolation modes.
/// </summary>
public override bool DoesReadCommittedCauseWritersToBlockReaders => false;

/// <summary>
/// We assume that applications using this dialect are using
/// SQL Server 2005 snapshot isolation modes.
/// </summary>
public override bool DoesRepeatableReadCauseReadersToBlockWriters => false;

#endregion
}
}
13 changes: 13 additions & 0 deletions src/NHibernate/Dialect/MySQLDialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,5 +386,18 @@ public override long TimestampResolutionInTicks
return TimeSpan.TicksPerSecond;
}
}

#region Overridden informational metadata

public override bool SupportsEmptyInList => false;

public override bool AreStringComparisonsCaseInsensitive => true;

// note: at least MySQL 5.1 shows this not working...
public override bool SupportsLobValueChangePropogation => false;

public override bool SupportsSubqueryOnMutatingTable => false;

#endregion
}
}
17 changes: 17 additions & 0 deletions src/NHibernate/Dialect/PostgreSQLDialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,22 @@ public override string CurrentTimestampSelectString
{
get { return "SELECT CURRENT_TIMESTAMP"; }
}

#region Overridden informational metadata

public override bool SupportsEmptyInList => false;

/// <summary>
/// Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
/// {@link java.sql.PreparedStatement#setBinaryStream}).
/// </summary>
/// <returns> True if BLOBs and CLOBs should be bound using stream operations. </returns>
public override bool UseInputStreamToInsertBlob => false;

public override bool SupportsLobValueChangePropogation => false;

public override bool SupportsUnboundedLobLocatorMaterialization => false;

#endregion
}
}