本文整理汇总了C#中ISqlNode类的典型用法代码示例。如果您正苦于以下问题:C# ISqlNode类的具体用法?C# ISqlNode怎么用?C# ISqlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISqlNode类属于命名空间,在下文中一共展示了ISqlNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDirection
private void GetDirection(ISqlNode node)
{
var childNode = node.ChildNodes.FirstOrDefault();
if (childNode == null)
return;
childNode = childNode.ChildNodes.FirstOrDefault();
if (childNode == null)
throw new SqlParseException();
if (String.Equals(childNode.NodeName, "NEXT", StringComparison.OrdinalIgnoreCase) ||
String.Equals(childNode.NodeName, "PRIOR", StringComparison.OrdinalIgnoreCase) ||
String.Equals(childNode.NodeName, "FIRST", StringComparison.OrdinalIgnoreCase) ||
String.Equals(childNode.NodeName, "LAST", StringComparison.OrdinalIgnoreCase)) {
Direction = childNode.NodeName.ToUpper();
} else if (String.Equals(childNode.NodeName, "ABSOLUTE", StringComparison.OrdinalIgnoreCase) ||
String.Equals(childNode.NodeName, "RELATIVE", StringComparison.OrdinalIgnoreCase)) {
var positionNode = childNode.ChildNodes.FirstOrDefault();
if (positionNode == null)
throw new SqlParseException("The position expression if required in an ABSOLUTE or RELATIVE fetch.");
var expression = positionNode as IExpressionNode;
if (expression == null)
throw new SqlParseException();
Direction = childNode.NodeName.ToUpper();
Position = expression;
}
}
示例2: GetOrderBy
private void GetOrderBy(ISqlNode node)
{
var listNode = node.FindByName("sorted_def_list");
if (listNode != null) {
OrderBy = listNode.ChildNodes.Cast<OrderByNode>();
}
}
示例3: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node is TableColumnNode)
Column = (TableColumnNode) node;
return base.OnChildNode(node);
}
示例4: Append
public void Append(ISqlNode sqlNode)
{
if (sqlNode == null)
return;
sqlNode.Render(this);
}
示例5: VisitFirst
private ISqlNode VisitFirst(ISqlNode parent, MethodCallExpression expr)
{
var select = (ISelect)parent;
select.Top = new Top(new ConstantProvider(_context, 1));
return select;
}
示例6: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node is IExpressionNode)
Password = (IExpressionNode) node;
return base.OnChildNode(node);
}
示例7: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node is SqlKeyNode) {
var keyNode = (SqlKeyNode) node;
if (String.Equals(keyNode.Text, "NULL", StringComparison.OrdinalIgnoreCase)) {
if (notSeen) {
ConstraintType = ConstraintTypeNames.NotNull;
} else {
ConstraintType = ConstraintTypeNames.Null;
}
} else if (String.Equals(keyNode.Text, "NOT", StringComparison.OrdinalIgnoreCase)) {
notSeen = true;
} else if (String.Equals(keyNode.Text, "REFERENCES", StringComparison.OrdinalIgnoreCase)) {
ConstraintType = ConstraintTypeNames.ForeignKey;
} else if (String.Equals(keyNode.Text, "CHECK", StringComparison.OrdinalIgnoreCase)) {
ConstraintType = ConstraintTypeNames.Check;
} else if (String.Equals(keyNode.Text, "PRIMARY", StringComparison.OrdinalIgnoreCase)) {
ConstraintType = ConstraintTypeNames.PrimaryKey;
} else if (String.Equals(keyNode.Text, "UNIQUE", StringComparison.OrdinalIgnoreCase)) {
ConstraintType = ConstraintTypeNames.UniqueKey;
}
} else if (node is IExpressionNode) {
CheckExpression = (IExpressionNode) node;
} else if (node is ObjectNameNode) {
if (!String.Equals(ConstraintType, ConstraintTypeNames.ForeignKey, StringComparison.OrdinalIgnoreCase))
throw new InvalidOperationException();
ReferencedTable = ((ObjectNameNode) node);
}
return base.OnChildNode(node);
}
示例8: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node is TableConstraintNode)
Constraint = (TableConstraintNode) node;
return base.OnChildNode(node);
}
示例9: OnChildNode
/// <inheritdoc/>
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node.NodeName == "sql_expression_list")
GetExpressions(node);
return base.OnChildNode(node);
}
示例10: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node is IdentifierNode)
Text = ((IdentifierNode) node).Text;
return base.OnChildNode(node);
}
示例11: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node.NodeName.Equals("exception_name_opt"))
ExceptionName = node.FindNode<IdentifierNode>().Text;
return base.OnChildNode(node);
}
示例12: Visit
private ISqlNode Visit(ISqlNode parent, Expression expr)
{
if (expr.NodeType == ExpressionType.Constant && expr.Type.IsGenericType(typeof(Queryable<>)))
return VisitRoot(parent, expr);
if(expr.NodeType == ExpressionType.Call)
{
var call = (MethodCallExpression) expr;
switch (call.Method.Name)
{
case "Where":
return VisitWhere(Visit(parent, call.Arguments[0]), call);
case "OrderBy":
return VisitOrderBy(Visit(parent, call.Arguments[0]), call);
case "ThenBy":
return VisitThenBy(Visit(parent, call.Arguments[0]), call);
case "OrderByDescending":
return VisitOrderByDescending(Visit(parent, call.Arguments[0]), call);
case "ThenByDescending":
return VisitThenByDescending(Visit(parent, call.Arguments[0]), call);
case "Take":
return VisitTake(Visit(parent, call.Arguments[0]), call);
case "Skip":
return VisitSkip(Visit(parent, call.Arguments[0]), call);
case "First":
case "Single":
case "FirstOrDefault":
case "SingleOrDefault":
return VisitFirst(Visit(parent, call.Arguments[0]), call);
}
}
throw new NotSupportedException("Not supported expression: " + expr);
}
示例13: OnChildNode
/// <inheritdoc/>
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node.NodeName.Equals("name_part")) {
node = node.ChildNodes.FirstOrDefault();
}
string text;
if (node is IdentifierNode) {
var idNode = (IdentifierNode) node;
text = idNode.Text;
} else if (node is SqlKeyNode) {
text = ((SqlKeyNode) node).Text;
if (!String.Equals(text, "*"))
throw new SqlParseException(String.Format("Invalid object name part '{0}' provided.", text));
} else {
throw new SqlParseException(String.Format("The node of type '{0}' is not allowed.", node.GetType()));
}
if (Name != null) {
Name = String.Format("{0}.{1}", Name, text);
} else {
Name = text;
}
return base.OnChildNode(node);
}
示例14: GetLimit
private void GetLimit(ISqlNode node)
{
foreach (var childNode in node.ChildNodes) {
if (childNode is IntegerLiteralNode) {
Limit = ((IntegerLiteralNode) childNode).Value;
}
}
}
示例15: OnChildNode
protected override ISqlNode OnChildNode(ISqlNode node)
{
if (node.NodeName.Equals("sql_expression_list")) {
Values = node.ChildNodes.OfType<IExpressionNode>();
}
return base.OnChildNode(node);
}