Skip to content

Commit

Permalink
-Fixed formatting of file headers, tab vs space, etc.
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 8 changed files with 783 additions and 783 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
[assembly: AssemblyVersionAttribute("2.0.0.1001")]
[assembly: AssemblyInformationalVersionAttribute("2.0.0.1001")]
[assembly: AssemblyFileVersionAttribute("2.0.0.1001")]
//[assembly: AssemblyKeyFileAttribute("../../src/NHibernate.snk")]
[assembly: AssemblyDelaySignAttribute(false)]
[assembly: AllowPartiallyTrustedCallers()]
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
Loading

0 comments on commit dff27b5

Please sign in to comment.