@Override public void validate(Object value) throws QueryValidatorException { if (value == null || ((Integer)value).intValue() < 0) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30242, QueryPlugin.Util.getString(msgKey)); } } }
public void visit(AlterView obj) { try { QueryResolver.validateProjectedSymbols(obj.getTarget(), getMetadata(), obj.getDefinition()); Validator.validate(obj.getDefinition(), getMetadata(), this); validateAlterTarget(obj); } catch (QueryValidatorException e) { handleValidationError(e.getMessage(), obj.getDefinition()); } catch (TeiidComponentException e) { handleException(e); } }
public void visit(AlterView obj) { try { QueryResolver.validateProjectedSymbols(obj.getTarget(), getMetadata(), obj.getDefinition()); Validator.validate(obj.getDefinition(), getMetadata(), this); validateAlterTarget(obj); } catch (QueryValidatorException e) { handleValidationError(e.getMessage(), obj.getDefinition()); } catch (TeiidComponentException e) { handleException(e); } }
static void referenceCheck(List<Reference> references) throws QueryValidatorException { if (references != null && !references.isEmpty()) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30491, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30491)); } }
public void visit(AlterView obj) { try { QueryResolver.validateProjectedSymbols(obj.getTarget(), getMetadata(), obj.getDefinition()); Validator.validate(obj.getDefinition(), getMetadata(), this); validateAlterTarget(obj); } catch (QueryValidatorException e) { handleValidationError(e.getMessage(), obj.getDefinition()); } catch (TeiidComponentException e) { handleException(e); } }
@Override public void validate(Object value) throws QueryValidatorException { if (value == null || ((Integer)value).intValue() < 0) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30242, QueryPlugin.Util.getString(msgKey)); } } }
@Override public void visit(CommandStatement obj) { if (this.createProc == null || this.createProc.getResultSetColumns().isEmpty() || !obj.isReturnable() || !obj.getCommand().returnsResultSet()) { return; } List<? extends Expression> symbols = obj.getCommand().getResultSetColumns(); if (symbols == null && obj.getCommand() instanceof DynamicCommand) { DynamicCommand cmd = (DynamicCommand)obj.getCommand(); cmd.setAsColumns(this.createProc.getResultSetColumns()); return; } try { QueryResolver.validateProjectedSymbols(createProc.getVirtualGroup(), createProc.getResultSetColumns(), symbols); } catch (QueryValidatorException e) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31121, createProc.getVirtualGroup(), obj, e.getMessage()), obj); } }
static void referenceCheck(List<Reference> references) throws QueryValidatorException { if (references != null && !references.isEmpty()) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30491, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30491)); } }
@Override public void visit(CommandStatement obj) { if (this.createProc == null || this.createProc.getResultSetColumns().isEmpty() || !obj.isReturnable() || !obj.getCommand().returnsResultSet()) { return; } List<? extends Expression> symbols = obj.getCommand().getResultSetColumns(); if (symbols == null && obj.getCommand() instanceof DynamicCommand) { DynamicCommand cmd = (DynamicCommand)obj.getCommand(); cmd.setAsColumns(this.createProc.getResultSetColumns()); return; } try { QueryResolver.validateProjectedSymbols(createProc.getVirtualGroup(), createProc.getResultSetColumns(), symbols); } catch (QueryValidatorException e) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31121, createProc.getVirtualGroup(), obj, e.getMessage()), obj); } }
static void referenceCheck(List<Reference> references) throws QueryValidatorException { if (references != null && !references.isEmpty()) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30491, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30491)); } }
@Override public void visit(CommandStatement obj) { if (this.createProc == null || this.createProc.getResultSetColumns().isEmpty() || !obj.isReturnable() || !obj.getCommand().returnsResultSet()) { return; } List<? extends Expression> symbols = obj.getCommand().getResultSetColumns(); if (symbols == null && obj.getCommand() instanceof DynamicCommand) { DynamicCommand cmd = (DynamicCommand)obj.getCommand(); cmd.setAsColumns(this.createProc.getResultSetColumns()); return; } try { QueryResolver.validateProjectedSymbols(createProc.getVirtualGroup(), createProc.getResultSetColumns(), symbols); } catch (QueryValidatorException e) { handleValidationError(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31121, createProc.getVirtualGroup(), obj, e.getMessage()), obj); } }
@Override public void validate(Object value) throws QueryValidatorException { if (value == null || ((Integer)value).intValue() < 0) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30242, QueryPlugin.Util.getString(msgKey)); } } }
handleValidationError(e.getMessage(), obj);
public static void validateWithVisitor( AbstractValidationVisitor visitor, QueryMetadataInterface metadata, Command command) throws QueryValidatorException, TeiidComponentException { // Validate with visitor ValidatorReport report = Validator.validate(command, metadata, visitor); if (report.hasItems()) { ValidatorFailure firstFailure = report.getItems().iterator().next(); throw new QueryValidatorException(QueryPlugin.Event.TEIID30492, firstFailure.getMessage()); } }
handleValidationError(e.getMessage(), obj);
public static void validateWithVisitor( AbstractValidationVisitor visitor, QueryMetadataInterface metadata, Command command) throws QueryValidatorException, TeiidComponentException { // Validate with visitor ValidatorReport report = Validator.validate(command, metadata, visitor); if (report.hasItems()) { ValidatorFailure firstFailure = report.getItems().iterator().next(); throw new QueryValidatorException(QueryPlugin.Event.TEIID30492, firstFailure.getMessage()); } }
handleValidationError(e.getMessage(), obj);
public static void validateWithVisitor( AbstractValidationVisitor visitor, QueryMetadataInterface metadata, Command command) throws QueryValidatorException, TeiidComponentException { // Validate with visitor ValidatorReport report = Validator.validate(command, metadata, visitor); if (report.hasItems()) { ValidatorFailure firstFailure = report.getItems().iterator().next(); throw new QueryValidatorException(QueryPlugin.Event.TEIID30492, firstFailure.getMessage()); } }
/** * Case 6395 - This test case will now raise a QueryPlannerException. param2 is required * and not nullable. This case is expected to fail because of 'param2 is null' */ @Test public void testProcAsVirtualGroup2WithNull() throws Exception { String sql = "select e1 from (SELECT * FROM pm1.vsp26 as P where P.e1='a') x where param1=1 and param2 is null"; //$NON-NLS-1$ // Create expected results List<?>[] expected = new List[] { }; // Construct data manager with data FakeDataManager dataManager = new FakeDataManager(); TestProcessor.sampleData1(dataManager); // Plan query try { ProcessorPlan plan = TestProcessor.helpGetPlan(sql, RealMetadataFactory.example1Cached()); // Run query TestProcessor.doProcess(plan, dataManager, expected, TestProcessor.createCommandContext()); fail("QueryPlannerException was expected."); //$NON-NLS-1$ } catch (QueryValidatorException e) { assertEquals("TEIID30164 The procedure parameter pm1.vsp26.param2 is not nullable, but is set to null.",e.getMessage()); //$NON-NLS-1$ } }
public static void validateProjectedSymbols(GroupSymbol virtualGroup, List<? extends Expression> symbols, List<? extends Expression> projectedSymbols) throws QueryValidatorException { if (symbols.size() != projectedSymbols.size()) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30066, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30066, virtualGroup, symbols.size(), projectedSymbols.size())); } for (int i = 0; i < projectedSymbols.size(); i++) { Expression projectedSymbol = projectedSymbols.get(i); ResolverUtil.setTypeIfNull(projectedSymbol, symbols.get(i).getType()); if (projectedSymbol.getType() != symbols.get(i).getType()) { throw new QueryValidatorException(QueryPlugin.Util.getString("QueryResolver.wrong_view_symbol_type", virtualGroup, i+1, //$NON-NLS-1$ DataTypeManager.getDataTypeName(symbols.get(i).getType()), DataTypeManager.getDataTypeName(projectedSymbol.getType()))); } } }