本文整理汇总了C#中SelectStatement.EnumerateQuerySpecifications方法的典型用法代码示例。如果您正苦于以下问题:C# SelectStatement.EnumerateQuerySpecifications方法的具体用法?C# SelectStatement.EnumerateQuerySpecifications怎么用?C# SelectStatement.EnumerateQuerySpecifications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectStatement
的用法示例。
在下文中一共展示了SelectStatement.EnumerateQuerySpecifications方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateMostRestrictiveTableQuery
public override string GenerateMostRestrictiveTableQuery(SelectStatement selectStatement, TableReference table, int top)
{
// Function assumes that Condition Normalizer has already run on the query
// *** TODO: check this using flags ^^^^
var sql = new StringWriter();
sql.Write("SELECT ");
// Now write the referenced columns
int q = 0;
foreach (var cr in table.ColumnReferences.Where(c => c.IsReferenced))
{
if (q != 0)
{
sql.Write(", ");
}
sql.Write("`{0}`", cr.ColumnName);
q++;
}
// From cluse
sql.Write(" FROM `{0}`", table.TableName);
if (!String.IsNullOrWhiteSpace(table.Alias))
{
sql.Write(" `{0}`", table.Alias);
}
// Generate the table specific most restictive where clause
var cnr = new SearchConditionNormalizer();
cnr.Execute(selectStatement.EnumerateQuerySpecifications().First()); // TODO: what if more than one QS?
var where = cnr.GenerateWhereClauseSpecificToTable(table);
if (where != null)
{
Execute(sql, where);
}
if (top > 0)
{
sql.Write(" LIMIT {0} ", top);
}
return sql.ToString();
}