Warning |
---|
This page was adapted for DSpace 6 based on the DSpace 5 version. Not all functions have been tested. If you run into a problem, please leave a comment. |
Info |
---|
This page is related to DSpace 6. For DSpace 5 see Helper SQL functions for DSpace 5 is work in progress (copied from DSpace 5, being adapted for DSpace 6). |
If you are making custom SQL queries against the DSpace database, they can get very complex due to numerous joins between various levels of DSpace objects (bitstream, bundle, item, collection, community). These helper functions contain the joins so you don't have to write them every time. In other words, using one of these functions in your query saves you from typing the body of the function in your query.
...
Code Block | ||
---|---|---|
| ||
SELECT ds6_bitstream2item(123); -- 456 SELECT ds6_item2collectionhandle(456); -- '123456789/789' SELECT ds6_metadata_field2id('dc', 'title'); -- 64 SELECT ds6_metadata_field2id('dc', 'description', 'abstract'); -- 27 SELECT ds6_metadata_id2field(27); -- (dc,description,abstract) SELECT (ds6_metadata_id2field(27)).element; -- 'description' |
...
Overview
argument → result ↓ | bitstream | bundle | item | collection | community |
---|---|---|---|---|---|
bitstream | - | - | - | - | - |
bundle | ds6_bitstream2bundle | - | - | - | - |
item | ds6_bitstream2item ds6_bitstream2itemhandle | ds6_bundle2item ds6_bundle2itemhandle | ds6_item2itemhandle | - | - |
collection | ds6_bitstream2collection ds6_bitstream2collectionhandle | ds6_bundle2collection ds6_bundle2collectionhandle | ds6_item2collection | ds6_collection2collectionhandle ds6_collectionhandle2collection | - |
community | ds6_bitstream2community ds6_bitstream2communityhandle | ds6_bundle2community ds6_bundle2communityhandle | ds6_item2community | ds6_collection2community ds6_collection2communityhandle ds6_collectionhandle2community ds6_collectionhandle2communityhandle | ds6_community2communityhandle ds6_communityhandle2community |
...