use of org.teiid.query.sql.lang.Command in project teiid by teiid.
the class TestValidator method testInsert5.
// non-null, no-default elements left
@Test
public void testInsert5() throws Exception {
QueryMetadataInterface metadata = exampleMetadata1();
// $NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group (e1, e2) VALUES ('x', 'y')");
QueryResolver.resolveCommand(command, metadata);
// $NON-NLS-1$
helpRunValidator(command, new String[] { "test.\"group\".e0" }, metadata);
}
use of org.teiid.query.sql.lang.Command in project teiid by teiid.
the class TestValidator method testCreateWithNonSortablePrimaryKey.
@Test
public void testCreateWithNonSortablePrimaryKey() {
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// $NON-NLS-1$
Command command = helpResolve("create local temporary table x (column1 string, column2 clob, primary key (column2))", metadata);
helpRunValidator(command, new String[] { "column2" }, RealMetadataFactory.example1Cached());
}
use of org.teiid.query.sql.lang.Command in project teiid by teiid.
the class TestValidator method testValidateInModeler.
@Test
public void testValidateInModeler() throws Exception {
// SQL is same as pm1.vsp36() in example1
// $NON-NLS-1$
String sql = "CREATE VIRTUAL PROCEDURE BEGIN select 1, 2; END";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
Command command = QueryParser.getQueryParser().parseCommand(sql);
GroupSymbol group = new GroupSymbol("pm1.vsp36");
QueryResolver.resolveCommand(command, group, Command.TYPE_STORED_PROCEDURE, metadata, true);
assertEquals(2, command.getResultSetColumns().size());
}
use of org.teiid.query.sql.lang.Command in project teiid by teiid.
the class TestValidator method testDefect9917.
@Test
public void testDefect9917() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// $NON-NLS-1$
String sql = "SELECT lookup('pm1.g1', 'e1a', 'e2', e2) AS x, lookup('pm1.g1', 'e4', 'e3', e3) AS y FROM pm1.g1";
Command command = new QueryParser().parseCommand(sql);
try {
QueryResolver.resolveCommand(command, metadata);
// $NON-NLS-1$
fail("Did not get exception");
} catch (QueryResolverException e) {
// expected
}
// $NON-NLS-1$
sql = "SELECT lookup('pm1.g1a', 'e1', 'e2', e2) AS x, lookup('pm1.g1', 'e4', 'e3', e3) AS y FROM pm1.g1";
command = new QueryParser().parseCommand(sql);
try {
QueryResolver.resolveCommand(command, metadata);
// $NON-NLS-1$
fail("Did not get exception");
} catch (QueryResolverException e) {
// expected
}
}
use of org.teiid.query.sql.lang.Command in project teiid by teiid.
the class TestValidator method testValidateInsertElements2.
@Test
public void testValidateInsertElements2() throws Exception {
QueryMetadataInterface metadata = exampleMetadata();
// $NON-NLS-1$
Command command = QueryParser.getQueryParser().parseCommand("INSERT INTO test.group2 (e1) VALUES ('y')");
QueryResolver.resolveCommand(command, metadata);
helpRunValidator(command, new String[] {}, metadata);
}
Aggregations