Check roughly if the provided value is sufficient for the database field
@param req
@param dbField
@returns {*}
165471
function checkIfSentvaluesAreSufficient(req,dbField) {
    if(dbField.Default == 'FILE') {
        //For 'File' fields just return the link ot the file
        if(req.files.hasOwnProperty(dbField.Field)) {

            var file = req.files[dbField.Field].hasOwnProperty('name') ? req.files[dbField.Field] : req.files[dbField.Field][0];

            if(settings.maxFileSize !== -1 && file.size > settings.maxFileSize) {
                return false;
            }

            return file.name;

        } else {
            return false;
        }
    } else {
        if (req.body[dbField.Field] === null || typeof req.body[dbField.Field] == "undefined") {
            return dbField.Null == "YES" ? null : false;
        }
        //Normle Werte
        if((dbField.Type.indexOf("int") != -1 || dbField.Type.indexOf("float") != -1 || dbField.Type.indexOf("double") != -1 )) {
            return !isNaN(req.body[dbField.Field]) ? req.body[dbField.Field] : false;
        } else if(typeof req.body[dbField.Field] === 'string') {
            return escape(req.body[dbField.Field]);
        }
        return false;
    }
}
168874
public final boolean isValid(HttpServletRequest req, String token) {
		String storedToken = getStoredToken(req);
		
		if (storedToken == null)
			return false;
		
		return storedToken.equals(token);
	}
798773
function ( req ) {

    var pk = req.options.id || (req.options.where && req.options.where.id) || req.param('id');

    // TODO: make this smarter...
    // (e.g. look for actual primary key of model and look for it
    //  in the absence of `id`.)
    // See coercePK for reference (although be aware it is not currently in use)

    // exclude criteria on id field
    pk = _.isPlainObject(pk) ? undefined : pk;
    return pk;
  }
812121
function validate(schema) {
        var key, item;
        for (key in schema) {
            if (schema.hasOwnProperty(key)) {
                item = schema[key];
                if (!item.text) {
                    console.error("[PreferenceManager] missing required field: 'text' of '" + key + "'");
                }
                if (!item.type) {
                    console.error("[PreferenceManager] missing required field: 'type' of '" + key + "'");
                }
                if (item.type !== "Section" && typeof item['default'] === "undefined") {
                    console.error("[PreferenceManager] missing required field: 'default' of '" + key + "'");
                }
                if (item.type === "Combo" || item.type === "Dropdown") {
                    if (item.options && item.options.length > 0) {
                        var i, len;
                        for (i = 0, len = item.options.length; i < len; i++) {
                            if (typeof item.options[i].value === "undefined") {
                                console.error("[PreferenceManager] missing required field of option item: 'value' of '" + key + "'");
                            }
                            if (typeof item.options[i].text === "undefined") {
                                console.error("[PreferenceManager] missing required field of option item: 'text' of '" + key + "'");
                            }
                        }
                    } else {
                        console.error("[PreferenceManager] missing required field or no items: 'options' of '" + key + "'");
                    }
                }
            }
        }
        return true;
    }
728756
def _validate_field(param, fields):
    

    if '/' not in param.field and param.field not in fields:
        raise InvalidQueryParams(**{
            'detail': 'The filter query param of "%s" is not possible. The '
                      'resource requested does not have a "%s" field. Please '
                      'modify your request & retry.' % (param, param.field),
            'links': LINK,
            'parameter': PARAM,
        })
1107336
def getResponsePathValueByDBName ( path, dbName)
      @fieldValue = ""
      if path and @responseXMLdoc
         e = @responseXMLdoc.root.elements[ path.to_s ]
      end
      e.each { |e|
         if e and e.is_a?( REXML::Element ) and e.dbinfo.dbname == dbName
            return  e.dbinfo.dbid
         end
      }
      @fieldValue
   end
6132
public boolean checkIndexField(BaseField field)
    {
        for (int iKeySeq = 0; iKeySeq < this.getRecord().getKeyAreaCount(); iKeySeq++)
        {
            KeyArea keyArea = this.getRecord().getKeyArea(iKeySeq);
            if (keyArea.getField(0) == field)
                if (field != this.getRecord().getCounterField())
                    return true;
        }
        return false;
    }
