public function getMissingSosaListAtGeneration($gen){
        if(!$this->is_setup) return array();    
        if($gen){
            return $this->sosa_list_by_gen[$gen] = Database::prepare(
                'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'.
                ' FROM `##maj_sosa` schild'.
                ' LEFT JOIN `##maj_sosa` sfat ON ((schild.majs_sosa * 2) = sfat.majs_sosa AND schild.majs_gedcom_id = sfat.majs_gedcom_id AND schild.majs_user_id = sfat.majs_user_id)'.
                ' LEFT JOIN `##maj_sosa` smot ON ((schild.majs_sosa * 2 + 1) = smot.majs_sosa AND schild.majs_gedcom_id = smot.majs_gedcom_id AND schild.majs_user_id = smot.majs_user_id)'.
                ' WHERE schild.majs_gedcom_id = :tree_id AND schild.majs_user_id = :user_id'.
                ' AND schild.majs_gen = :gen'.
                ' AND (sfat.majs_sosa IS NULL OR smot.majs_sosa IS NULL)'.
                ' ORDER BY schild.majs_sosa ASC')
                ->execute(array(
                    'tree_id' => $this->tree->getTreeId(),
                    'user_id' => $this->user->getUserId(),
                    'gen' => $gen - 1
                ))->fetchAll(\PDO::FETCH_ASSOC);
        }
        return array();
    }