Skip to content

Commit 8e71d6a

Browse files
NH-3975 - Synchronize some features dialect support properties (#591)
* NH-3975 - Synchronize some features dialect support properties (Informational metadata) * NH-3975 - syntax modernization
1 parent 8975071 commit 8e71d6a

File tree

10 files changed

+103
-11
lines changed

10 files changed

+103
-11
lines changed

src/NHibernate.Test/Hql/Ast/BulkManipulation.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,8 @@ public void UpdateOnManyToOne()
513513
ITransaction t = s.BeginTransaction();
514514

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

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

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

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

685-
if (! (Dialect is MySQLDialect))
683+
if (Dialect.SupportsSubqueryOnMutatingTable)
686684
{
687-
// MySQL does not support (even un-correlated) subqueries against the update-mutating table
688685
count = s.CreateQuery("update Mammal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate();
689686
Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy");
690687
}

src/NHibernate.Test/SqlTest/Custom/MySQL/MySQLTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected override IList Mappings
1414

1515
protected override bool AppliesTo(Dialect.Dialect dialect)
1616
{
17-
return dialect is MySQL5Dialect || dialect is MySQLDialect;
17+
return dialect is MySQLDialect;
1818
}
1919
}
2020
}

src/NHibernate/Dialect/DB2Dialect.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,5 +270,19 @@ public override string ForUpdateString
270270
{
271271
get { return " for read only with rs"; }
272272
}
273+
274+
#region Overridden informational metadata
275+
276+
public override bool SupportsEmptyInList => false;
277+
278+
public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor => false;
279+
280+
public override bool SupportsLobValueChangePropogation => false;
281+
282+
public override bool SupportsExistsInSelect => false;
283+
284+
public override bool DoesReadCommittedCauseWritersToBlockReaders => true;
285+
286+
#endregion
273287
}
274288
}

src/NHibernate/Dialect/Dialect.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ public virtual bool SupportsParametersInInsertSelect
18791879

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

2053-
#endregion
2054-
20552053
/// <summary>
20562054
/// Does this dialect support subselects?
20572055
/// </summary>
@@ -2060,6 +2058,8 @@ public virtual bool SupportsSubSelects
20602058
get { return true; }
20612059
}
20622060

2061+
#endregion
2062+
20632063
/// <summary>
20642064
/// Retrieve a set of default Hibernate properties for this database.
20652065
/// </summary>
@@ -2136,7 +2136,7 @@ public virtual string CreateTemporaryTablePostfix
21362136
/// <summary>
21372137
/// Should the value returned by <see cref="CurrentTimestampSelectString"/>
21382138
/// be treated as callable. Typically this indicates that JDBC escape
2139-
/// sytnax is being used...
2139+
/// syntax is being used...
21402140
/// </summary>
21412141
public virtual bool IsCurrentTimestampSelectStringCallable
21422142
{

src/NHibernate/Dialect/Ingres9Dialect.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,11 @@ public override SqlString GetLimitString(SqlString queryString, SqlString offset
6464

6565
return pagingBuilder.ToSqlString();
6666
}
67+
68+
#region Overridden informational metadata
69+
70+
public override bool DoesRepeatableReadCauseReadersToBlockWriters => true;
71+
72+
#endregion
6773
}
6874
}

src/NHibernate/Dialect/IngresDialect.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,17 @@ public IngresDialect()
5151

5252
DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.IngresDriver";
5353
}
54+
55+
#region Overridden informational metadata
56+
57+
public override bool SupportsEmptyInList => false;
58+
59+
public override bool SupportsSubselectAsInPredicateLHS => false;
60+
61+
public override bool SupportsExpectedLobUsagePattern => false;
62+
63+
public override bool DoesReadCommittedCauseWritersToBlockReaders => true;
64+
65+
#endregion
5466
}
5567
}

src/NHibernate/Dialect/MsSql2000Dialect.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,23 @@ public override bool SupportsSqlBatches
498498
get { return true; }
499499
}
500500

501+
#region Overridden informational metadata
502+
503+
public override bool SupportsEmptyInList => false;
504+
505+
public override bool AreStringComparisonsCaseInsensitive => true;
506+
507+
public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor => false;
508+
509+
// note: at least SQL Server 2005 Express shows this not working...
510+
public override bool SupportsLobValueChangePropogation => false;
511+
512+
public override bool DoesReadCommittedCauseWritersToBlockReaders => true;
513+
514+
public override bool DoesRepeatableReadCauseReadersToBlockWriters => true;
515+
516+
#endregion
517+
501518
public override bool IsKnownToken(string currentToken, string nextToken)
502519
{
503520
return currentToken == "n" && nextToken == "'"; // unicode character

src/NHibernate/Dialect/MsSql2005Dialect.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,21 @@ public override string AppendLockHint(LockMode lockMode, string tableName)
102102

103103
return tableName;
104104
}
105+
106+
#region Overridden informational metadata
107+
108+
/// <summary>
109+
/// We assume that applications using this dialect are using
110+
/// SQL Server 2005 snapshot isolation modes.
111+
/// </summary>
112+
public override bool DoesReadCommittedCauseWritersToBlockReaders => false;
113+
114+
/// <summary>
115+
/// We assume that applications using this dialect are using
116+
/// SQL Server 2005 snapshot isolation modes.
117+
/// </summary>
118+
public override bool DoesRepeatableReadCauseReadersToBlockWriters => false;
119+
120+
#endregion
105121
}
106122
}

src/NHibernate/Dialect/MySQLDialect.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,5 +386,18 @@ public override long TimestampResolutionInTicks
386386
return TimeSpan.TicksPerSecond;
387387
}
388388
}
389+
390+
#region Overridden informational metadata
391+
392+
public override bool SupportsEmptyInList => false;
393+
394+
public override bool AreStringComparisonsCaseInsensitive => true;
395+
396+
// note: at least MySQL 5.1 shows this not working...
397+
public override bool SupportsLobValueChangePropogation => false;
398+
399+
public override bool SupportsSubqueryOnMutatingTable => false;
400+
401+
#endregion
389402
}
390403
}

src/NHibernate/Dialect/PostgreSQLDialect.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,5 +249,22 @@ public override string CurrentTimestampSelectString
249249
{
250250
get { return "SELECT CURRENT_TIMESTAMP"; }
251251
}
252+
253+
#region Overridden informational metadata
254+
255+
public override bool SupportsEmptyInList => false;
256+
257+
/// <summary>
258+
/// Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
259+
/// {@link java.sql.PreparedStatement#setBinaryStream}).
260+
/// </summary>
261+
/// <returns> True if BLOBs and CLOBs should be bound using stream operations. </returns>
262+
public override bool UseInputStreamToInsertBlob => false;
263+
264+
public override bool SupportsLobValueChangePropogation => false;
265+
266+
public override bool SupportsUnboundedLobLocatorMaterialization => false;
267+
268+
#endregion
252269
}
253270
}

0 commit comments

Comments
 (0)