Package ch.epfl.labos.iu.orm.queryll2

Examples of ch.epfl.labos.iu.orm.queryll2.QueryllSQLQueryTransformer


      if (paramVal instanceof TypedValue.ArgValue)
      {
         TypedValue.ArgValue paramArg = (TypedValue.ArgValue)paramVal;
         int parentArgIndex = paramArg.getIndex();
         if (parentArgumentScope == null)
            throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
         // TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support
         // limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages
         // might be problematic. (Might have to pass additional parameteres to handleArg etc.)
         return parentArgumentScope.handleArg(parentArgIndex, argType);
      }
      else
      {
         throw new TypedValueVisitorException("Jinq can only passthrough parent lambda parameters directly to sub-lambdas. Sublambdas cannot take parameters that involve computation.");
      }
   }
View Full Code Here


      // fields/methods of those entities to be called in the query (code
      // motion will be used to push those field accesses or method calls
      // outside the query where they will be evaluated and then passed in
      // as a parameter)
      if (!ALLOWED_QUERY_PARAMETER_TYPES.contains(argType) && !metamodel.isKnownEnumType(argType.getInternalName()))
         throw new TypedValueVisitorException("Accessing a field with unhandled type");

      return ColumnExpressions.singleColumn(new SimpleRowReader<>(),
            new ParameterExpression(lambda.getLambdaIndex(), argIndex));
   }
View Full Code Here

   public ColumnExpressions<?> handleArg(int argIndex, Type argType) throws TypedValueVisitorException
   {
      if (argIndex < numLambdaCapturedArgs)
      {
         if (lambda == null)
            throw new TypedValueVisitorException("No lambda source was supplied where parameters can be extracted");
         if (lambda.usesIndirectArgs())
         {
            return handleIndirectLambdaArg(argIndex, argType);
         }
        
         return getAndValidateArg(argIndex, argType);
      }
      else if (checkIsInQueryStreamSource(argIndex))
         throw new TypedValueVisitorException("Using InQueryStreamSource as data");
      else
         return handleLambdaArg(argIndex - numLambdaCapturedArgs, argType);
   }
View Full Code Here

         return handleLambdaArg(argIndex - numLambdaCapturedArgs, argType);
   }

   protected JPQLQuery<?> handleLambdaSubQueryArg(int argIndex, Type argType) throws TypedValueVisitorException
   {
      throw new TypedValueVisitorException("Unhandled lambda subquery arguments");
   }
View Full Code Here

   {
      if (argIndex >= numLambdaCapturedArgs && !checkIsInQueryStreamSource(argIndex))
      {
         return handleLambdaSubQueryArg(argIndex - numLambdaCapturedArgs, argType);
      }
      throw new TypedValueVisitorException("Cannot use parameters as a subquery");
   }
View Full Code Here

      if (paramVal instanceof TypedValue.ArgValue)
      {
         TypedValue.ArgValue paramArg = (TypedValue.ArgValue)paramVal;
         int parentArgIndex = paramArg.getIndex();
         if (parentArgumentScope == null)
            throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
         // TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support
         // limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages
         // might be problematic. (Might have to pass additional parameteres to handleArg etc.)
         return parentArgumentScope.handleArg(parentArgIndex, argType);
      }
      else if (paramVal instanceof TypedValue.GetFieldValue)
      {
         TypedValue.GetFieldValue paramArg = (TypedValue.GetFieldValue)paramVal;
         String parentFieldName = paramArg.name;
         if (parentArgumentScope == null)
            throw new TypedValueVisitorException("Cannot find a parent scope to determine how to access as sublambda's parent parameters.");
         // TODO: Right now, we need to be careful about the scope of parent lambdas. Since we only support
         // limited usage of parameters for sublambdas, it's not a problem yet, but more complicated usages
         // might be problematic. (Might have to pass additional parameteres to handleArg etc.)
         return parentArgumentScope.handleThisFieldRead(parentFieldName, argType);
      }
      else
      {
         throw new TypedValueVisitorException("Jinq can only passthrough parent lambda parameters directly to sub-lambdas. Sublambdas cannot take parameters that involve computation.");
      }
   }
View Full Code Here

         // fields/methods of those entities to be called in the query (code
         // motion will be used to push those field accesses or method calls
         // outside the query where they will be evaluated and then passed in
         // as a parameter)
         if (!ALLOWED_QUERY_PARAMETER_TYPES.contains(argType) && !metamodel.isKnownEnumType(argType.getInternalName()))
            throw new TypedValueVisitorException("Accessing a field with unhandled type");

         return ColumnExpressions.singleColumn(new SimpleRowReader<>(),
               new ParameterFieldExpression(lambda.getLambdaIndex(), name));
      }
      throw new TypedValueVisitorException("Cannot read fields of this lambda");
   }
View Full Code Here

   @Override
   public JPQLQuery<?> handleSubQueryThisFieldRead(String name, Type argType)
         throws TypedValueVisitorException
   {
      throw new TypedValueVisitorException("Cannot read fields of this lambda for a subquery");
   }
View Full Code Here

      //    because I think JPQL lets you substitute the same parameter into multiple locations
      //    in a query (unlike JDBC), which means we don't need separate state for query fragments
      //    that appear multiple times in the query tree.
      if (argIndex == 0)
         return cols;
      throw new TypedValueVisitorException("Lambda trying to access unknown lambda parameter");
   }
View Full Code Here

   @Override
   protected ColumnExpressions<?> handleLambdaArg(int argIndex, Type argType) throws TypedValueVisitorException
   {
      if (argIndex == 0)
         return groupKey.cols;
      throw new TypedValueVisitorException("Lambda trying to access unknown lambda parameter");
   }
View Full Code Here

TOP

Related Classes of ch.epfl.labos.iu.orm.queryll2.QueryllSQLQueryTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.