Skip to content

Commit d640fc9

Browse files
Rename an existing property (to be squashed, and all my other commits too).
Renaming an existing property without causing a breaking change causes some bloat.
1 parent d8f3449 commit d640fc9

File tree

10 files changed

+53
-11
lines changed

10 files changed

+53
-11
lines changed

src/NHibernate/Async/Dialect/InformixDialect.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
//------------------------------------------------------------------------------
99

1010

11+
using System;
1112
using System.Data;
1213
using System.Data.Common;
1314
using System.Text;
14-
using NHibernate.Cfg;
1515
using NHibernate.Dialect.Function;
1616
using NHibernate.Exceptions;
1717
using NHibernate.SqlCommand;
1818
using NHibernate.Util;
19+
using Environment = NHibernate.Cfg.Environment;
1920

2021
//using NHibernate.Dialect.Schema;
2122

src/NHibernate/Async/Loader/Hql/QueryLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ internal async Task<IEnumerable> GetEnumerableAsync(QueryParameters queryParamet
121121
return result;
122122
}
123123
}
124-
}
124+
}

src/NHibernate/Dialect/Dialect.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,19 +529,27 @@ public virtual string ForUpdateString
529529
/// <summary>Is <c>FOR UPDATE OF</c> syntax supported?</summary>
530530
/// <value><see langword="true"/> if the database supports <c>FOR UPDATE OF</c> syntax; <see langword="false"/> otherwise. </value>
531531
public virtual bool SupportsForUpdateOf
532-
// By default, just check ForUpdateOfColumns. ForUpdateOf needs to be overriden only for dialect suppoting
532+
// By default, just check UsesColumnsWithForUpdateOf. ForUpdateOf needs to be overriden only for dialects supporting
533533
// "For Update Of" on table aliases.
534-
=> ForUpdateOfColumns;
534+
=> UsesColumnsWithForUpdateOf;
535535

536536
/// <summary>Is <c>FOR UPDATE OF</c> syntax expecting columns?</summary>
537537
/// <value><see langword="true"/> if the database expects a column list with <c>FOR UPDATE OF</c> syntax,
538538
/// <see langword="false"/> if it expects table alias instead or do not support <c>FOR UPDATE OF</c> syntax.</value>
539+
// Since v5.1
540+
[Obsolete("Use UsesColumnsWithForUpdateOf instead")]
539541
public virtual bool ForUpdateOfColumns
540542
{
541543
// by default we report no support
542544
get { return false; }
543545
}
544546

547+
public virtual bool UsesColumnsWithForUpdateOf
548+
#pragma warning disable 618
549+
// For avoiding a breaking change, we need to call the old name by default.
550+
=> ForUpdateOfColumns;
551+
#pragma warning restore 618
552+
545553
/// <summary>
546554
/// Does this dialect support <tt>FOR UPDATE</tt> in conjunction with outer joined rows?
547555
/// </summary>

src/NHibernate/Dialect/InformixDialect.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
using System;
12
using System.Data;
23
using System.Data.Common;
34
using System.Text;
4-
using NHibernate.Cfg;
55
using NHibernate.Dialect.Function;
66
using NHibernate.Exceptions;
77
using NHibernate.SqlCommand;
88
using NHibernate.Util;
9+
using Environment = NHibernate.Cfg.Environment;
910

1011
//using NHibernate.Dialect.Schema;
1112

@@ -176,11 +177,18 @@ public override string AddColumnString
176177
//}
177178

178179
/// <inheritdoc />
180+
// Since v5.1
181+
[Obsolete("Use UsesColumnsWithForUpdateOf instead")]
179182
public override bool ForUpdateOfColumns
180183
{
181184
get { return true; }
182185
}
183186

187+
/* 6.0 TODO: uncomment once ForUpdateOfColumns is removed.
188+
/// <inheritdoc />
189+
public override bool UsesColumnsWithForUpdateOf => true;
190+
*/
191+
184192
/// <summary>
185193
/// Does this dialect support <tt>FOR UPDATE</tt> in conjunction with outer joined rows?
186194
/// </summary>

src/NHibernate/Dialect/Oracle8iDialect.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,18 @@ public override bool UseMaxForLimit
485485
get { return true; }
486486
}
487487

488+
// Since v5.1
489+
[Obsolete("Use UsesColumnsWithForUpdateOf instead")]
488490
public override bool ForUpdateOfColumns
489491
{
490492
get { return true; }
491493
}
492494

