public void setProcedureDefinition(final String procedureName, final String definition, boolean updateFunctional) { if (!assertInEditMode(Mode.SCHEMA)) { return; } Procedure procedure = verifyProcedureExists(procedureName); assertGrant(Grant.Permission.Privilege.CREATE, Database.ResourceType.PROCEDURE, procedure); procedure.setQueryPlan(definition); }
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public void setProcedureDefinition(final String procedureName, final String definition) { if (!assertInEditMode(Mode.SCHEMA)) { return; } Procedure procedure = (Procedure)getSchemaRecord(procedureName, ResourceType.PROCEDURE); assertGrant(Grant.Permission.Privilege.ALTER, Database.ResourceType.PROCEDURE, procedure); if (!procedure.isVirtual()) { throw new org.teiid.metadata.MetadataException(QueryPlugin.Event.TEIID31238, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31238, procedure.getFullName())); } procedure.setQueryPlan(definition); }
public void setProcedureDefinition(final String procedureName, final String definition) { if (!assertInEditMode(Mode.SCHEMA)) { return; } Procedure procedure = (Procedure)getSchemaRecord(procedureName, ResourceType.PROCEDURE); assertGrant(Grant.Permission.Privilege.ALTER, Database.ResourceType.PROCEDURE, procedure); if (!procedure.isVirtual()) { throw new org.teiid.metadata.MetadataException(QueryPlugin.Event.TEIID31238, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31238, procedure.getFullName())); } procedure.setQueryPlan(definition); }
/** * Create virtual sotred procedure. * @param name Name of stored query, must match model name * @param model Metadata object for the model * @param params List of FakeMetadataObject that are the parameters for the procedure * @param queryPlan Object representing query plan * @return Metadata object for stored procedure */ public static Procedure createVirtualProcedure(String name, Schema model, List<ProcedureParameter> params, QueryNode queryPlan) { Procedure proc = createStoredProcedure(name, model, params); proc.setVirtual(true); proc.setQueryPlan(queryPlan.getQuery()); return proc; }
String proc = this.getProcedureDefinition(vdbName, vdbVersion, p); if (proc != null) { p.setQueryPlan(proc);
TransformationRecordImpl transformRecord = (TransformationRecordImpl)getRecordByType(procedureRecord.getUUID(), MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false); if(transformRecord != null) { procedureRecord.setQueryPlan(transformRecord.getTransformation());
TransformationRecordImpl transformRecord = (TransformationRecordImpl)getRecordByType(procedureRecord.getUUID(), MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false); if(transformRecord != null) { procedureRecord.setQueryPlan(transformRecord.getTransformation());
{if (true) throw new MetadataException(QueryPlugin.Util.getString("SQLParser.function_def", procName));} proc.setQueryPlan((comment != null?comment.image+" ":"") + stmt.toString());
{if (true) throw new MetadataException(QueryPlugin.Util.getString("SQLParser.function_def", procName));} proc.setQueryPlan((comment != null?comment.image+" ":"") + stmt.toString());
{if (true) throw new MetadataException(QueryPlugin.Util.getString("SQLParser.function_def", procName));} proc.setQueryPlan((comment != null?comment.image+" ":"") + stmt.toString());