253349
function (req, res) {

            //To avoid errors, escape table
            req.params.table = escape(req.params.table);

            //Get all fields from table
            lastQry = connection.query('SHOW COLUMNS FROM ??', req.params.table, function (err, rows) {
                if (err) return sendError(res, err.code);


                var fields, limit, order, where;


                //All general Settings


                //Select only certain columns?
                if (typeof req.query[settings.paramPrefix + "fields"] !== "undefined" && typeof req.query[settings.paramPrefix + "fields"] == "string" && req.query[settings.paramPrefix + "fields"] !== "") {
                    var req_fields = escape(req.query[settings.paramPrefix + "fields"]);
                    if (checkIfFieldsExist(req_fields, rows)) {
                        fields = req_fields;
                    } else {
                        return sendError(res, "Failed to fetch all fields specified in _fields");
                    }
                } else {
                    fields = '*';
                }

                //Parse order by and order direction
                if (typeof req.query[settings.paramPrefix + "order"] !== "undefined" && typeof req.query[settings.paramPrefix + "order"] === "object") {
                    var orderObj = req.query[settings.paramPrefix + "order"];
                    var orderArr = [];
                    for (var order_field in orderObj) {
                        if (orderObj.hasOwnProperty(order_field)) {
                            if (checkIfFieldsExist(order_field, rows)) {
                                if (orderObj[order_field].toUpperCase() == "ASC" || orderObj[order_field].toUpperCase() == "DESC") {
                                    orderArr.push(req.params.table + ".`" + order_field + "` " + orderObj[order_field].toUpperCase());
                                } else {
                                    return sendError(res, "Order option for " + order_field + " in _order is invalid. Please use either ASC or DESC");
                                }
                            } else {
                                return sendError(res, "Failed to fetch " + order_field + " specified in _order");
                            }
                        }
                    }
                    order = orderArr.join(',');
                }

                //Parse limit
                if (typeof req.query[settings.paramPrefix + "limit"] !== "undefined" && typeof req.query[settings.paramPrefix + "limit"] === "string" && req.query[settings.paramPrefix + "limit"] !== "") {

                    var limitStr = req.query[settings.paramPrefix + "limit"];


                    var limitArr = limitStr.split(',');
                    if (limitArr.length > 2) {
                        return sendError(res, "Limit specificed in _limit is invalid. Limit does not allow more than 2 comma separated values");
                    }
                    for (var i = 0; i < limitArr.length; i++) {
                        var lim = parseInt(limitArr[i]);
                        if (isNaN(lim)) {
                            return sendError(res, "Limit specificed in _limit is invalid. Please use a comma to separate start and amount");
                        }
                        limitArr[i] = lim;
                    }

                    limit = limitArr.join(',');

                }


                //Parse all other get params as selector
                var whereArr = [];

                for (var q in req.query) {
                    if (req.query.hasOwnProperty(q)) {
                        if (q.substr(0, 1) !== settings.paramPrefix) {
                            if (checkIfFieldsExist(q, rows)) {

                                if (typeof req.query[q] === "string") {
                                    //If it is a simple string, the api assumes = as the operator
                                    whereArr.push(mysql.format('?? = ?', [q, escape(req.query[q])]));

                                } else if (typeof req.query[q] === "object") {

                                    for (var selector in req.query[q]) {
                                        if (req.query[q].hasOwnProperty(selector)) {
                                            var op, val = connection.escape(escape(req.query[q][selector]));
                                            //MYSQLify the operator
                                            switch (selector.toUpperCase()) {
                                                case 'GREAT':
                                                    op = "> ";
                                                    break;
                                                case 'SMALL':
                                                    op = "< ";
                                                    break;
                                                case 'EQGREAT':
                                                    op = '>= ';
                                                    break;
                                                case 'EQSMALL':
                                                    op = '<= ';
                                                    break;
                                                case 'IN':
                                                    op = 'IN (';
                                                    val = escape(req.query[q][selector]).split(',').map(function (item) {
                                                        return connection.escape(item);
                                                    }).join(',') + ')';
                                                    break;
                                                case 'LIKE':
                                                    op = 'LIKE ';                                            
                                                    break;
                                                case 'EQ':
                                                    op = '= ';
                                                    break;
                                                default:
                                                    op = '= ';
                                                    break;
                                            }
                                            whereArr.push(mysql.format('?? ' + op + val, [q]));
                                        }
                                    }

                                } else {
                                    return sendError(res, "Can't read parameter specified for the field " + q + " in the table " + req.params.table);
                                }


                            } else {
                                return sendError(res, "Can't find the field" + q + " in the table " + req.params.table);
                            }
                        }
                    }
                }

                if (whereArr.length > 0) {
                    where = whereArr.join(' AND ')
                }

                //Bring in MYSQL syntax
                fields = fields ? fields : '*';
                order = order ? 'ORDER BY ' + order : '';
                limit = limit ? 'LIMIT ' + limit : '';
                where = where ? 'WHERE ' + where : '';

                //Fire query
                lastQry = connection.query("SELECT " + fields + " FROM ?? " + where + " " + order + " " + limit, [req.params.table], function (err, rows) {
                    if (err) return sendError(res, err.code);
                    res.send({
                        result: 'success',
                        json: rows,
                        table: req.params.table,
                        length: rows.length
                    });
                });
            });
        }
