@Override public String toCQLString() { StringBuilder sb = new StringBuilder(); for(int i=0; i < this.factories.size(); i++) { if (i > 0) sb.append(","); sb.append(this.factories.get(i).getColumnNameCQL3()); } return sb.toString(); } }
@Override public int getResultSetIndex(ColumnDefinition c) { int index = getColumnIndex(c); if (index < 0) return -1; for (int i = 0, m = factories.size(); i < m; i++) if (factories.get(i).isSimpleSelectorFactory(index)) return i; return -1; }
@Override public int getResultSetIndex(ColumnDefinition c) { int index = getColumnIndex(c); if (index < 0) return -1; for (int i = 0, m = factories.size(); i < m; i++) if (factories.get(i).isSimpleSelectorFactory(index)) return i; return -1; }
@Override public int getResultSetIndex(ColumnDefinition c) { int index = getColumnIndex(c); if (index < 0) return -1; for (int i = 0, m = factories.size(); i < m; i++) if (factories.get(i).isSimpleSelectorFactory(index)) return i; return -1; }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { List<Selectable> args = Collections.singletonList(arg); SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, null, cfm, defs, boundNames); Selector.Factory factory = factories.get(0); // If the user is trying to cast a type on its own type we simply ignore it. if (type.getType().equals(factory.getReturnType())) return factory; FunctionName name = FunctionName.nativeFunction(CastFcts.getFunctionName(type)); Function fun = FunctionResolver.get(cfm.ksName, name, args, cfm.ksName, cfm.cfName, null); if (fun == null) { throw new InvalidRequestException(String.format("%s cannot be cast to %s", defs.get(0).name, type)); } return AbstractFunctionSelector.newFactory(fun, factories); }