Create and return a default ID field that is Auto generated
432686
def _create_id_field(new_class):
        """"""
        id_field = Auto(identifier=True)

        setattr(new_class, 'id', id_field)
        id_field.__set_name__(new_class, 'id')

        # Ensure ID field is updated properly in Meta attribute
        new_class.meta_.declared_fields['id'] = id_field
        new_class.meta_.id_field = id_field
1205001
def get_field_identifier(self):
        
        if self.default is None:
            return '{0}, {1}'.format(self.field.get_select_sql(), self.offset)
        return "{0}, {1}, '{2}'".format(self.field.get_select_sql(), self.offset, self.default)
1186242
def getfieldidd_item(bch, fieldname, iddkey):
    """"""
    fieldidd = getfieldidd(bch, fieldname)
    try:
        return fieldidd[iddkey]
    except KeyError as e:
        return []
995451
def generate_id(self, obj):
        """"""
        object_type = type(obj).__name__.lower()
        return '{}_{}'.format(object_type, self.get_object_id(obj))
133796
function ___GEN_OBJECT_ID(initTime=null) {
	const time	= initTime || Math.floor(Date.now()/1000);
	const pid	= PID;
	const inc	= (SEQ_NUMBER=(SEQ_NUMBER+1) % 0xffffff);



	const buffer = new DataView(new ArrayBuffer(12));
	
	// NOTE: Fill in the id information
	// NOTE: Following statements' order should not be modified!
	buffer.setUint32(8, inc, false);		// [9-11] seq
	buffer.setUint16(7, pid, false);		// [7-8] pid
	buffer.setUint32(3, MACHINE_ID, false);	// [4-6] machine id
	buffer.setUint32(0, time, false);		// [0-3] epoch time
	
	return buffer.buffer;
}
537404
def _set_id_field(new_class):
        """"""
        # FIXME What does it mean when there are no declared fields?
        #   Does it translate to an abstract entity?
        if new_class.meta_.declared_fields:
            try:
                new_class.meta_.id_field = next(
                    field for _, field in new_class.meta_.declared_fields.items()
                    if field.identifier)
            except StopIteration:
                # If no id field is declared then create one
                new_class._create_id_field()
899685
def id(self, opts_id):
        """"""
        old_id = self._id
        self._id = opts_id
        if old_id is not None:
            cleanup_custom_options(old_id)
        if opts_id is not None and opts_id != old_id:
            if opts_id not in Store._weakrefs:
                Store._weakrefs[opts_id] = []
            ref = weakref.ref(self, partial(cleanup_custom_options, opts_id))
            Store._weakrefs[opts_id].append(ref)
278167
function (prefix, obj) {
            if (!obj.attr('id')) {
                var generated_id;
                do {
                    generated_id = prefix + '_' + randomNumber();
                } while ($('#' + generated_id).length > 0);
                obj.attr('id', generated_id);
            }
            return obj.attr('id');
        }
1060503
function (baseId) {
            baseId = this._id + "_" + baseId.replace(/\+/g, "");

            // Calculate and return the new id
            var prefixIds = this._prefixIds;
            var id = prefixIds[baseId] = (prefixIds[baseId] || 0) + 1;
            return baseId + "_auto_" + id;
        }
1001045
protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType,
			List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs,
			List<String> queriesAfter) {
		throw new IllegalStateException(
				"GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType);
	}
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
595007
def access_id(self, id_, lineno, scope=None, default_type=None, default_class=CLASS.unknown):
        
        if isinstance(default_type, symbols.BASICTYPE):
            default_type = symbols.TYPEREF(default_type, lineno, implicit=False)
        assert default_type is None or isinstance(default_type, symbols.TYPEREF)

        if not check_is_declared_explicit(lineno, id_):
            return None

        result = self.get_entry(id_, scope)
        if result is None:
            if default_type is None:
                default_type = symbols.TYPEREF(self.basic_types[global_.DEFAULT_IMPLICIT_TYPE],
                                               lineno, implicit=True)

            result = self.declare_variable(id_, lineno, default_type)
            result.declared = False  # It was implicitly declared
            result.class_ = default_class
            return result

        # The entry was already declared. If it's type is auto and the default type is not None,
        # update its type.
        if default_type is not None and result.type_ == self.basic_types[TYPE.auto]:
            result.type_ = default_type
            warning_implicit_type(lineno, id_, default_type)

        return result
1027328
def as_widget(self, widget=None, attrs=None, only_initial=False):
        
        if not widget:
            widget = self.field.widget

        attrs = attrs or {}
        auto_id = self.auto_id
        if auto_id and 'id' not in attrs and 'id' not in widget.attrs:
            if not only_initial:
                attrs['id'] = auto_id
            else:
                attrs['id'] = self.html_initial_id

        name = ""
        return widget.render(name, self.value(), attrs=attrs)
245468
function create_field( $field )
	{
		// load defaults
		// if field was loaded from db, these default will already be appield
		// if field was written by hand, it may be missing keys
		$field = apply_filters('acf/load_field_defaults', $field);
		
		
		// create field specific html
		do_action('acf/create_field/type=' . $field['type'], $field);
		
		
		// conditional logic
		if( $field['conditional_logic']['status'] )
		{
			$field['conditional_logic']['field'] = $field['key'];
			
			?>
<script type="text/javascript">
(function($) {
	
	if( typeof acf !== 'undefined' )
	{
		acf.conditional_logic.items.push(<?php echo json_encode($field['conditional_logic']); ?>);
	}
	
})(jQuery);	
</script>
			<?php
		}
		
	}
435655
function generateAddFieldSql( $table, $field_name, $added_field, $params )
    {
        return $this->OtherSchema->generateAddFieldSql( $table, $field_name, $added_field, $params );
    }
1310315
def getElementById(self, node, id, default=join):
        """"""
        attrget = self.getAttr
        ELEMENT_NODE = node.ELEMENT_NODE
        for child in node.childNodes:
            if child.nodeType == ELEMENT_NODE:
                if attrget(child, 'id') == id:
                    return child
        if default is not join:
            return default
        raise KeyError, name
118313
def p_field_id(self, p):
        ''' '''
        if len(p) == 3:

            if p[1] == 0:
                # Prevent users from ever using field ID 0. It's reserved for
                # internal use only.
                raise ThriftParserError(
                    'Line %d: Field ID 0 is reserved for internal use.'
                    % p.lineno(1)
                )

            p[0] = p[1]
        else:
            p[0] = None