799963
public boolean containsBeforeSchemaOrder(String field) {
    if (schemaOrderIndex == null) {
      return containsFieldName(field);
    }
    for (int i = 0; i < schemaOrderIndex; i++) {
      if (elements.get(i).getName().equals(field)) {
        return true;
      }
    }
    return false;
  }
665743
function mustBeScalar(filter, keyword, field) {
  if (filter[field] instanceof Object || filter[field] === undefined) {
    return Bluebird.reject(new BadRequestError(`"${field}" in "${keyword}" must be either a string, a number, a boolean or null`));
  }

  return Bluebird.resolve();
}
1302172
@Then("^a Mongo dataBase '(.+?)' contains a table '(.+?)' with values:")
    public void assertValuesOfTableMongo(String dataBase, String tableName, DataTable data) {
        commonspec.getMongoDBClient().connectToMongoDBDataBase(dataBase);
        ArrayList<DBObject> result = (ArrayList<DBObject>) commonspec.getMongoDBClient().readFromMongoDBCollection(
                tableName, data);
        DBObjectsAssert.assertThat(result).containedInMongoDBResult(data);

    }
1203056
def is_changed(self, field, from_db=False):
        
        return field in self.changed_fields(from_db=from_db)
474407
function validateDatabaseName(databaseName) {
  if (typeof databaseName !== 'string')
    throw MongoError.create({ message: 'database name must be a string', driver: true });
  if (databaseName.length === 0)
    throw MongoError.create({ message: 'database name cannot be the empty string', driver: true });
  if (databaseName === '$external') return;

  const invalidChars = [' ', '.', '$', '/', '\\'];
  for (let i = 0; i < invalidChars.length; i++) {
    if (databaseName.indexOf(invalidChars[i]) !== -1)
      throw MongoError.create({
        message: "database names cannot contain the character '" + invalidChars[i] + "'",
        driver: true
      });
  }
}
570425
public static String getRetRequiredCheck(String express, Field field) {
        String code = "if (CodedConstant.isNull(" + express + ")) {\n";
        code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"));\n";
        code += "}\n";

        return code;
    }
347282
public static Query is(String field, Object value) {
        return new Query().is(field, value);
    }
764309
function(req, model) {

    var values = req.body.data.attributes || {};

    if (req.allParams()['id']) {
      values[model.primaryKey] = req.allParams()['id'];
    }

    return values;
  }
1125202
function queryDatabase(db, expr) {
  // TODO(benvanik): allow the user to switch zone.
  var zone = db.getZones()[0];

  // If the user provided an expression on the command line, use that.
  if (expr && expr.length) {
    issue(expr);
    return 0;
  }

  var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });
  rl.on('line', function(line) {
    line = line.trim();
    if (line == 'q' || line == 'quit') {
      rl.close();
      return;
    }

    issue(line);

    rl.prompt();
  });
  rl.on('close', function() {
    console.log('');
    db.dispose();
    process.exit(0);
  });
  rl.setPrompt('> ');
  rl.prompt();

  function issue(expr) {
    console.log('Expression: ' + expr);

    var result;
    try {
      result = zone.query(expr);
    } catch (e) {
      console.log(e);
      return;
    }

    var xexpr = result.getCompiledExpression();
    console.log(xexpr.toString());
    console.log('');

    var resultValue = result.getValue();
    if (resultValue instanceof wtf.db.EventIterator) {
      var it = resultValue;
      if (!it.getCount()) {
        console.log('Nothing matched');
      } else {
        console.log('Results: (' + it.getCount() + ' total)');
        for (; !it.done(); it.next()) {
          util.logEvent(it, zone);
        }
      }
    } else if (typeof resultValue == 'boolean' ||
        typeof resultValue == 'number' ||
        typeof resultValue == 'string') {
      console.log('Result:');
      logResult(resultValue);
    } else if (!resultValue) {
      // Note we test this after so that 0/strings/etc are handled.
      console.log('Nothing matched');
    } else if (resultValue.length) {
      console.log('Results: (' + resultValue.length + ' total)');
      for (var n = 0; n < resultValue.length; n++) {
        logResult(resultValue[n]);
      }
    } else {
      console.log('Result:');
      logResult(resultValue);
    }

    console.log('');
    console.log('Took ' + result.getDuration().toFixed(3) + 'ms');
  }
}