public static String getName(Expression ex) { if (ex instanceof Symbol) { return ((Symbol)ex).getName(); } return "expr"; //$NON-NLS-1$ }
public static String getName(Expression ex) { if (ex instanceof Symbol) { return ((Symbol)ex).getName(); } return "expr"; //$NON-NLS-1$ }
public static String getName(Expression ex) { if (ex instanceof Symbol) { return ((Symbol)ex).getName(); } return "expr"; //$NON-NLS-1$ }
public String getOutputName() { return this.outputName == null ? getName() : this.outputName; }
public String getOutputName() { return this.outputName == null ? getName() : this.outputName; }
public String getOutputName() { return this.outputName == null ? getName() : this.outputName; }
/** * Compare the symbol based ONLY on name. Symbols are not compared based on * their underlying physical metadata IDs but rather on their representation * in the context of a particular query. Case is not important when comparing * symbol names. * @param obj Other object * @return True if other obj is a Symbol (or subclass) and name is equal */ public boolean equals(Object obj) { if(obj == this) { return true; } if(!(obj instanceof Symbol)) { return false; } String otherFqn = ((Symbol)obj).getName(); String thisFqn = getName(); return thisFqn.equals(otherFqn); }
/** * Compare the symbol based ONLY on name. Symbols are not compared based on * their underlying physical metadata IDs but rather on their representation * in the context of a particular query. Case is not important when comparing * symbol names. * @param obj Other object * @return True if other obj is a Symbol (or subclass) and name is equal */ public boolean equals(Object obj) { if(obj == this) { return true; } if(!(obj instanceof Symbol)) { return false; } String otherFqn = ((Symbol)obj).getName(); String thisFqn = getName(); return thisFqn.equals(otherFqn); }
/** * Compare the symbol based ONLY on name. Symbols are not compared based on * their underlying physical metadata IDs but rather on their representation * in the context of a particular query. Case is not important when comparing * symbol names. * @param obj Other object * @return True if other obj is a Symbol (or subclass) and name is equal */ public boolean equals(Object obj) { if(obj == this) { return true; } if(!(obj instanceof Symbol)) { return false; } String otherFqn = ((Symbol)obj).getName(); String thisFqn = getName(); return thisFqn.equals(otherFqn); }
@Override public String getName() { if (this.qualifier != null) { return this.qualifier + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
@Override public String getName() { if (this.schema != null) { return this.schema + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
@Override public String getName() { if (this.qualifier != null) { return this.qualifier + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
@Override public String getName() { if (this.groupSymbol != null) { return this.groupSymbol.getName() + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
@Override public String getName() { if (this.groupSymbol != null) { return this.groupSymbol.getName() + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
@Override public String getName() { if (this.groupSymbol != null) { return this.groupSymbol.getName() + Symbol.SEPARATOR + this.getShortName(); } return super.getName(); }
static void mapBindings(MappingSourceNode sourceNode, QueryNode oldQueryNode, QueryNode modifiedNode) throws TeiidComponentException { if (oldQueryNode.getBindings() != null) { List<String> bindings = new ArrayList<String>(); for (Iterator<Expression> i = QueryResolver.parseBindings(oldQueryNode).iterator(); i.hasNext();) { Expression ses = i.next(); String name = Symbol.getName(ses); boolean useName = false; if (ses instanceof AliasSymbol) { ses = ((AliasSymbol)ses).getSymbol(); useName = true; } ElementSymbol es = (ElementSymbol)ses; if (!useName) { bindings.add(sourceNode.getMappedSymbol(es).toString()); } else { bindings.add(new AliasSymbol(name, sourceNode.getMappedSymbol(es)).toString()); } } modifiedNode.setBindings(bindings); } }
@Test public void testAnonBlock() throws Exception { String sql = "begin select 1 as something; end"; //$NON-NLS-1$ CreateProcedureCommand sp = (CreateProcedureCommand) TestResolver.helpResolve(sql, RealMetadataFactory.example1Cached()); assertEquals(1, sp.getResultSetColumns().size()); assertEquals("something", Symbol.getName(sp.getResultSetColumns().get(0))); assertEquals(1, sp.getProjectedSymbols().size()); assertTrue(sp.returnsResultSet()); }
@Test public void testOrderBySymbolName() throws Exception { String sql = "select e1 from pm1.g1 order by e1"; //$NON-NLS-1$ String expected = "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$ Query command = (Query)helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached()); assertEquals(((Symbol)command.getOrderBy().getSortKeys().get(0)).getName(), "c_0"); //$NON-NLS-1$ assertEquals(((Symbol)command.getProjectedSymbols().get(0)).getShortName(), "c_0"); //$NON-NLS-1$ }