Validates the [[db]] attribute.
184512
public function validateDb()
    {
        if (!Yii::$app->has($this->db)) {
            $this->addError('db', 'There is no application component named "db".');
        } elseif (!Yii::$app->get($this->db) instanceof Connection) {
            $this->addError('db', 'The "db" application component must be a DB connection instance.');
        }
    }
593412
void validate() {
        validateCassandraParams();

        if (pageSize <= 0) {
            throw new IllegalArgumentException("pageSize cannot be zero");
        }

        

        validateConsistencyLevels();

        TableMetadata tableMetadata = fetchTableMetadata();

        validateTableMetadata(tableMetadata);
        validateAdditionalFilters(tableMetadata);

        if (!(this.isBisectModeSet && this.isSplitModeSet)) {
            if (this.isBisectModeSet) {
                if (this.bisectFactor != Constants.DEFAULT_BISECT_FACTOR
                        && !this.checkIsPowerOfTwo(this.bisectFactor)) {
                    throw new IllegalArgumentException(
                            "Bisect factor should be greater than zero and a power of 2");
                }
            } else if (this.isSplitModeSet) {
                if (this.splitSize <= 0) {
                    throw new IllegalArgumentException(
                            "The split size must be a positve integer");
                }
            } else {
                throw new IllegalArgumentException(
                        "One split mode must be defined, please choose between Split or Bisect");
            }
        } else {
            throw new IllegalArgumentException(
                    "Only one split mode can be defined, please choose between Split or Bisect");
        }
    }
311567
def validate(self):
        
        log.info("{}\nValidating against {}"
                 .format("-" * 100, self.schema_def.__class__.__name__))

        if not self.schema_def:
            raise ValueError("No schema definition supplied.")

        self.checked_attributes = []

        # TODO - this should maybe choose the actually used namespace, not just
        # the first one in the list
        result = ValidationResult(self.allowed_namespaces[0],
                                  self.schema_def.__class__.__name__)
        for subject, predicate, object_ in self.graph:
            log.info("\nsubj: {subj}\npred: {pred}\n obj: {obj}"
                     .format(subj=subject, pred=predicate,
                             obj=object_.encode('utf-8')))
            result.add_error(self._check_triple((subject, predicate, object_)))
        return result
991568
def validate(self):
        """"""
        try:
            # update _resource to have default values from the schema
            self._resource = self.schema(self._resource)
        except MultipleInvalid as e:
            errors = [format_error(err, self.resource_type) for err in e.errors]
            raise exceptions.ValidationError({'errors': errors})

        yield self.check_unique()
827514
def _checkAttribs(self, strict):
        """"""
        if self.min:
            warning("Minimum value not allowed for boolean-type parameter " +
                    self.name, strict)
            self.min = None
        if self.max:
            if not self.prompt:
                warning("Maximum value not allowed for boolean-type parameter " +
                                self.name + " (probably missing comma)",
                                strict)
                # try to recover by assuming max string is prompt
                self.prompt = self.max
            else:
                warning("Maximum value not allowed for boolean-type parameter " +
                        self.name, strict)
            self.max = None
        if self.choice:
            warning("Choice values not allowed for boolean-type parameter " +
                    self.name, strict)
            self.choice = None
893627
private void validate() {

        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("database cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }

        concantHostPort();
    }
640967
private void validateEntity(final DbEntity entity) throws DatabaseEngineException {
        if (entity.getName() == null || entity.getName().length() == 0) {
            throw new DatabaseEngineException("You have to define the entity name");
        }

        final int maxIdentSize = properties.getMaxIdentifierSize();
        if (entity.getName().length() > maxIdentSize) {
            throw new DatabaseEngineException(String.format("Entity '%s' exceeds the maximum number of characters (%d)", entity.getName(), maxIdentSize));
        }

        if (entity.getColumns().isEmpty()) {
            throw new DatabaseEngineException("You have to specify at least one column");
        }

        int numberOfAutoIncs = 0;
        for (DbColumn c : entity.getColumns()) {
            if (c.getName() == null || c.getName().length() == 0) {
                throw new DatabaseEngineException(String.format("Column in entity '%s' must have a name", entity.getName()));
            }

            if (c.getName().length() > maxIdentSize) {
                throw new DatabaseEngineException(String.format("Column '%s' in entity '%s' exceeds the maximum number of characters (%d)", c.getName(), entity.getName(), maxIdentSize));
            }

            if (c.isAutoInc()) {
                numberOfAutoIncs++;
            }
        }

        if (numberOfAutoIncs > 1) {
            throw new DatabaseEngineException("You can only define one auto incremented column");
        }

        // Index validation

        List<DbIndex> indexes = entity.getIndexes();
        if (!indexes.isEmpty()) {
            for (DbIndex index : indexes) {
                if (index.getColumns().isEmpty()) {
                    throw new DatabaseEngineException(String.format("You have to specify at least one column to create an index in entity '%s'", entity.getName()));
                }

                for (String column : index.getColumns()) {
                    if (column == null || column.length() == 0) {
                        throw new DatabaseEngineException(String.format("Column indexes must have a name in entity '%s'", entity.getName()));
                    }
                }
            }
        }

        // FK validation

        List<DbFk> fks = entity.getFks();
        if (!fks.isEmpty()) {
            for (DbFk fk : fks) {
                if (fk.getForeignTable() == null || fk.getForeignTable().length() == 0) {
                    throw new DatabaseEngineException(String.format("You have to specify the table when creating a Foreign Key in entity '%s'", entity.getName()));
                }

                if (fk.getLocalColumns().isEmpty()) {
                    throw new DatabaseEngineException(String.format("You must specify at least one local column when defining a Foreign Key in '%s'", entity.getName()));
                }

                if (fk.getForeignColumns().isEmpty()) {
                    throw new DatabaseEngineException(String.format("You must specify at least one foreign column when defining a Foreign Key in '%s'", entity.getName()));
                }

                if (fk.getLocalColumns().size() != fk.getForeignColumns().size()) {
                    throw new DatabaseEngineException(String.format("Number of local columns does not match foreign ones in entity '%s'", entity.getName()));
                }
            }
        }
    }
1309397
def validate_value(self, value):
        """"""
        super(ValuesListField, self).validate_value(value)

        if value is not None:
            if value not in self.selection_to_id_map:
                raise ValidationError(
                    self.record,
                    'Field "{}" invalid value "{}". Valid options: {}'.format(
                        self.name,
                        value,
                        ', '.join(self.selection_to_id_map.keys())
                    )
                )
1038968
protected void validate(List<TableInfo> tableInfos)
    {
        db = mongo.getDB(databaseName);
        if (db == null)
        {
            logger.error("Database " + databaseName + "does not exist");
            throw new SchemaGenerationException("database " + databaseName + "does not exist", "mongoDb", databaseName);
        }
        else
        {
            for (TableInfo tableInfo : tableInfos)
            {
                if (tableInfo.getLobColumnInfo().isEmpty())
                {
                    if (!db.collectionExists(tableInfo.getTableName()))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }
                }
                else
                {
                    checkMultipleLobs(tableInfo);
                    if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.FILES))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + MongoDBUtils.FILES
                                + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }
                    if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.CHUNKS))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + MongoDBUtils.CHUNKS
                                + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }

                }
            }
        }
    }
