Encode a field name. If the field reprents a compound type then $key
should be passed to represent the key for the value of the compound
field.
507996
public function encode(string $fieldName, string $key = null): string
    {
        $propertyName = sprintf(
            '%s:%s',
            $this->prefix,
            $fieldName
        );

        if (null !== $key) {
            $propertyName .= '-' . $key;
        }


        return $propertyName;
    }
1238656
def try_encode(field_encoders, entity_dict):
        
        result = ''
        for field_encoder in field_encoders:
            try:
                result += field_encoder.encode(entity_dict)
            except KeyError as e:
                return False
        return result
1273848
def inq_compound_field(self, name, index):
        
        typename = create_string_buffer(name)
        index = c_int(index + 1)
        fieldname = create_string_buffer(MAXSTRLEN)
        fieldtype = create_string_buffer(MAXSTRLEN)
        rank = c_int()
        arraytype = ndpointer(dtype='int32',
                              ndim=1,
                              shape=(MAXDIMS, ),
                              flags='F')
        shape = np.empty((MAXDIMS, ), dtype='int32', order='F')
        self.library.inq_compound_field.argtypes = [c_char_p,
                                                    POINTER(c_int),
                                                    c_char_p,
                                                    c_char_p,
                                                    POINTER(c_int),
                                                    arraytype]
        self.library.inq_compound_field.restype = None
        self.library.inq_compound_field(typename,
                                        byref(index),
                                        fieldname,
                                        fieldtype,
                                        byref(rank),
                                        shape)
        return (fieldname.value,
                fieldtype.value,
                rank.value,
                tuple(shape[:rank.value]))
951396
function encodeParams(params) {
    var queryString;
    if (params && Object.keys(params)) {
        queryString = [].slice.call(arguments).reduce(function (a, b) {
            return a.concat(b instanceof Array ? b : [b]);
        }, []).filter(function (c) {
            return "object" === typeof c;
        }).reduce(function (p, c) {
            !(c instanceof Array) ? p = p.concat(Object.keys(c).map(function (key) {
                return [key, c[key]];
            })) : p.push(c);
            return p;
        }, []).reduce(function (p, c) {
            c.length === 2 ? p.push(c) : p = p.concat(c);
            return p;
        }, []).reduce(function (p, c) {
            c[1] instanceof Array ? c[1].forEach(function (v) {
                p.push([c[0], v]);
            }) : p.push(c);
            return p;
        }, []).map(function (c) {
            c[1] = encodeURIComponent(c[1]);
            return c.join("=");
        }).join("&");
    }
    return queryString;
}
1200187
function copyto($key) {
		$var=&\Base::instance()->ref($key);
		foreach ($this->fields+$this->adhoc as $key=>$field)
			$var[$key]=$field['value'];
	}
927130
def _ensure_field(self, key):
        """"""
        if self._has_field:
            self._size += 2  # comma, space
        self._has_field = True

        self._size += len(key) + 4
1068668
def mk_id(field):
  
  name = field.type_id
  if name == "string":
    return "%s" % ("char")
  elif name == "array" and field.size:
    if field.options['fill'].value not in CONSTRUCT_CODE:
      return "%s" % convert(field.options['fill'].value)
    else:
      return "%s" % field.options['fill'].value
  elif name == "array":
    return "%s" % convert(field.options['fill'].value)
  elif name not in CONSTRUCT_CODE:
    return convert(name)
  else:
    return name
345548
public static function encodeGetRecord($tableName, $field, $value, $fields = array())
    {
        $select = "";
        $size = sizeof($fields);
        //Select fields to be returned
        if (sizeof($fields) > 0) {
            foreach ($fields as $i => $column) {
                $select .= " $column";
                if ($i != ($size - 1))
                    $select .= ",";
            }
        } else {
            $select = "*";
        }

        $query = "SELECT $select FROM $tableName WHERE $field = '$value';";
        return $query;
    }
