本文整理汇总了C#中Formatter.GetResultText方法的典型用法代码示例。如果您正苦于以下问题:C# Formatter.GetResultText方法的具体用法?C# Formatter.GetResultText怎么用?C# Formatter.GetResultText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter.GetResultText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetColumnText
public string GetColumnText(Formatter formatter)
{
string columnText = _column.GetColumnText(formatter);
string aliasText = formatter.GetResultText(_result);
string sql = columnText;
if (columnText != aliasText)
{
sql += " " + aliasText;
}
return sql;
}
示例2: GetSQL
internal string GetSQL(Formatter formatter, bool resetTableAliases)
{
ValidateQuery();
if (resetTableAliases)
{
ResetTableAliases(0);
}
// TODO: Switch to using a StringBuilder.
string sql = "SELECT ";
if (_distinct)
{
sql += "DISTINCT ";
}
sql += GetColumnNames(formatter) + "\nFROM ";
sql += formatter.GetTableText(_fromTable);
if (_joins.Count > 0)
{
foreach (JoinInfo joinInfo in _joins)
{
sql += joinInfo.GetSQL(formatter);
}
}
if (_where != null)
{
sql += "\nWHERE ";
sql += _where.GetSQL(formatter);
}
if (_groupBy.Count > 0)
{
sql += "\nGROUP BY ";
bool first = true;
foreach (Column column in _groupBy)
{
if (!first)
{
sql += ", ";
}
sql += column.GetColumnText(formatter);
first = false;
}
if (_having != null)
{
sql += "\nHAVING ";
sql += _having.GetSQL(formatter);
}
}
if (_orderBy.Count > 0)
{
sql += "\nORDER BY ";
bool first = true;
foreach (OrderByInfo orderBy in _orderBy)
{
if (!first)
{
sql += ", ";
}
if (orderBy is OrderByColumnInfo)
{
sql += ((OrderByColumnInfo)orderBy).Column.GetColumnText(formatter);
}
else
{
sql += formatter.GetResultText(((OrderByResultInfo)orderBy).Result);
}
if (orderBy.Descending)
{
sql += " DESC";
}
first = false;
}
}
return sql;
}