495+
/* 6.0 TODO: uncomment once ForUpdateOfColumns is removed.
496+
/// <inheritdoc />
497+
public override bool UsesColumnsWithForUpdateOf => true;
498+
*/
499+
493500
public override bool SupportsUnionAll
494501
{
495502
get { return true; }

src/NHibernate/Dialect/SybaseSQLAnywhere10Dialect.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,11 +643,29 @@ public override string GetForUpdateString(LockMode lockMode)
643643
/// In this dialect, we avoid this issue by supporting only
644644
/// <tt>FOR UPDATE BY LOCK</tt>.
645645
/// </summary>
646+
// Since v5.1
647+
[Obsolete("Use UsesColumnsWithForUpdateOf instead")]
646648
public override bool ForUpdateOfColumns
647649
{
648650
get { return false; }
649651
}
650652

653+
/* 6.0 TODO: uncomment once ForUpdateOfColumns is removed.
654+
/// <summary>
655+
/// SQL Anywhere does support <c>FOR UPDATE OF</c> syntax. However,
656+
/// in SQL Anywhere one cannot specify both <c>FOR UPDATE OF</c> syntax
657+
/// and <c>FOR UPDATE BY LOCK</c> in the same statement. To achieve INTENT
658+
/// locking when using <c>FOR UPDATE OF</c> syntax one must use a table hint
659+
/// in the query's FROM clause, ie.
660+
/// <code>
661+
/// SELECT * FROM FOO WITH( UPDLOCK ) FOR UPDATE OF ( column-list ).
662+
/// </code>
663+
/// In this dialect, we avoid this issue by supporting only
664+
/// <c>FOR UPDATE BY LOCK</c>.
665+
/// </summary>
666+
public override bool UsesColumnsWithForUpdateOf => false;
667+
*/
668+
651669
/// <summary>
652670
/// SQL Anywhere supports <tt>FOR UPDATE</tt> over cursors containing
653671
/// outer joins.

src/NHibernate/Loader/Criteria/CriteriaLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected override SqlString ApplyLocks(SqlString sqlSelectString, IDictionary<s
171171
}
172172

173173
Dictionary<string, LockMode> aliasedLockModes = new Dictionary<string, LockMode>();
174-
Dictionary<string, string[]> keyColumnNames = dialect.ForUpdateOfColumns ? new Dictionary<string, string[]>() : null;
174+
Dictionary<string, string[]> keyColumnNames = dialect.UsesColumnsWithForUpdateOf ? new Dictionary<string, string[]>() : null;
175175
string[] drivingSqlAliases = Aliases;
176176

177177
//NH-3710: if we are issuing an aggregation function, Aliases will be null

src/NHibernate/Loader/Hql/QueryLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected override SqlString ApplyLocks(SqlString sql, IDictionary<string, LockM
7171
// we are given a map of user-alias -> lock mode
7272
// create a new map of sql-alias -> lock mode
7373
var aliasedLockModes = new Dictionary<string, LockMode>();
74-
Dictionary<string, string[]> keyColumnNames = dialect.ForUpdateOfColumns ? new Dictionary<string, string[]>() : null;
74+
Dictionary<string, string[]> keyColumnNames = dialect.UsesColumnsWithForUpdateOf ? new Dictionary<string, string[]>() : null;
7575

7676
foreach (var entry in lockModes)
7777
{
@@ -456,4 +456,4 @@ protected override IEnumerable<IParameterSpecification> GetParameterSpecificatio
456456
return _queryTranslator.CollectedParameterSpecifications;
457457
}
458458
}
459-
}
459+
}

src/NHibernate/SqlCommand/ForUpdateFragment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public ForUpdateFragment(Dialect.Dialect dialect, IDictionary<string, LockMode>
3030
if (LockMode.Read.LessThan(lockMode))
3131
{
3232
string tableAlias = me.Key;
33-
if (dialect.ForUpdateOfColumns)
33+
if (dialect.UsesColumnsWithForUpdateOf)
3434
{
3535
string[] keyColumns = keyColumnNames[tableAlias];
3636
if (keyColumns == null)
@@ -89,4 +89,4 @@ public string ToSqlStringFragment()
8989
: dialect.GetForUpdateString(aliases.ToString());
9090
}
9191
}
92-
}
92+
}

src/NHibernate/SqlCommand/SqlSelectBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private string GetForUpdateString()
320320
return string.Empty;
321321
}
322322

323-
if (Dialect.ForUpdateOfColumns)
323+
if (Dialect.UsesColumnsWithForUpdateOf)
324324
{
325325
log.Warn(
326326
"Unimplemented 'for update' case: 'for update' query with an outer join using a dialect not" +

0 commit comments

Comments
 (0)