/** * Utility to set the type of an expression if it is a Reference and has a null type. * @param expression the expression to test * @param targetType the target type, if the expression's type is null. * @throws QueryResolverException if unable to set the reference type to the target type. */ public static void setDesiredType(Expression expression, Class<?> targetType, LanguageObject surroundingExpression) throws QueryResolverException { if (expression instanceof Reference) { Reference ref = (Reference)expression; if (ref.isPositional() && ref.getType() == null) { if (targetType == null) { throw new QueryResolverException(QueryPlugin.Event.TEIID30083, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30083, surroundingExpression)); } ref.setType(targetType); } } else if (expression instanceof Function) { Function f = (Function)expression; if (f.getType() == null) { f.setType(targetType); } } }
/** * Utility to set the type of an expression if it is a Reference and has a null type. * @param expression the expression to test * @param targetType the target type, if the expression's type is null. * @throws QueryResolverException if unable to set the reference type to the target type. */ public static void setDesiredType(Expression expression, Class<?> targetType, LanguageObject surroundingExpression) throws QueryResolverException { if (expression instanceof Reference) { Reference ref = (Reference)expression; if (ref.isPositional() && ref.getType() == null) { if (targetType == null) { throw new QueryResolverException(QueryPlugin.Event.TEIID30083, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30083, surroundingExpression)); } ref.setType(targetType); } } else if (expression instanceof Function) { Function f = (Function)expression; if (f.getType() == null) { f.setType(targetType); } } }
/** * Utility to set the type of an expression if it is a Reference and has a null type. * @param expression the expression to test * @param targetType the target type, if the expression's type is null. * @throws QueryResolverException if unable to set the reference type to the target type. */ public static void setDesiredType(Expression expression, Class<?> targetType, LanguageObject surroundingExpression) throws QueryResolverException { if (expression instanceof Reference) { Reference ref = (Reference)expression; if (ref.isPositional() && ref.getType() == null) { if (targetType == null) { throw new QueryResolverException(QueryPlugin.Event.TEIID30083, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30083, surroundingExpression)); } ref.setType(targetType); } } else if (expression instanceof Function) { Function f = (Function)expression; if (f.getType() == null) { f.setType(targetType); } } }
for (int i = 0; i < insert.getVariables().size(); i++) { Reference ref = new Reference(i); ref.setType(insert.getVariables().get(i).getType()); references.add(ref);