1146834
function serializeKey( name ) {
   const identifier = /^[A-Za-z$_][A-Za-z0-9$_]*$/.test( name );
   const keyword = [
      'if', 'else',
      'switch', 'case', 'default',
      'try', 'catch', 'finally',
      'function', 'return',
      'var', 'let', 'const'
   ].indexOf( name ) >= 0;

   return ( identifier && !keyword ) ? name : `"${name}"`;
}
421089
private String prepareCompositeIndexName(String indexedColumns, final EntityType entityType, EntityMetadata metadata)
    {
        StringTokenizer tokenizer = new StringTokenizer(indexedColumns, ",");
        StringBuilder builder = new StringBuilder();
        while (tokenizer.hasMoreTokens())
        {
            String fieldName = (String) tokenizer.nextElement();

            StringTokenizer stringTokenizer = new StringTokenizer(fieldName, ".");
            // if need to select embedded columns
            if (stringTokenizer.countTokens() > 1)
            {
                fieldName = stringTokenizer.nextToken();
                String embeddedFieldName = stringTokenizer.nextToken();
                Attribute embeddable = entityType.getAttribute(fieldName);

                EmbeddableType embeddedEntity = (EmbeddableType) kunderaMetadata.getApplicationMetadata()
                        .getMetaModelBuilder(metadata.getPersistenceUnit()).getEmbeddables()
                        .get(((AbstractAttribute) embeddable).getBindableJavaType());

                Attribute embeddedAttribute = embeddedEntity.getAttribute(embeddedFieldName);

                builder.append(((AbstractAttribute) embeddedAttribute).getJPAColumnName());
            }
            else
            {
                builder.append(((AbstractAttribute) entityType.getAttribute(fieldName)).getJPAColumnName());
            }
            builder.append(",");

        }

        // scan embeddable as well for

        builder.deleteCharAt(builder.length() - 1);

        return builder.toString();
    }
68108
private void encodeEnum(GeneratorAdapter mg, TypeToken<?> outputType,
                          int value, int encoder, int schemaLocal) {

    // encoder.writeInt(this.schema.getEnumIndex(value.name()));
    mg.loadArg(encoder);
    mg.loadArg(schemaLocal);
    mg.loadArg(value);
    mg.invokeVirtual(Type.getType(outputType.getRawType()), getMethod(String.class, "name"));
    mg.invokeVirtual(Type.getType(Schema.class), getMethod(int.class, "getEnumIndex", String.class));
    mg.invokeInterface(Type.getType(Encoder.class), getMethod(Encoder.class, "writeInt", int.class));
    mg.pop();
  }
936236
def convertfields(key_comm, obj, inblock=None):
    """"""
    # f_ stands for field_
    convinidd = ConvInIDD()
    if not inblock:
        inblock = ['does not start with N'] * len(obj)
    for i, (f_comm, f_val, f_iddname) in enumerate(zip(key_comm, obj, inblock)):
        if i == 0:
            # inblock[0] is the iddobject key. No conversion here
            pass
        else:
            obj[i] = convertafield(f_comm, f_val, f_iddname)
    return obj
