download_insert_metadata (public)

 download_insert_metadata repository_id archive_type_id revision_id \
    metadata_array

Defined in packages/download/tcl/download-procs.tcl

Do metadata insertion. Assume within transaction.

Parameters:
repository_id (required)
archive_type_id (required)
revision_id (required)
metadata_array (required)

Partial Call Graph (max 5 caller/called nodes):
%3 download_insert_revision download_insert_revision (public) download_insert_metadata download_insert_metadata download_insert_revision->download_insert_metadata db_dml db_dml (public) download_insert_metadata->db_dml db_list_of_lists db_list_of_lists (public) download_insert_metadata->db_list_of_lists download_metadata_column download_metadata_column (public) download_insert_metadata->download_metadata_column

Testcases:
No testcase defined.
Source code:
    array set metadata $metadata_array
    set metadata_list [db_list_of_lists survsimp_question_info_list {
        select
        dam.metadata_id,
        dam.data_type
        from download_archive_metadata dam
        where dam.repository_id = :repository_id and
        dam.computed_p = 'f' and
        (dam.archive_type_id = :archive_type_id or
         dam.archive_type_id is null)
        order by sort_key
    }]

    foreach metadata_info $metadata_list {
        set metadata_id [lindex $metadata_info 0]
        set data_type [lindex $metadata_info 1]
        set response $metadata($metadata_id)
        set answer_column [download_metadata_column $data_type]
        db_dml metadata_inserts "
         insert into download_revision_data(revision_id, metadata_id, $answer_column)
         values ( :revision_id, :metadata_id, :response )
        "
    }
Generic XQL file:
<fullquery name="download_insert_metadata.survsimp_question_info_list">
    <querytext>
      
select 
  dam.metadata_id,
  dam.data_type
from download_archive_metadata dam
where dam.repository_id = :repository_id and
      dam.computed_p = 'f' and
      (dam.archive_type_id = :archive_type_id or
       dam.archive_type_id is null)
order by sort_key
    
</querytext>
</fullquery>

<fullquery name="download_insert_metadata.metadata_inserts">
    <querytext>
      
insert into download_revision_data
(revision_id, metadata_id, $answer_column)
values 
( :revision_id, :metadata_id, :response )
        
</querytext>
</fullquery>
packages/download/tcl/download-procs.xql

PostgreSQL XQL file:
packages/download/tcl/download-procs-postgresql.xql

Oracle XQL file:
packages/download/tcl/download-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: