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

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


      }

      public SQLQuery argSubQueryValue(ArgValue val, T in)
            throws TypedValueVisitorException
      {
         throw new TypedValueVisitorException("Accessing argument as a subquery when it is a value");
      }
View Full Code Here


      }

      public SQLColumnValues argValue(ArgValue val, T in)
         throws TypedValueVisitorException
      {
         throw new TypedValueVisitorException("Accessing argument as a value when it is a subquery");
      }
View Full Code Here

      public SQLColumnValues argValue(ArgValue val, T in)
         throws TypedValueVisitorException
      {
         if (val.getIndex() != 0)
            throw new TypedValueVisitorException("Accessing argument as a value when it is a subquery");
         return keySource;
      }
View Full Code Here

      public SQLQuery argSubQueryValue(ArgValue val, T in)
            throws TypedValueVisitorException
      {
         if (val.getIndex() != 1)
            throw new TypedValueVisitorException("Accessing argument as a subquery when it is a value");
         SQLQuery.InternalGroup group = new SQLQuery.InternalGroup(dataSource.reader);
         for (SQLFragment col: dataSource.columns)
            group.columns.add(col);
         return group;
      }
View Full Code Here

         this.emSource = emSource;
      }
      public SQLColumnValues getFieldValue(TypedValue.GetFieldValue val, T in) throws TypedValueVisitorException
      {
         if (!(val.operand instanceof TypedValue.ThisValue))
            throw new TypedValueVisitorException("Unhandled access to a field");
         // Currently, we only support parameters of a few small simple types.
         // We should also support more complex types (e.g. entities) and allow
         // 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)
         Type t = val.getType();
         if (!allowedQueryParameterTypes.containsKey(t))
            throw new TypedValueVisitorException("Accessing a field with unhandled type");
        
         try
         {
            // TODO: Careful here. ParameterLocation is relative to the base
            // lambda, but if we arrive here from inside a nested query, "this"
            // might refer to a lambda nested inside the base lambda. (Of course,
            // nested queries with parameters aren't currently supported, so it
            // doesn't matter.)
            ParameterLocation paramLoc = ParameterLocation.createThisFieldAccess(val.name, lambdaIndex);
//            Object param = paramLoc.getParameter(lambda);
            SQLColumnValues toReturn = new SQLColumnValues(allowedQueryParameterTypes.get(t));
            assert(toReturn.getNumColumns() == 1);
            toReturn.columns[0].add(new SQLSubstitution.ExternalParameterLink(paramLoc));
            return toReturn;
         } catch (Exception e)
         {
            throw new TypedValueVisitorException(e);
         }
      }
View Full Code Here

            return null;
         }
      }
      public SQLQuery getFieldSubQueryValue(TypedValue.GetFieldValue val, T in) throws TypedValueVisitorException
      {
         throw new TypedValueVisitorException("Unhandled: getting a parameter that is a subquery");
      }
View Full Code Here

      if (entityInfo.allEntityMethods.containsKey(sig))
      {
         String entityName = entityInfo.allEntityMethods.get(sig);
         EntityManagerBackdoor em = getAndCheckEntityManager(val.base);
         if (em == null)
            throw new TypedValueVisitorException("Accessing an unknown entity manager");
         return new SQLQuery.SelectFromWhere<T>(
               em.getReaderForEntity(entityName),
               em.getEntityColumnNames(entityName),
               em.getTableForEntity(entityName));
      }
View Full Code Here

   // These are only valid if there is only one column (is this correct?)
   public SQLColumnValues<T> add(String str) throws TypedValueVisitorException
   {
      if (columns.length != 1)
         throw new TypedValueVisitorException("Adding string to multi-column value");
      columns[0].add(str);
      return this;
   }
View Full Code Here

      return this;
   }
   public SQLColumnValues<T> add(SQLColumnValues toAdd) throws TypedValueVisitorException
   {
      if (columns.length != 1)
         throw new TypedValueVisitorException("Adding to a multi-column value");
      if (columns.length != toAdd.columns.length)
         throw new TypedValueVisitorException("Adding together different number of columns");
      columns[0].add(toAdd.columns[0]);
      return this;
   }
View Full Code Here

      this.parentArgumentScope = parentArgumentScope;
   }

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

TOP

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

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.