use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestAccessNode method testShouldExecuteUpdate.
@Test
public void testShouldExecuteUpdate() throws Exception {
Update update = new Update();
// $NON-NLS-1$
update.setGroup(new GroupSymbol("test"));
// $NON-NLS-1$ //$NON-NLS-2$
update.addChange(new ElementSymbol("e1"), new Constant("1"));
assertTrue(RelationalNodeUtil.shouldExecute(update, false));
update.setChangeList(new SetClauseList());
assertFalse(RelationalNodeUtil.shouldExecute(update, false));
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestResolver method testStoredQueryTransformationWithVariable4.
@Test
public void testStoredQueryTransformationWithVariable4() throws Exception {
// $NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand("EXEC pm1.sq2(pm1.sq2.in)");
// resolve
try {
// Construct command metadata
// $NON-NLS-1$
GroupSymbol sqGroup = new GroupSymbol("pm1.sq5");
ArrayList sqParams = new ArrayList();
// $NON-NLS-1$
ElementSymbol in = new ElementSymbol("pm1.sq5.in1");
in.setType(DataTypeManager.DefaultDataClasses.STRING);
sqParams.add(in);
Map externalMetadata = new HashMap();
externalMetadata.put(sqGroup, sqParams);
QueryResolver.resolveCommand(command, metadata);
// $NON-NLS-1$
fail("Expected exception on invalid variable pm1.sq2.in");
} catch (QueryResolverException e) {
// $NON-NLS-1$
assertEquals("TEIID31119 Symbol pm1.sq2.\"in\" is specified with an unknown group context", e.getMessage());
}
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestResolver method testCriteria1.
@Test
public void testCriteria1() {
CompareCriteria expected = new CompareCriteria();
// $NON-NLS-1$
ElementSymbol es = new ElementSymbol("pm1.g1.e1");
// $NON-NLS-1$
GroupSymbol gs = new GroupSymbol("pm1.g1");
es.setGroupSymbol(gs);
expected.setLeftExpression(es);
expected.setOperator(CompareCriteria.EQ);
// $NON-NLS-1$
expected.setRightExpression(new Constant("abc"));
// $NON-NLS-1$
Criteria actual = helpResolveCriteria("pm1.g1.e1 = 'abc'");
// $NON-NLS-1$
assertEquals("Did not match expected criteria", expected, actual);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class Create method clone.
/**
* @see org.teiid.query.sql.lang.Command#clone()
* @since 5.5
*/
public Object clone() {
Create copy = new Create();
GroupSymbol copyTable = table.clone();
copy.setTable(copyTable);
copy.columns = new ArrayList<Column>(columns.size());
for (Column column : columns) {
Column copyColumn = new Column();
copyColumn.setName(column.getName());
copyColumn.setRuntimeType(column.getRuntimeType());
copyColumn.setAutoIncremented(column.isAutoIncremented());
copyColumn.setNullType(column.getNullType());
copy.columns.add(copyColumn);
}
copy.primaryKey = LanguageObject.Util.deepClone(primaryKey, ElementSymbol.class);
copyMetadataState(copy);
copy.setTableMetadata(this.tableMetadata);
copy.on = this.on;
copy.commitAction = this.commitAction;
return copy;
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class Delete method clone.
/**
* Return a copy of this Delete.
*/
public Object clone() {
GroupSymbol copyGroup = null;
if (group != null) {
copyGroup = group.clone();
}
Criteria copyCrit = null;
if (criteria != null) {
copyCrit = (Criteria) criteria.clone();
}
Delete copy = new Delete(copyGroup, copyCrit);
copyMetadataState(copy);
return copy;
}
Aggregations