returns a unique String for given field.
the returned uid is unique accross all tables.
17388
protected String getUniqueString(FieldDescriptor field) throws SequenceManagerException
    {
        ResultSetAndStatement rsStmt = null;
        String returnValue = null;
        try
        {
            rsStmt = getBrokerForClass().serviceJdbcAccess().executeSQL(
                    "select newid()", field.getClassDescriptor(), Query.NOT_SCROLLABLE);
            if (rsStmt.m_rs.next())
            {
                returnValue = rsStmt.m_rs.getString(1);
            }
            else
            {
                LoggerFactory.getDefaultLogger().error(this.getClass()
                        + ": Can't lookup new oid for field " + field);
            }
        }
        catch (PersistenceBrokerException e)
        {
            throw new SequenceManagerException(e);
        }
        catch (SQLException e)
        {
            throw new SequenceManagerException(e);
        }

        finally
        {
            // close the used resources
            if (rsStmt != null) rsStmt.close();
        }
        return returnValue;
    }
732081
def check_uniqueness(self, *args, **kwargs):
        

        if not self.field.unique:
            return

        try:
            pk = self.instance.pk.get()
        except AttributeError:
            pk = None

        key = self.get_storage_key(*args)
        value = list(args)[-1]
        pks = self.get_pks_for_filter(key, 'eq', self.normalize_value(value))

        self.assert_pks_uniqueness(pks, pk, value)
169676
def where_uniqable(uid)
      where_sql = key_uid?(uid) ?
                      uniqable_fields.map { |r| "#{table_name}.#{r} = :uid" }.join(' OR ') :
                      "#{table_name}.#{self.primary_key} = :uid"
      where(where_sql, uid: uid)
    end
1348586
def random_uniq_attr(field, **options, &block)
      set_method = :"set_#{field}"
      generate_method = :"generate_#{field}"
      max_attempts = options.fetch(:max_attempts) { MAX_ATTEMPTS }

      after_create set_method, unless: :"#{field}?"

      # def self.generate_key
      define_singleton_method generate_method, &(block || DEFAULT_GENERATOR)

      # def set_key
      define_method(set_method) do
        attempt = 0
        begin
          raise 'Available only for persisted record' unless persisted?
          transaction(requires_new: true) do
            new_value = self.class.send(generate_method, self)
            update_column field, new_value # rubocop:disable Rails/SkipsModelValidations
          end
        rescue ActiveRecord::RecordNotUnique
          attempt += 1
          raise if attempt > max_attempts
          retry
        end
      end
    end
573656
private Integer getUniqueId(Object object) {
    Integer id = idCache.get(object);
    if (id == null) {
      id = uidGenerator.incrementAndGet();
      Integer existing = idCache.putIfAbsent(object, id);
      if (existing != null) {
        return existing;
      }
    }
    return id;
  }
616156
protected function getOneRowByUid($fields, $uid)
    {
        $queryBuilder = $this->getQueryBuilder();
        return $queryBuilder
            ->select($fields)
            ->from($this->table)
            ->where($queryBuilder->expr()->eq('uid', intval($uid)))
            ->execute()->fetch();
    }
1106535
def getfieldidd(bch, fieldname):
    """"""
    # print(bch)
    try:
        fieldindex = bch.objls.index(fieldname)
    except ValueError as e:
        return {}  # the fieldname does not exist
                    # so there is no idd
    fieldidd = bch.objidd[fieldindex]
    return fieldidd
859416
def count_unique_(self, field):
        
        try:
            num = self.df[field].nunique()
        except Exception as e:
            self.err(e, "Can not count unique values")
            return
        self.ok("Found", num, "unique values in column", field)
295990
def _uniqueid(n=30):
    
    return ''.join(random.SystemRandom().choice(
                   string.ascii_uppercase + string.ascii_lowercase)
                   for _ in range(n))
556841
public static String getRepeatedFieldType(Field field) {
        FieldType type = field.getType();
        if (type instanceof ScalarFieldType) {
            ScalarFieldType scalarFieldType = (ScalarFieldType) type;
            return LIST + "<" + ScalarFieldTypeUtil.getWrapperType(scalarFieldType) + ">";
        }
        if (type instanceof UserType) {
            UserType userType = (UserType) type;
            return LIST + "<" + UserTypeUtil.getCanonicalName(userType) + ">";
        }
        throw new IllegalArgumentException(field.toString());
    }
648154
def _validate_unique(self, unique, field, value):
        
        if unique:
            root_key = self.schema_path[0]
            data = (doc[field] for doc in self.root_document[root_key])
            for key, count in collections.Counter(data).items():
                if count > 1:
                    msg = "'{}' is not unique".format(key)
                    self._error(field, msg)
840986
def id_unique(dict_id, name, lineno):
    """"""
    if dict_id in name_dict:
        global error_occurred
        error_occurred = True
        print(
            "ERROR - {0:s} definition {1:s} at line {2:d} conflicts with {3:s}"
            .format(name, dict_id, lineno, name_dict[dict_id]))
        return False
    else:
        return True
1329100
def query_unique(self, field):
        
        return set(self._convert_field(field, value)
                   for value in super(Reader, self).query_unique(field))
162550
def get_unique_name(self, name):
        

        if name not in self._db:
            self._db[name] = 0
            return name
        else:
            index = self._db[name]
            self._db[name] = index + 1
            return f"{name}_{index}"
1109424
def _val_is_unique(val, field):
        
        if val is None:
            return False

        if not field.unique:
            return True

        field_name = field.name
        return field.model.objects.filter(**{field_name: val}).count() == 0
834619
def _get_unique_child_value(xtag, eltname):
    """"""
    xelt = _get_unique_child(xtag, eltname)
    if xelt is None:
        return None
    else:
        return xelt.text
685726
def uniqueId(self, prefix=""):
        
        _IdCounter.count += 1
        id = _IdCounter.count
        if prefix:
            return self._wrap(prefix + str(id))
        else:
            return self._wrap(id)