1225967
def validate(self):
        
        try:
            Configuration(**self.serialize())
        except ValidationException as e:
            raise DbtProjectError(str(e))

        if getattr(self.args, 'version_check', False):
            self.validate_version()
551506
def validate(mcs, bases, attributes):
        """"""
        if bases[0] is object:
            return None
        mcs.check_model_cls(attributes)
        mcs.check_include_exclude(attributes)
        mcs.check_properties(attributes)
970483
def validate_item(db, item)
      unless File.exist?("data_bags/#{db}/#{item}.json")
        STDERR.puts "ERROR: data bag '#{db}' item '#{item}' file 'data_bags/#{db}/#{item}.json' does not exist"
        exit(-1)
      end
      f = File.read("data_bags/#{db}/#{item}.json")
      begin
        itemfile = JSON.parse(f)
      rescue JSON::ParserError => e # invalid JSON
        STDERR.puts "ERROR: data bag '#{db} item '#{item}' has JSON errors."
        STDERR.puts e.message
        exit(-1)
      end
      # validate the id matches the file name
      item = item.split("/").last if item =~ /\// # pull out directories

      return if item.eql?(itemfile["id"])

      STDERR.puts "ERROR: data bag '#{db}' item '#{item}' listed in the manifest does not match the id '#{itemfile['id']}' within the 'data_bags/#{db}/#{item}.json' file."
      exit(-1)
    end
1165572
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var index = parseInt(args[0]);
  if(isNaN(index) || index < 0 || index >= info.conf.databases) {
    throw DatabaseIndex;
  }
  // update the index with the integer value
  // connection expects an integer
  args[0] = index;
}
812504
def validate_each(record, attribute, value)
      unless value.blank?
        record.errors[attribute] << (options[:message] || 'is not a valid email address') unless value =~ VALID_EMAIL_REGEX
      end
    end
1246312
protected function validate()
    {
        foreach ($this->_requiredAttr as $attr) {
            if (is_array($attr)) {
                $valid = false;
                foreach ($attr as $sub) {
                    if (!is_null($this->$sub)) {
                        $valid = true;
                        break;
                    }
                }
                if (!$valid) {
                    return false;
                }
            } elseif (is_null($this->$attr)) {
                return false;
            }
        }
        return true;
    }
355311
def is_valid(self, instance):
        ''''''
        dbdata = instance.dbdata
        data = dbdata['cleaned_data'] = {}
        errors = dbdata['errors'] = {}
        #Loop over scalar fields first
        for field, value in instance.fieldvalue_pairs():
            name = field.attname
            try:
                svalue = field.set_get_value(instance, value)
            except Exception as e:
                errors[name] = str(e)
            else:
                if (svalue is None or svalue is '') and field.required:
                    errors[name] = ("Field '{0}' is required for '{1}'."
                                    .format(name, self))
                else:
                    if isinstance(svalue, dict):
                        data.update(svalue)
                    elif svalue is not None:
                        data[name] = svalue
        return len(errors) == 0
520567
def _validate(self):
        
        probably_good_to_go = True
        sheet = self.table
        identity = self.db_sheet_cols.id

        # check if you have unique srnos
        id_col = sheet.loc[:, identity]
        if any(id_col.duplicated()):
            warnings.warn(
                "your database is corrupt: duplicates"
                " encountered in the srno-column")
            logger.debug("srno duplicates:\n" + str(
                id_col.duplicated()))
            probably_good_to_go = False
        return probably_good_to_go