Search in sources :

Example 1 with ProcedureContainer

use of org.teiid.query.sql.lang.ProcedureContainer in project teiid by teiid.

the class ProcedureContainerResolver method resolveCommand.

/**
 * @see org.teiid.query.resolver.CommandResolver#resolveCommand(org.teiid.query.sql.lang.Command, org.teiid.query.metadata.TempMetadataAdapter, boolean)
 */
public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals) throws QueryMetadataException, QueryResolverException, TeiidComponentException {
    ProcedureContainer procCommand = (ProcedureContainer) command;
    resolveGroup(metadata, procCommand);
    resolveProceduralCommand(procCommand, metadata);
// getPlan(metadata, procCommand);
}
Also used : ProcedureContainer(org.teiid.query.sql.lang.ProcedureContainer)

Example 2 with ProcedureContainer

use of org.teiid.query.sql.lang.ProcedureContainer in project teiid by teiid.

the class DataTierTupleSource method checkForUpdates.

private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) {
    if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) {
        return;
    }
    ProcedureContainer pc = (ProcedureContainer) command;
    GroupSymbol gs = pc.getGroup();
    Integer zero = Integer.valueOf(0);
    if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) {
        return;
    }
    Object metadataId = gs.getMetadataID();
    if (metadataId == null) {
        return;
    }
    if (!(metadataId instanceof Table)) {
        if (metadataId instanceof TempMetadataID) {
            TempMetadataID tid = (TempMetadataID) metadataId;
            if (tid.getTableData().getModel() != null) {
                tid.getTableData().dataModified((Integer) results.getResults()[commandIndex].get(0));
            }
        }
        return;
    }
    Table t = (Table) metadataId;
    t.setLastDataModification(ts);
    if (distributor != null) {
        distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName());
    }
}
Also used : Table(org.teiid.metadata.Table) ProcedureContainer(org.teiid.query.sql.lang.ProcedureContainer) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) TempMetadataID(org.teiid.query.metadata.TempMetadataID)

Example 3 with ProcedureContainer

use of org.teiid.query.sql.lang.ProcedureContainer in project teiid by teiid.

the class TestProcedureResolving method resolveProcedure.

private Command resolveProcedure(String userUpdateStr, QueryMetadataInterface metadata) throws QueryParserException, QueryResolverException, TeiidComponentException, QueryMetadataException {
    ProcedureContainer userCommand = (ProcedureContainer) QueryParser.getQueryParser().parseCommand(userUpdateStr);
    QueryResolver.resolveCommand(userCommand, metadata);
    metadata = new TempMetadataAdapter(metadata, userCommand.getTemporaryMetadata());
    return QueryResolver.expandCommand(userCommand, metadata, null);
}
Also used : TempMetadataAdapter(org.teiid.query.metadata.TempMetadataAdapter) ProcedureContainer(org.teiid.query.sql.lang.ProcedureContainer)

Example 4 with ProcedureContainer

use of org.teiid.query.sql.lang.ProcedureContainer in project teiid by teiid.

the class TestValidator method validateProcedure.

private void validateProcedure(String userUpdateStr, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException, QueryValidatorException {
    ProcedureContainer command = (ProcedureContainer) helpResolve(userUpdateStr, metadata);
    Command proc = QueryResolver.expandCommand(command, metadata, AnalysisRecord.createNonRecordingRecord());
    ValidatorReport report = Validator.validate(proc, metadata);
    if (report.hasItems()) {
        throw new QueryValidatorException(report.getFailureMessage());
    }
    report = Validator.validate(command, metadata);
    if (report.hasItems()) {
        throw new QueryValidatorException(report.getFailureMessage());
    }
}
Also used : Command(org.teiid.query.sql.lang.Command) QueryValidatorException(org.teiid.api.exception.query.QueryValidatorException) ProcedureContainer(org.teiid.query.sql.lang.ProcedureContainer)

Aggregations

ProcedureContainer (org.teiid.query.sql.lang.ProcedureContainer)4 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)1 Table (org.teiid.metadata.Table)1 TempMetadataAdapter (org.teiid.query.metadata.TempMetadataAdapter)1 TempMetadataID (org.teiid.query.metadata.TempMetadataID)1 Command (org.teiid.query.sql.lang.Command)1 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)1