Returns the related database records.

@return stdClass[]
181641
private function queryRecords(): array
    {
        $prefix = DB::connection()->getTablePrefix();

        return DB::table('individuals')
            ->select([
                DB::raw('ROUND(AVG(' . $prefix . 'death.d_julianday2 - ' . $prefix . 'birth.d_julianday1) / 365.25, 1) AS age'),
                DB::raw('ROUND((' . $prefix . 'death.d_year + 49) / 100) AS century'),
                'i_sex AS sex'
            ])
            ->join('dates AS birth', static function (JoinClause $join): void {
                $join
                    ->on('birth.d_file', '=', 'i_file')
                    ->on('birth.d_gid', '=', 'i_id');
            })
            ->join('dates AS death', static function (JoinClause $join): void {
                $join
                    ->on('death.d_file', '=', 'i_file')
                    ->on('death.d_gid', '=', 'i_id');
            })
            ->where('i_file', '=', $this->tree->id())
            ->where('birth.d_fact', '=', 'BIRT')
            ->where('death.d_fact', '=', 'DEAT')
            ->whereIn('birth.d_type', ['@#DGREGORIAN@', '@#DJULIAN@'])
            ->whereIn('death.d_type', ['@#DGREGORIAN@', '@#DJULIAN@'])
            ->whereColumn('death.d_julianday1', '>=', 'birth.d_julianday2')
            ->where('birth.d_julianday2', '<>', 0)
            ->groupBy(['century', 'sex'])
            ->orderBy('century')
            ->orderBy('sex')
            ->get()
            ->all();
    }
60381
public function getIndexes()
    {
        $query = $this->db->getQuery(true);
        $table = $this->db->replacePrefix($this->name);

        $query->select([
            'tbl.name AS table_name',
            'col.name AS column_name',
            'idx.name AS index_name',
            'col.*',
            'idx.*'
        ])
            ->from('sys.columns AS col')
            ->leftJoin(
                'sys.tables AS tbl',
                'col.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.index_columns AS ic',
                'col.column_id = ic.column_id AND ic.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.indexes AS idx',
                'idx.object_id = tbl.object_id AND idx.index_id = ic.index_id'
            )
            ->where('tbl.name = %q', $table)

            ->where('(idx.name IS NOT NULL OR col.is_identity = 1 OR idx.is_primary_key = 1)');

        $indexes = $this->db->prepare($query)->loadAll();

        $keys = [];

        foreach ($indexes as $index) {
            $key = new \stdClass();

            $key->Table = $table;
            $key->Is_primary = $index->is_primary_key ?: $index->is_identity;
            $key->Non_unique = !$index->is_unique;
            $key->Key_name = $key->Is_primary ? 'PRIMARY' : $index->index_name;
            $key->Column_name = $index->column_name;
            $key->Collation = 'A';
            $key->Cardinality = 0;
            $key->Sub_part = null;
            $key->Packed = null;
            $key->Null = null;
            $key->Index_type = 'BTREE';
            // TODO: Finish comments query
            $key->Comment = null;
            $key->Index_comment = null;
            $key->is_identity = $index->is_identity ? 'auto_increment' : '';

            $keys[] = $key;
        }

        return $keys;
    }
352373
public function getRelatedColumns()
	{
		//make sure we only run this once and then return the cached version
		if (!sizeof($this->relatedColumns))
		{
			foreach ($this->getColumns() as $column)
			{
				if ($column->getOption('is_related'))
				{
					$this->relatedColumns[$column->getOption('column_name')] = $column->getOption('column_name');
				}
			}
		}

		return $this->relatedColumns;
	}
526109
protected function getIDListFromDB() : array
    {
        switch ($this->sValue) {
            case PromoBlockListStore::SORT_DATE_BEGIN_ASC:
                $arElementIDList = $this->getByDateBeginASC();
                break;
            case PromoBlockListStore::SORT_DATE_BEGIN_DESC:
                $arElementIDList = $this->getByDateBeginDESC();
                break;
            case PromoBlockListStore::SORT_DATE_END_ASC:
                $arElementIDList = $this->getByDateEndASC();
                break;
            case PromoBlockListStore::SORT_DATE_END_DESC:
                $arElementIDList = $this->getByDateEndDESC();
                break;
            case PromoBlockListStore::SORT_DEFAULT:
                $arElementIDList = $this->getBySortOrder();
                break;
            default:
                $arElementIDList = $this->getCustomSortingList();
                break;
        }

        return $arElementIDList;
    }
595148
public function loadFromDb()
    {
        $this->getLogger()->debug('Reading relationships from DB.');
        $query = $this->getQueryFactory()->createSelectAllQuery($this->tableName);
        $res = $query->execute();
        $rels = array();
        foreach ($res->fetchAll(\PDO::FETCH_ASSOC) as $row) {
            $rels[$row['relationship_name']] = $row;
        }
        ksort($rels);

        return $rels;
    }