884136
function encode(key, value, stringify) {
  var space = ' ', val = [], i, type = this.type;

  function coerce(type, val) {
    var out
      , enumerable = Array.isArray(type);
    if(enumerable) {
      if(!~type.indexOf(val)) {
        throw new TypeDefError(
          util.format('enum error on key \'%s\', got \'%s\' expected one of %s',
            key, val, type.join(', ')));
      }

      return '' + val;
    }
    switch(type) {
      case ByteSize:
        if(typeof val !== 'number') {
          throw new TypeDefError(
            util.format(
              'byte size number expected for \'%s\', got %s', key, val));
        }
        out = ByteSize.humanize(val);
        break;
      case Boolean:
        if(typeof val !== 'boolean') {
          throw new TypeDefError(
            util.format('boolean expected for \'%s\', got %s', key, val));
        }
        out = val === true ? YES : NO;
        break;
      case String:
        // strings must be quoted to allow the empty string
        out = '"' + val + '"';
        break;
      case Number:
        if(typeof val !== 'number') {
          throw new TypeDefError(
            util.format('number expected for \'%s\', got %s', key, val));
        }
        // just coerce numbers to strings
        out = '' + val;
        break;
    }
    return out;
  }

  // simple types
  if(!Array.isArray(this.type)) {
    return (!stringify ? key + space : '') + coerce(this.type, value);
  }

  if(stringify && this.repeats) {
    value.forEach(function(item) {
      item.forEach(function(entry, i) {
        val.push(coerce(type[i], entry));
      })
    });
    return val.join(space);
  }

  for(i = 0;i < this.type.length;i++) {
    if(this.arity > 1) {
      // expecting value to be an array
      val.push(coerce(this.type[i], value[i]));
    }else{
      val.push(coerce(this.type[i], value));
    }
  }

  return key + space + val.join(space);
}
281701
function validateField (fields, key) {
  var value = fields[key] = castShorthand(fields[key])

  if (typeof value !== 'object')
    throw new TypeError('The definition of "' + key + '" must be an object.')

  if (key === primaryKey)
    throw new Error('Can not define primary key "' + primaryKey + '".')

  if (key in plainObject)
    throw new Error('Can not define field name "' + key +
      '" which is in Object.prototype.')

  if (!value[typeKey] && !value[linkKey])
    throw new Error('The definition of "' + key + '" must contain either ' +
      'the "' + typeKey + '" or "' + linkKey + '" property.')

  if (value[typeKey] && value[linkKey])
    throw new Error('Can not define both "' + typeKey + '" and "' + linkKey +
      '" on "' + key + '".')

  if (value[typeKey]) {
    if (typeof value[typeKey] === 'string')
      value[typeKey] = nativeTypes[
        stringifiedTypes.indexOf(value[typeKey].toLowerCase())]

    if (typeof value[typeKey] !== 'function')
      throw new Error('The "' + typeKey + '" on "' + key +
        '" must be a function.')

    if (!find(nativeTypes, function (type) {
      var hasMatch = type === value[typeKey] ||
        type.name === value[typeKey].name

      // In case this errors due to security sandboxing, just skip this check.
      if (!hasMatch)
        try {
          hasMatch = Object.create(value[typeKey]) instanceof type
        }
        catch (e) {
          hasMatch = true
        }

      return hasMatch
    }))
      throw new Error('The "' + typeKey + '" on "' + key + '" must be or ' +
        'inherit from a valid native type.')

    if (value[inverseKey])
      throw new Error('The field "' + inverseKey + '" may not be defined ' +
        'on "' + key + '".')
  }

  if (value[linkKey]) {
    if (typeof value[linkKey] !== 'string')
      throw new TypeError('The "' + linkKey + '" on "' + key +
        '" must be a string.')

    if (value[inverseKey] && typeof value[inverseKey] !== 'string')
      throw new TypeError('The "' + inverseKey + '" on "' + key + '" ' +
        'must be a string.')
  }

  if (value[isArrayKey] && typeof value[isArrayKey] !== 'boolean')
    throw new TypeError('The key "' + isArrayKey + '" on "' + key + '" ' +
        'must be a boolean.')
}
59609
function mapFieldTypeToBindType($field_type)
    {
        switch ($field_type) {
        case MYSQLI_TYPE_DECIMAL:
        case MYSQLI_TYPE_NEWDECIMAL:
        case MYSQLI_TYPE_FLOAT:
        case MYSQLI_TYPE_DOUBLE:
        case MYSQLI_TYPE_BIT:
        case MYSQLI_TYPE_TINY:
        case MYSQLI_TYPE_SHORT:
        case MYSQLI_TYPE_LONG:
        case MYSQLI_TYPE_LONGLONG:
        case MYSQLI_TYPE_INT24:
        case MYSQLI_TYPE_YEAR:
        case MYSQLI_TYPE_ENUM:
            return 'number';

        case MYSQLI_TYPE_DATE:
            return 'date';

        case MYSQLI_TYPE_TIME:
            return 'time';
        case MYSQLI_TYPE_TIMESTAMP:
        case MYSQLI_TYPE_DATETIME:
        case MYSQLI_TYPE_NEWDATE:
            return 'datetime';
        
        case MYSQLI_TYPE_VAR_STRING:
        case MYSQLI_TYPE_STRING:
        case MYSQLI_TYPE_CHAR:
        case MYSQLI_TYPE_GEOMETRY:
        case MYSQLI_TYPE_TINY_BLOB:
        case MYSQLI_TYPE_MEDIUM_BLOB:
        case MYSQLI_TYPE_LONG_BLOB:
        case MYSQLI_TYPE_BLOB:
            return 'string';

        default:
            return 'unknown';
        }
    }
1340286
private static String encode(String className) {
    return Feature.makeEnumName(className)
        .replaceFirst("STRONG_KEYS", "P") // puissant
        .replaceFirst("WEAK_KEYS", "F") // faible
        .replaceFirst("_STRONG_VALUES", "S")
        .replaceFirst("_WEAK_VALUES", "W")
        .replaceFirst("_SOFT_VALUES", "D") // doux
        .replaceFirst("_EXPIRE_ACCESS", "A")
        .replaceFirst("_EXPIRE_WRITE", "W")
        .replaceFirst("_REFRESH_WRITE", "R")
        .replaceFirst("_MAXIMUM", "M")
        .replaceFirst("_WEIGHT", "W")
        .replaceFirst("_SIZE", "S");
  }
20073
private function formatFieldName($key)
    {
        $related_model = $this->revisionable_type;
        $related_model = new $related_model;
        $revisionFormattedFieldNames = $related_model->getRevisionFormattedFieldNames();

        if (isset($revisionFormattedFieldNames[$key])) {
            return $revisionFormattedFieldNames[$key];
        }

        return false;
    }