Skip to content
Snippets Groups Projects
Select Git revision
  • 81e7d18efe79c67c8ee6fb8b927275fba5ae6d81
  • main default protected
  • dev protected
  • f-render-html-properties
  • f-vishesh0932-ext-cosmetics
  • f-table-references
  • f-update-legacy-adapter
  • f-refactor-refs
  • f-fix-caosadvancedtools-refs
  • f-linkahead-rename
  • f-citation-cff
  • f-map-resolve-reference
  • dev-bmpg
  • f-form-select
  • f-doc-extention
  • f-geo-position-records
  • f-data-analysis
  • f-area-folder-drop
  • f-fix-get-parents
  • f-fix-110
  • f-entity-state
  • v0.16.0
  • v0.15.2
  • v0.15.1
  • v0.15.0
  • v0.14.0
  • v0.13.3
  • v0.13.2
  • v0.13.1
  • v0.13.0
  • v0.12.0
  • v0.11.1
  • v0.11.0
  • v0.10.1
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
  • v0.6.0
  • v0.5.0
  • v0.4.2
41 results

ext_bottom_line_test_data.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    retrieveEntity.sql 6.43 KiB
    /*
     * ** header v3.0
     * This file is a part of the CaosDB Project.
     *
     * Copyright (C) 2018 Research Group Biomedical Physics,
     * Max-Planck-Institute for Dynamics and Self-Organization Göttingen
     * Copyright (C) 2020 IndiScale GmbH <info@indiscale.com>
     * Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as
     * published by the Free Software Foundation, either version 3 of the
     * License, or (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program. If not, see <https://www.gnu.org/licenses/>.
     *
     * ** end header
     */
    
    
    
    delimiter //
    
    drop procedure if exists db_5_0.retrieveEntity //
    
    /**
     * Select the content of an entity.
     *
     * By default the head is selected, but a specific version may be given.
     *
     * Parameters
     * ----------
     * EntityID
     *   The entity's id.
     * Version
     *   The version id.  In this procedure only, the version may also be given as
     *   `HEAD` for the latest version or as `HEAD~n`, which retrieves the n-th
     *   ancestor of `HEAD`.
     *
     * ResultSet
     * ---------
     * Tuple of (Datatype, Collection, EntityID, EntityName, EntityDesc,
     *           EntityRole, FileSize, FilePath, FileHash, ACL, Version)
     */
    create procedure db_5_0.retrieveEntity(
        in EntityID INT UNSIGNED,
        in Version VARBINARY(255))
    retrieveEntityBody: BEGIN
        DECLARE FilePath VARCHAR(255) DEFAULT NULL;
        DECLARE FileSize VARCHAR(255) DEFAULT NULL;
        DECLARE FileHash VARCHAR(255) DEFAULT NULL;
        DECLARE DatatypeID INT UNSIGNED DEFAULT NULL;
        DECLARE CollectionName VARCHAR(255) DEFAULT NULL;
        DECLARE IsHead BOOLEAN DEFAULT TRUE;
        DECLARE IVersion INT UNSIGNED DEFAULT NULL;
        DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
    
        SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID;
    
        IF InternalEntityID IS NULL THEN
            -- RETURN EARLY - Entity does not exist.
            SELECT 0 FROM entities WHERE 0 = 1;
            LEAVE retrieveEntityBody;
        END IF;