-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Fixed formatting of file headers, tab vs space, etc.
git-svn-id: https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk@1669 d7b3437e-3345-0410-94a8-cbd290e69f67
- Loading branch information
h_eskandari
committed
Mar 28, 2011
1 parent
ecf9bbd
commit dff27b5
Showing
8 changed files
with
783 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,45 +6,42 @@ | |
|
||
namespace NHibernate.JetDriver | ||
{ | ||
/// <summary> | ||
/// Jet engine doesn't support CASE ... WHEN ... END syntax, but has a proprietary "Switch". | ||
/// </summary> | ||
/// <remarks> | ||
/// Author: <a href="mailto:[email protected]">Lukas Krejci</a> | ||
/// </remarks> | ||
public class JetCaseFragment : CaseFragment | ||
{ | ||
readonly List<string> caseStatements = new List<string>(); | ||
|
||
public JetCaseFragment(Dialect.Dialect dialect):base(dialect) | ||
{ | ||
} | ||
|
||
|
||
public override CaseFragment AddWhenColumnNotNull(string alias, string columnName, string columnValue) | ||
{ | ||
string key = alias + StringHelper.Dot + columnName + " is not null"; | ||
|
||
caseStatements.Add(key + ", " + columnValue); | ||
return this; | ||
} | ||
|
||
public override string ToSqlStringFragment() | ||
{ | ||
StringBuilder buf = new StringBuilder(cases.Count * 15 + 10); | ||
|
||
buf | ||
.Append("Switch(") | ||
.Append(string.Join(", ", caseStatements.ToArray())) | ||
/// <summary> | ||
/// Jet engine doesn't support CASE ... WHEN ... END syntax, but has a proprietary "Switch". | ||
/// </summary> | ||
public class JetCaseFragment : CaseFragment | ||
{ | ||
readonly List<string> caseStatements = new List<string>(); | ||
|
||
public JetCaseFragment(Dialect.Dialect dialect) | ||
: base(dialect) | ||
{ | ||
} | ||
|
||
public override CaseFragment AddWhenColumnNotNull(string alias, string columnName, string columnValue) | ||
{ | ||
string key = alias + StringHelper.Dot + columnName + " is not null"; | ||
|
||
caseStatements.Add(key + ", " + columnValue); | ||
return this; | ||
} | ||
|
||
public override string ToSqlStringFragment() | ||
{ | ||
StringBuilder buf = new StringBuilder(cases.Count * 15 + 10); | ||
|
||
buf | ||
.Append("Switch(") | ||
.Append(string.Join(", ", caseStatements.ToArray())) | ||
.Append(" )"); | ||
|
||
if (returnColumnName != null) | ||
{ | ||
buf.Append(" as ") | ||
.Append(returnColumnName); | ||
} | ||
if (returnColumnName != null) | ||
{ | ||
buf.Append(" as ") | ||
.Append(returnColumnName); | ||
} | ||
|
||
return buf.ToString(); | ||
} | ||
} | ||
return buf.ToString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.