Returns the next valid odba_id
487537
def next_id
      if @file_lock
        dbname = ODBA.storage.instance_variable_get('@dbi').dbi_args.first.split(/:/).last
        id = new_id(dbname, ODBA.storage)
      else
        id = ODBA.storage.next_id
      end
      @peers.each do |peer|
        peer.reserve_next_id id rescue DRb::DRbError
      end
      id
    rescue OdbaDuplicateIdError
      retry
    end
722837
def _get_oid(data, position, dummy0, dummy1, dummy2):
    """"""
    end = position + 12
    return ObjectId(data[position:end]), end
586411
public function getNextOid( $requested_oid ){

		// Sort Response
		$tree = array_keys($this->tree);
		natsort($tree);
		$this->tree = array_merge($tree, $this->tree);

		// 
		$local_oids = $tree;
		$last = array_shift($local_oids);
		array_unshift($local_oids, $last);

		// Loop Through now
		for($i=0;$i<sizeof($local_oids);$i++){

			/*
			echo "Looking for OID: $local_oids[$i]\n";
			//*/

			// If no sub-oid was provided, return the first
			if( $requested_oid == $this->oid ){
				
				echo "{$this->oid}{$last}".PHP_EOL;
				echo $this->tree[ $last ]['type'] .PHP_EOL;
				echo $this->tree[ $last ]['value'] .PHP_EOL;
				exit(0);

			}
			else if( version_compare( $requested_oid, $this->oid . $local_oids[$i], "<")) {
			
				echo "{$this->oid}{$local_oids[$i]}".PHP_EOL;
				echo $this->tree[ $local_oids[$i] ]['type'] .PHP_EOL;
				echo $this->tree[ $local_oids[$i] ]['value'] .PHP_EOL;
				exit(0);

			}

		}

		// Per RFC, if there is nothing left, respond with NONE
		echo $this->oid . PHP_EOL;
		echo "NONE".PHP_EOL;
		exit(0);

	}
778499
def get_next(object_list)
      varbind_list = @mib.varbind_list(object_list, :NullValue)
      request = GetNextRequest.new(@@request_id.next, varbind_list)
      try_request(request)
    end
389603
def _get_persistent_id(self, o):
        
        if type(o) in self.hash_dedup:
            oid = o.__class__.__name__ + "-" + str(hash(o))
            self._object_cache[oid] = o
            return oid

        if any(isinstance(o,c) for c in self.unsafe_key_baseclasses):
            return None

        try:
            return self._uuid_cache[o]
        except KeyError:
            pass
        except TypeError:
            return None

        #if type(o) in self.uuid_dedup:
        #    return self._get_id(o)
        if o.__class__.__module__.split('.')[0] in self.module_dedup or o.__class__ in self.uuid_dedup:
            oid = o.__class__.__name__.split(".")[-1] + '-' + str(uuid.uuid4())
            self._object_cache[oid] = o
            self._uuid_cache[o] = oid
            return oid

        return None
1004653
def odba_take_snapshot
			@odba_snapshot_level ||= 0
			snapshot_level = @odba_snapshot_level.next
			current_level = [self]
			tree_level = 0
			while(!current_level.empty?)
				tree_level += 1
				obj_count = 0
				next_level = []
				current_level.each { |item|
					if(item.odba_unsaved?(snapshot_level))
						obj_count += 1
						next_level += item.odba_unsaved_neighbors(snapshot_level)
						item.odba_snapshot(snapshot_level)
					end
				}
				current_level = next_level #.uniq
			end
		end
368632
def get_entry(self, id_, scope=None):
        
        if id_[-1] in DEPRECATED_SUFFIXES:
            id_ = id_[:-1]  # Remove it

        if scope is not None:
            assert len(self.table) > scope
            return self[scope][id_]

        for sc in self:
            if sc[id_] is not None:
                return sc[id_]

        return None
389343
def get_next_start_id(self):
        """"""
        link = self.rws_connection.last_result.links.get("next", None)
        if link:
            link = link['url']
            p = urlparse(link)
            start_id = int(parse_qs(p.query)['startid'][0])
            return start_id

        return None
