Validates that a query can deliver the modality it promises. Only called
on the top-most SELECT or set operator in the tree.
768077
private void validateModality(SqlNode query) {
		final SqlModality modality = deduceModality(query);
		if (query instanceof SqlSelect) {
			final SqlSelect select = (SqlSelect) query;
			validateModality(select, modality, true);
		} else if (query.getKind() == SqlKind.VALUES) {
			switch (modality) {
				case STREAM:
					throw newValidationError(query, Static.RESOURCE.cannotStreamValues());
			}
		} else {
			assert query.isA(SqlKind.SET_QUERY);
			final SqlCall call = (SqlCall) query;
			for (SqlNode operand : call.getOperandList()) {
				if (deduceModality(operand) != modality) {
					throw newValidationError(operand,
						Static.RESOURCE.streamSetOpInconsistentInputs());
				}
				validateModality(operand);
			}
		}
	}
699972
def query(self, force=False):
        """"""
        if not self.is_valid():
            raise forms.ValidationError(self.errors)
        if force:
            self._is_selected = False
        if not self._is_selected:
            if self.queryset is None:
                raise TypeError('Must be QuerySet not %s' %
                                type(self.queryset))
            self.select()
            self._is_selected = True
        return self.queryset
477287
def validate_db(sqlalchemy_bind, is_enabled=ENABLE_DB):
    
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            def is_db_responsive():
                try:
                    sqlalchemy_bind.session.query('1').first_or_404()
                except:
                    return False
                else:
                    return True
            if is_enabled and is_db_responsive():
                return func(*args, **kwargs)
            else:
                abort(HTTP_CODES.UNAUTHORIZED)
        return wrapper
    return decorator
991819
def valid?(value)
      # we also allow nil values, which do not have to be verified.
      return true if value.nil?

      # Verify that value is the type that we're expecting, if we are expecting a type
      if data_type == Fastlane::Boolean
        ensure_boolean_type_passes_validation(value)
      else
        ensure_generic_type_passes_validation(value)
      end

      if @verify_block
        begin
          @verify_block.call(value)
        rescue => ex
          UI.error("Error setting value '#{value}' for option '#{@key}'")
          raise Interface::FastlaneError.new, ex.to_s
        end
      end

      true
    end
912760
function validateQueryParams() {
        var queryString;
        if (config.queryParams) {
            if (typeof config.queryParams === 'string') {
                // strip '?' if it's there, because we add it below
                queryString = config.queryParams.replace(/^\?/, '');
            } else {
                queryString = util.param(config.queryParams);
            }
        }
        config.queryString = queryString ? '?' + queryString : '';
    }
463842
boolean isAggregatedQuery()
    {
        if (kunderaQuery.getSelectStatement() != null)
        {
            Expression exp = ((SelectClause) kunderaQuery.getSelectStatement().getSelectClause()).getSelectExpression();
            return AggregateFunction.class.isAssignableFrom(exp.getClass());
        }
        else
        {
            return false;
        }
    }
1112167
def validate_query(query):
        
        tokens = _quote_re.findall(query)
        for token in tokens:
            if token.startswith('"') and token.endswith('"'):
                continue
            if set(token) & _invalid_ascii:
                return False
        return True
185350
@SuppressWarnings("unchecked")
    private static void validateSelector(Map<String, Object> selector) throws QueryException {
        String topLevelOp = (String) selector.keySet().toArray()[0];

        // top level op can only be $and or $or after normalisation
        if (topLevelOp.equals(AND) || topLevelOp.equals(OR)) {
            Object topLevelArg = selector.get(topLevelOp);
            if (topLevelArg instanceof List) {
                // safe we know its a List
                validateCompoundOperatorClauses((List<Object>) topLevelArg,
                                                       new Boolean[]{ false });
            }
        }
    }
235274
def _check_query(self, query, style_cols=None):
        """"""
        try:
            self.sql_client.send(
                utils.minify_sql((
                    'EXPLAIN',
                    'SELECT',
                    '  {style_cols}{comma}',
                    '  the_geom, the_geom_webmercator',
                    'FROM ({query}) _wrap;',
                )).format(query=query,
                          comma=',' if style_cols else '',
                          style_cols=(','.join(style_cols)
                                      if style_cols else '')),
                do_post=False)
        except Exception as err:
            raise ValueError(('Layer query `{query}` and/or style column(s) '
                              '{cols} are not valid: {err}.'
                              '').format(query=query,
                                         cols=', '.join(['`{}`'.format(c)
                                                         for c in style_cols]),
                                         err=err))
352425
def validate_ok_for_update(update):
    """"""
    validate_is_mapping("update", update)
    # Update can not be {}
    if not update:
        raise ValueError('update only works with $ operators')
    first = next(iter(update))
    if not first.startswith('$'):
        raise ValueError('update only works with $ operators')
394062
public static boolean isValidProcedureCall(String sql, Dialect dialect) {
		if (sql == null) {
			return false;
		}
		if (dialect instanceof OracleDialect) {
			return sql.split("\\?").length == 2;
		} else {
			return true;
		}
	}
1057456
def validate(self, value):
        
        super(ChoicesField, self).validate(value)
        if value and not self.valid_value(value):
            self._on_invalid_value(value)
1313425
public static boolean validate(Statement stmt) {
    try {
      Connection conn = stmt.getConnection();
      if (conn == null)
        return false;

      if (!conn.isClosed() && conn.isValid(10))
        return true;

      stmt.close();
      conn.close();
    } catch (SQLException e) {
      // this may well fail. that doesn't matter. we're just making an
      // attempt to clean up, and if we can't, that's just too bad.
    }
    return false;
  }
33166
function cacheValid () {
    // false if cache result is null
    if (this.cached === null) {
        debug('view:select:collection:cacheValid:false:null', this.selectCacheKey)
        return false
    }
    // false if n does not match
    if (this.cached.n !== this.initialMaxRecordNumber) {
        debug('view:select:collection:cacheValid:false:maxRecordNumber', this.selectCacheKey)
        return false
    }
    // cache is valid
    debug('view:select:collection:cacheValid:true', this.selectCacheKey)
    return true
}
226948
def _validate(self, val):
        
        if self.allow_None and val is None:
            return
        super(Range, self)._validate(val)

        self._checkBounds(val)
1107514
@Deprecated
    public C expectAtMost(int allowedStatements, Query query) {
        return expect(SqlQueries.maxQueries(allowedStatements).type(adapter(query)));
    }
37703
private void validateQuery(Query query) throws IllegalArgumentException {
    if (query.getKindCount() != 1) {
      throw new IllegalArgumentException("Query must have exactly one kind.");
    }
    if (query.getOrderCount() != 0) {
      throw new IllegalArgumentException("Query cannot have any sort orders.");
    }
    if (query.hasFilter()) {
      validateFilter(query.getFilter());
    }
  }