1021710
public function getRelationTable()
    {
        if (is_null($this->_relationTable)) {
            $names = [
                $this->getEntity()->getTableName(),
                Entity\Manager::getInstance()
                    ->get($this->_relatedEntity)
                    ->getEntity()->getTableName()
            ];
            asort($names);
            $this->setRelationTable(implode('_', $names));
        }
        return $this->_relationTable;
    }
317578
public function getAllRecords()
    {
        /* @var DataObject $recordType */
        $recordType = $this->getRecordType();
        $all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
            return $obj->canView();
        });

        return new PaginatedList($all, $this->request);
    }
944665
protected function getAffectedRecords()
    {
        // model only
        if ($this->model->getKey()) {
            $records = [$this->model];
        }

        // mass assignment
        else {
            $records = $this->query->get();
        }

        return $records;
    }
160958
protected function fetchBlockRecords()
    {
        $activeThemeId = oxNew(\OxidEsales\Eshop\Core\Theme::class)->getActiveThemeId();
        $config = Registry::getConfig();
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $query = "select * from oxtplblocks where oxactive=1 and oxshopid=? and oxtheme in ('', ?)";

        return $database->select($query, [$config->getShopId(), $activeThemeId]);
    }
1281707
public function listDatabases()
    {
        $sql = $this->_platform->getListDatabasesSQL();

        $databases = $this->_conn->fetchAll($sql);

        return $this->_getPortableDatabasesList($databases);
    }
1352309
public function linkingRecords(): array
    {
        $union = DB::table('change')
            ->where('gedcom_id', '=', $this->tree()->id())
            ->whereContains('new_gedcom', '@' . $this->xref() . '@')
            ->where('new_gedcom', 'NOT LIKE', '0 @' . $this->xref() . '@%')
            ->select(['xref']);

        $xrefs = DB::table('link')
            ->where('l_file', '=', $this->tree()->id())
            ->where('l_to', '=', $this->xref())
            ->select('l_from')
            ->union($union)
            ->pluck('l_from');

        return $xrefs->map(function (string $xref): GedcomRecord {
            return GedcomRecord::getInstance($xref, $this->tree);
        })->all();
    }
893197
public function getSubs()
    {
        
        $r = self::getDbConnection()->query('
        	SELECT A.*, B.level 
        	FROM dir_data A, dir_structure B, dir_structure C
        	WHERE A.id=B.data_id and C.data_id='.$this->id.' and B.lft BETWEEN C.lft and C.rght');
        	
		$result = [];
			
        while ($f = $r->fetch()) {
            $c = Catalog::fetch($f);
            $result[] = $c->prototype->id;
        }
                    
        return $result;
    }
1072764
public function list_databases()
	{
		if (isset($this->db->data_cache['db_names']))
		{
			return $this->db->data_cache['db_names'];
		}

		return $this->db->data_cache['db_names'] = cubrid_list_dbs($this->db->conn_id);
	}
33213
protected function getRecords()
    {
        $query = $this->prepareQuery();

        if ($this->showTree) {
            $records = $query->getNested();
        }
        elseif ($this->showPagination) {
            $method            = $this->showPageNumbers ? 'paginate' : 'simplePaginate';
            $currentPageNumber = $this->getCurrentPageNumber($query);
            $records = $query->{$method}($this->recordsPerPage, $currentPageNumber);
        }
        else {
            $records = $query->get();
        }

        /**
         * @event backend.list.extendRecords
         * Provides an opportunity to modify and / or return the `$records` Collection object before the widget uses it.
         *
         * Example usage:
         *
         *     Event::listen('backend.list.extendRecords', function($listWidget, $records) {
         *         $model = MyModel::where('always_include', true)->first();
         *         $records->prepend($model);
         *     });
         *
         * Or
         *
         *     $listWidget->bindEvent('list.extendRecords', function ($records) {
         *         $model = MyModel::where('always_include', true)->first();
         *         $records->prepend($model);
         *     });
         *
         */
        if ($event = $this->fireSystemEvent('backend.list.extendRecords', [&$records])) {
            $records = $event;
        }

        return $this->records = $records;
    }
1107527
public function getDirtyRelationships(): array
    {
        $dirtyAggregates = [];

        foreach ($this->relationships as $relation) {
            foreach ($relation as $aggregate) {
                if (!$aggregate->exists() || $aggregate->isDirty() || count($aggregate->getDirtyRelationships()) > 0) {
                    $dirtyAggregates[] = $aggregate;
                }
            }
        }

        return $dirtyAggregates;
    }
709340
public function getDatabases()
    {
        $data = [];

        foreach ($this->getMonitoredDatabases() as $db) {
            $data[] = ['connection' => $db['connection'],
                       'alert_greater_than_mb' => $db['alert_greater_than_mb'],
                       'alert_less_than_mb' => $db['alert_less_than_mb'],
                       'driver' => $this->getDriverName($db['connection']),
                       'status' => $this->checkDatabaseStatus($db['connection']),
                       'size' => $this->getDatabaseSize($db['connection'])];
        }

        return $data;
    }
282473
public function get_records() {
        global $DB;
        return $DB->get_records_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
    }