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 1 commit
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.

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

#region Overridden informational metadata

public override bool SupportsEmptyInList
{
get { return false; }
Copy link
Member

Choose a reason for hiding this comment

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

Can these one-line properties be written with expression syntax? I know that it'll make an inconsistency, but I'm ok with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed and done.

}

public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor
{
get { return false; }
}

public override bool SupportsLobValueChangePropogation
{
get { return false; }
}

public override bool SupportsExistsInSelect
{
get { return false; }
}

public override bool DoesReadCommittedCauseWritersToBlockReaders
{
get { return 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
9 changes: 9 additions & 0 deletions src/NHibernate/Dialect/Ingres9Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,14 @@ public override SqlString GetLimitString(SqlString queryString, SqlString offset

return pagingBuilder.ToSqlString();
}

#region Overridden informational metadata

public override bool DoesRepeatableReadCauseReadersToBlockWriters
{
get { return true; }
}

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

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

#region Overridden informational metadata

public override bool SupportsEmptyInList
{
get { return false; }
}

public override bool SupportsSubselectAsInPredicateLHS
{
get { return false; }
}

public override bool SupportsExpectedLobUsagePattern
{
get { return false; }
}

public override bool DoesReadCommittedCauseWritersToBlockReaders
{
get { return true; }
}

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

#region Overridden informational metadata

public override bool SupportsEmptyInList
{
get { return false; }
}

public override bool AreStringComparisonsCaseInsensitive
{
get { return true; }
}

public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor
{
get { return false; }
}

public override bool SupportsLobValueChangePropogation
{
// note: at least my local SQL Server 2005 Express shows this not working...
get { return false; }
}

public override bool DoesReadCommittedCauseWritersToBlockReaders
{
get { return true; }
}

public override bool DoesRepeatableReadCauseReadersToBlockWriters
{
get { return true; }
}

#endregion

public override bool IsKnownToken(string currentToken, string nextToken)
{
return currentToken == "n" && nextToken == "'"; // unicode character
Expand Down
22 changes: 22 additions & 0 deletions src/NHibernate/Dialect/MsSql2005Dialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,27 @@ 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
{
get { return false; }
}

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

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

#region Overridden informational metadata

public override bool SupportsEmptyInList
{
get { return false; }
}

public override bool AreStringComparisonsCaseInsensitive
{
get { return true; }
}

public override bool SupportsLobValueChangePropogation
{
// note: at least my local MySQL 5.1 install shows this not working...
get { return false; }
}

public override bool SupportsSubqueryOnMutatingTable
{
get { return false; }
}

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

#region Overridden informational metadata

public override bool SupportsEmptyInList
{
get { return 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
{
get { return false; }
}

public override bool SupportsLobValueChangePropogation
{
get { return false; }
}

public override bool SupportsUnboundedLobLocatorMaterialization
{
get { return false; }
}

#endregion
}
}