774792
def _oid(self, x):
        """"""
        xl = x.strip(".").split(".")
        p = len(xl) - 1
        while p >= 0 and _mib_re_integer.match(xl[p]):
            p -= 1
        if p != 0 or xl[p] not in six.itervalues(self.__dict__):
            return x
        xl[p] = next(k for k, v in six.iteritems(self.__dict__) if v == xl[p])
        return ".".join(xl[p:])
195723
public function getNextId()
    {
        // remove any order prefixes from the last increment id
        $last = $this->_orderHelper->removeOrderIncrementPrefix($this->getLastId());
        // Using bcmath to avoid float/integer overflow.
        return $this->format(bcadd($last, 1));
    }
730161
def verify_id_n_version(id, version):
    
    stmt = _get_sql('verify-id-and-version.sql')
    args = dict(id=id, version=version)

    with db_connect() as db_conn:
        with db_conn.cursor() as cursor:
            cursor.execute(stmt, args)
            try:
                valid = cursor.fetchone()[0]
            except TypeError:
                raise NotFound(join_ident_hash(id, version))
    return True
307050
def _get_next_open_shard(stream_details, shard_id):
    '''
    
    '''
    found = False
    for shard in stream_details["OpenShards"]:
        current_shard_id = shard["ShardId"]
        if current_shard_id == shard_id:
            found = True
            continue
        if found:
            return current_shard_id
1127961
public function nextId()
    {
        $timestamp = floor(microtime(true) * 1000) - $this->epochTimeStamp;
        if($timestamp > $this->maxTimeStamp) {
            throw new Exception('Snowflake: TimeStamp overflow. Unable to generate any more IDs');
        }
        
        $machine = $this->machineId;
        if($machine < 0 || $machine > 1023) {
            throw new Exception('Snowflake: Machine ID out of range');
        }
        $sequence = mt_rand(0, 4095);
        if(PHP_INT_SIZE == 4) {
            return $this->makeId32($timestamp, $machine, $sequence);
        } else {
            return $this->makeId64($timestamp, $machine, $sequence);
        }
    }
1045834
def _load_id_or_insert(self, session):
        
        if self.id is None:
            stable_id = self.get_stable_id()
            # Check if exists
            id = session.execute(
                select([Context.id]).where(Context.stable_id == stable_id)
            ).first()

            # If not, insert
            if id is None:
                self.id = session.execute(
                    Context.__table__.insert(),
                    {"type": self._get_table().__tablename__, "stable_id": stable_id},
                ).inserted_primary_key[0]
                insert_args = self._get_insert_args()
                insert_args["id"] = self.id
                return insert_args
            else:
                self.id = id[0]
1215015
protected function _getLastInsertedId()
    {
        $objectId = null;
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $tableName = $this->getObject()->getCoreTableName();
        $query = 'SELECT OXID FROM '. $tableName .' ORDER BY OXTIMESTAMP DESC LIMIT 1';
        $result = $oDb->select($query);

        if ($result != false && $result->count() > 0) {
            $fields = $result->fields;
            $objectId = $fields['OXID'];
        }

        return $objectId;
    }
895109
def _conn_string_odbc(self, db_key, instance=None, conn_key=None, db_name=None):
        ''' 
        '''
        if instance:
            dsn, host, username, password, database, driver = self._get_access_info(instance, db_key, db_name)
        elif conn_key:
            dsn, host, username, password, database, driver = conn_key.split(":")

        conn_str = ''
        if dsn:
            conn_str = 'DSN={};'.format(dsn)

        if driver:
            conn_str += 'DRIVER={};'.format(driver)
        if host:
            conn_str += 'Server={};'.format(host)
        if database:
            conn_str += 'Database={};'.format(database)

        if username:
            conn_str += 'UID={};'.format(username)
        self.log.debug("Connection string (before password) {}".format(conn_str))
        if password:
            conn_str += 'PWD={};'.format(password)
        return conn_str
174980
public function nextId()
    {
        $timestamp = time() - static::BASE_TIME;

        if ($this->lastTimestamp >= $timestamp) {
            $timestamp = $this->lastTimestamp;

            $sequence = ++ $this->sequence;

            if ($sequence > 0x7ff) {
                $this->lastTimestamp = ++ $timestamp;

                $sequence = $this->sequence = 0;
            }
        } else {
            $this->lastTimestamp = $timestamp;

            $sequence = $this->sequence = 0;
        }

        return ($timestamp << 32) | $this->mask | ($sequence & 0x7ff);
    }