本文整理汇总了C#中NHibernate.Hql.Classic.QueryTranslator.Compile方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTranslator.Compile方法的具体用法?C# QueryTranslator.Compile怎么用?C# QueryTranslator.Compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Hql.Classic.QueryTranslator
的用法示例。
在下文中一共展示了QueryTranslator.Compile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSqlWithClassicParser
public string GetSqlWithClassicParser(string query)
{
var qt = new NHibernate.Hql.Classic.QueryTranslator(null, query, emptyfilters, sessions);
qt.Compile(new Dictionary<string, string>(), false);
return qt.SQLString;
}
示例2: Token
/// <summary>
///
/// </summary>
/// <param name="token"></param>
/// <param name="q"></param>
public void Token(string token, QueryTranslator q)
{
string lcToken = token.ToLowerInvariant();
//Cope with [,]
if (token.Equals("[") && !expectingPathContinuation)
{
expectingPathContinuation = false;
if (expectingIndex == 0)
{
throw new QueryException("unexpected [");
}
return;
}
else if (token.Equals("]"))
{
expectingIndex--;
expectingPathContinuation = true;
return;
}
//Cope with a continued path expression (ie. ].baz)
if (expectingPathContinuation)
{
if (ContinuePathExpression(token, q)) return;
}
//Cope with a subselect
if (!inSubselect && (lcToken.Equals("select") || (lcToken.Equals("from") && !isInSpecialFunctionClause)))
{
inSubselect = true;
subselect = new StringBuilder(20);
}
if (inSubselect && token.Equals(StringHelper.ClosedParen))
{
bracketsSinceSelect--;
if (bracketsSinceSelect == -1)
{
QueryTranslator subq = new QueryTranslator(q.Factory, subselect.ToString(), q.EnabledFilters);
try
{
subq.Compile(q);
}
catch (MappingException me)
{
throw new QueryException("MappingException occurred compiling subquery", me);
}
AppendToken(q, subq.SqlString);
inSubselect = false;
bracketsSinceSelect = 0;
}
}
if (inSubselect)
{
if (token.Equals(StringHelper.OpenParen))
{
bracketsSinceSelect++;
}
subselect.Append(token).Append(' ');
return;
}
//Cope with special cases of AND, NOT, ()
SpecialCasesBefore(lcToken);
//Close extra brackets we opened
if (!betweenSpecialCase && expressionTerminators.Contains(lcToken))
{
CloseExpression(q, lcToken);
}
//take note when this is a boolean expression
if (booleanOperators.Contains(lcToken))
{
booleanTests.RemoveAt(booleanTests.Count - 1);
booleanTests.Add(true);
}
if (lcToken.Equals("not"))
{
nots[nots.Count - 1] = !nots[nots.Count - 1];
negated = !negated;
return; //NOTE: early return
}
if (!isInSpecialFunctionClause && specialFunctions.Contains(lcToken))
{
isInSpecialFunctionClause = true;
}
if (isInSpecialFunctionClause && token.Equals(StringHelper.OpenParen))
{
//.........这里部分代码省略.........