Get the session data from database

@param string $sessionid

@return null|stdClass if data doesn't exist in database
@throws DbException
@throws \Koldy\Config\Exception
@throws \Koldy\Exception
334291
private function getDbData($sessionid): ?stdClass
    {
        $r = null;

        try {
            if ($this->disableLog) {
                Log::temporaryDisable('sql');
            }

            $r = $this->getAdapter()
              ->select($this->getTableName())
              ->field('time')
              ->field('data')
              ->where('id', $sessionid)
              ->fetchFirstObj();

        } catch (DbException $e) {
            throw $e;

        } finally {
            if ($this->disableLog) {
                Log::restoreTemporaryDisablement();
            }
        }

        return $r;
    }
393110
public function session($session_id)
	{
		$query = $this->connection->getQuery()
			->select('*')
			->from('#__session')
			->group('userid')
			->group('client_id')
			->order('time', 'desc');

		$this->connection->setQuery($query->toString());
		return $this->connection->loadObject();
	}
859032
public function getSchema($schemaId = null)
    {

        if (is_null($schemaId)) {
            $schemaId = $this->getCurrentlyUsedDatabaseId();
        }

        if (!$this->schemaExists(self::DATABASE_ID_DEFAULT)) {
            $this->createSchema(self::DATABASE_ID_DEFAULT);
        }

        $pattern = InternalDsn::PATTERN;
        if (!preg_match("/{$pattern}/is", $schemaId)) {
            throw new ErrorException("Invalid database-id '{$schemaId}' given! (Does not match pattern '{$pattern}')");
        }

        if (!isset($this->schemas[$schemaId])) {
            $schemaFilePath = sprintf(FilePathes::FILEPATH_SCHEMA, $schemaId);
            $schemaFile = $this->filesystem->getFile($schemaFilePath);
            $this->schemas[$schemaId] = new DatabaseSchema($schemaFile);
        }

        return $this->schemas[$schemaId];
    }
734366
protected function fetchUserData($userId)
    {
        $query = $this->dbHandler->createSelectQuery();
        $query
            ->select(
                $this->dbHandler->quoteColumn('contentobject_id', 'ezuser'),
                $this->dbHandler->quoteColumn('login', 'ezuser'),
                $this->dbHandler->quoteColumn('email', 'ezuser'),
                $this->dbHandler->quoteColumn('password_hash', 'ezuser'),
                $this->dbHandler->quoteColumn('password_hash_type', 'ezuser')
            )
            ->from($this->dbHandler->quoteTable('ezuser'))
            ->where(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentobject_id', 'ezuser'),
                    $query->bindValue($userId)
                )
            );

        $stmt = $query->prepare();
        $stmt->execute();

        $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);

        return isset($rows[0]) ? $this->convertColumnsToProperties($rows[0]) : array();
    }
366931
public function read($sessionID)
    {
        $fileName = $this->getFileName($sessionID);
        if(is_file($fileName))
        {
            return Coroutine::readFile($fileName);
        }
        else
        {
            return '';
        }
    }
650181
public function write($sessionID, $sessionData): bool
    {
        $dbData = ['session_id' => $sessionID, 'session_access_ts' => time(), 'session_data' => $sessionData];
        $query = $this->dbClass->prepare()->replaceInto($this->dbTable)->set($dbData);
        $result = $this->dbClass->execute($query) == 1 ? true : false;

        return $result;
    }
622617
public function read($sessionID): string
    {
        $where = ['session_id' => $sessionID];
        $query = $this->dbClass->prepare()->select(['session_data'])->from($this->dbTable)->where($where);
        $result = $this->dbClass->execute($query);
        $data = $this->dbClass->rowCount() > 0 ? $result[0]['session_data'] : '';

        return $data;
    }
450804
public function do_read($session_id)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        return $db->query($this->_source)->whereEq('session_id', $session_id)->value('data', '');
    }
1006261
protected function getNewInstance($sessionId)
    {
        $className = $this->repository->getClassName();
        $session = new $className();

        $session->setSessionId($sessionId);

        return $session;
    }
387386
public function read($sessionid)
    {
        $sess = $this->getDbData($sessionid);

        if ($sess === null) {
            return '';
        } else {
            if ($this->getAdapter() instanceof PostgreSQL) {
                return hex2bin(is_resource($sess->data) ? stream_get_contents($sess->data) : $sess->data);
            } else {
                return $sess->data;
            }
        }
    }
478136
protected function doWrite($sessionId, $data)
    {
        $item = $this->getCacheItem($sessionId);
        $item->set($data)
            ->expiresAfter($this->ttl);

        return $this->cache->save($item);
    }
971381
protected function getSession($sessionId)
    {
        $session = $this->repository->findOneBy([
            'sessionId' => $sessionId,
        ]);

        if (!$session) {
            $session = $this->getNewInstance($sessionId);
        }

        return $session;
    }
282765
public function destroy($sessionId)
    {
        $sql    = 'DELETE from tbl_sessions where SESSION_ID=:SESSID';
        $delete = $this->_db->prepare($sql);
        $delete->execute(array(':SESSID' => $sessionId));
        $this->_cache->delete($sessionId);

        return true;

    }
1353088
public GetSessionResponse getSession(String sessionId) {
        GetSessionRequest request = new GetSessionRequest();
        request.setSessionId(sessionId);
        return getSession(request);
    }
860655
public static function getSessionFile($sessionID)
    {
        $fileName = HttpCache::$sessionPath . '/tourze_session_' . $sessionID;
        Base::getLog()->debug(__METHOD__ . ' get session file', [
            'file' => $fileName,
        ]);

        if ( ! FileHelper::exists($fileName))
        {
            Base::getLog()->notice(__METHOD__ . ' session file not found, create it', [
                'file' => $fileName,
            ]);
            FileHelper::touch($fileName);
        }
        return $fileName;
    }
597977
public function read($session_id)
    {
        $session = $this->sessions()
            ->where('id', $session_id)->first();

        if (is_null($session)) {
            return '';
        }

        return $session->data;
    }
315902
public static function get_instance_info($instanceid) {
        global $DB;

        $params = self::validate_parameters(self::get_instance_info_parameters(), array('instanceid' => $instanceid));
        $warnings = array();

        // Retrieve guest enrolment plugin.
        $enrolplugin = enrol_get_plugin('guest');
        if (empty($enrolplugin)) {
            throw new moodle_exception('invaliddata', 'error');
        }

        self::validate_context(context_system::instance());
        $enrolinstance = $DB->get_record('enrol', array('id' => $params['instanceid']), '*', MUST_EXIST);

        $course = $DB->get_record('course', array('id' => $enrolinstance->courseid), '*', MUST_EXIST);
        if (!core_course_category::can_view_course_info($course) && !can_access_course($course)) {
            throw new moodle_exception('coursehidden');
        }

        $instanceinfo = $enrolplugin->get_enrol_info($enrolinstance);
        // Specific instance information.
        $instanceinfo->passwordrequired = $instanceinfo->requiredparam->passwordrequired;

        unset($instanceinfo->requiredparam);

        $result = array();
        $result['instanceinfo'] = $instanceinfo;
        $result['warnings'] = $warnings;
        return $result;
    }