Exemplo n.º 1
0
            private void HandleDotStructure(IASTNode dotStructureRoot)
            {
                var expression = ASTUtil.GetPathText(dotStructureRoot);

                var constant = ReflectHelper.GetConstantValue(expression, _sfi);

                if (constant != null)
                {
                    dotStructureRoot.ClearChildren();
                    dotStructureRoot.Type = HqlSqlWalker.JAVA_CONSTANT;
                    dotStructureRoot.Text = expression;
                }
            }
Exemplo n.º 2
0
 private IQueryable ResolveEntityJoinReferencedPersister(IASTNode path)
 {
     if (path.Type == IDENT)
     {
         var pathIdentNode = (IdentNode)path;
         return(SessionFactoryHelper.FindQueryableUsingImports(pathIdentNode.Path));
     }
     else if (path.Type == DOT)
     {
         var pathText = ASTUtil.GetPathText(path);
         return(SessionFactoryHelper.FindQueryableUsingImports(pathText));
     }
     return(null);
 }
Exemplo n.º 3
0
 private IQueryable ResolveEntityJoinReferencedPersister(IASTNode path)
 {
     if (path.Type == IDENT)
     {
         var pathIdentNode = (IdentNode)path;
         // Since IDENT node is not expected for implicit join path, we can throw on not found persister
         return((IQueryable)SessionFactoryHelper.RequireClassPersister(pathIdentNode.Path));
     }
     else if (path.Type == DOT)
     {
         var pathText = ASTUtil.GetPathText(path);
         return(SessionFactoryHelper.FindQueryableUsingImports(pathText));
     }
     return(null);
 }
        private void ExtractOrders(IASTNode node)
        {
            if (this.rootClassMetadata == null)
            {
                throw new NotSupportedException("Ordering of sharded scalar HQL queries is not supported");
            }

            var child = node.GetFirstChild();

            while (child != null)
            {
                var propertyPath = ASTUtil.GetPathText(child);
                var aliasLength  = propertyPath.IndexOf('.');
                if (aliasLength >= 0)
                {
                    propertyPath = propertyPath.Substring(aliasLength + 1);
                }

                var isDescending = false;

                child = child.NextSibling;
                if (child != null)
                {
                    isDescending = child.Type == HqlSqlWalker.DESCENDING;
                    if (isDescending || child.Type == HqlSqlWalker.ASCENDING)
                    {
                        child = child.NextSibling;
                    }
                }

                this.exitOperationBuilder.Orders.Add(
                    new SortOrder(
                        o => propertyPath == this.rootClassMetadata.IdentifierPropertyName
                                                    ? this.rootClassMetadata.GetIdentifier(o)
                                                    : this.rootClassMetadata.GetPropertyValue(o, propertyPath),
                        isDescending));
            }
        }
Exemplo n.º 5
0
        private static QueryException BuildIllegalCollectionDereferenceException(string propertyName, IASTNode lhs)
        {
            string lhsPath = ASTUtil.GetPathText(lhs);

            return(new QueryException("illegal attempt to dereference collection [" + lhsPath + "] with element property reference [" + propertyName + "]"));
        }