<#if etl_step_lookup_systeminfo(step.etl_job)==-1><#stop "DEFINITIONSFEHLER: Etl_step '"+step.uniquename+ "' verweist auf job '"+step.etl_job+"' der liefert aber keine systeminfo_id"> </#if>\
--jobs with custom_job=0 get deleted in HISinOne-BI\
--therefore set to 2:\
update etl_job set custom_job=2\
where custom_job=0\
and uniquename in ('sx_select_mask','sx_insert_mask',\
'kern_konstanten_update',\
'sichten_unload',\
'sos_gewichtung_unload');\
\
\
update etl_step set custom_step=2\
where custom_step=0\
and tid in (select R.step_id from etl_step_relation R, etl_job J\
where R.job_id=J.tid\
and J.uniquename in ('sx_select_mask','sx_insert_mask',\
'kern_konstanten_update',\
'sichten_unload',\
'sos_gewichtung_unload'));\
\
update etl_step_relation set custom_step=2\
where custom_step=0\
and job_id in (select J.tid\
from etl_job J\
where J.uniquename in ('sx_select_mask','sx_insert_mask',\
'kern_konstanten_update',\
'sichten_unload',\
'sos_gewichtung_unload'));\
\
<#foreach etl_job in etl_jobs>\
\
truncate table tmp_etl_job;\
@ -81,10 +161,9 @@ insert into tmp_etl_job(uniquename,caption,systeminfo_id,logfile,already_exists,
@@ -81,10 +161,9 @@ insert into tmp_etl_job(uniquename,caption,systeminfo_id,logfile,already_exists,
values ('${etl_job.uniquename}',\
'${etl_job.name}',\
${etl_job.systeminfo_id},\
'${etl_job.logfile}',0,0);\
'${etl_job.logfile}',0,2);\
\
\
<#if SQLdialect='Postgres'>\
--Postgres Dialekt:\
\
update tmp_etl_job set tid=J.tid,\
already_exists=1,\
@ -95,33 +174,6 @@ from etl_job J where J.uniquename=tmp_etl_job.uniquename\
@@ -95,33 +174,6 @@ from etl_job J where J.uniquename=tmp_etl_job.uniquename\
and J.systeminfo_id=tmp_etl_job.systeminfo_id\
;\
\
<#else>\
\
--Informix Dialekt:\
update tmp_etl_job set (tid,\
already_exists,\
caption,\
logfile,\
custom_job) \
= ((select \
tid,\
1 as already_exists,\
caption,\
logfile,\
custom_job\
from etl_job J where J.uniquename=tmp_etl_job.uniquename\
and J.systeminfo_id=tmp_etl_job.systeminfo_id))\
where 0 <(select count(*)\
from etl_job J where J.uniquename=tmp_etl_job.uniquename\
and J.systeminfo_id=tmp_etl_job.systeminfo_id)\
\
;\
\
</#if>\
\
\
\
--TODO Informix\
\
--neue jobs:\
insert into etl_job(uniquename,caption,systeminfo_id,custom_job)\
@ -194,7 +246,7 @@ J.tid as etl_job_id,\
@@ -194,7 +246,7 @@ J.tid as etl_job_id,\
</#if>\
J.uniquename,\
'${etl_job.logfile}' as logfile,\
0,\
2,\
0\
from etl_job J\
where J.uniquename='${etl_job.uniquename}'\
@ -236,10 +288,12 @@ FROM tmp_etl_job_param \
@@ -236,10 +288,12 @@ FROM tmp_etl_job_param \
update tmp_etl_step set step_type=(select T.tid from etl_step_type T\
where T.uniquename=tmp_etl_step.step_type_uniquename);\
\
--select * from tmp_etl_step\
--where step_type is null;--_uniquename from tmp_etl_step;\
@ -394,7 +423,6 @@ drop table tmp_etl_job_param;\
@@ -394,7 +423,6 @@ drop table tmp_etl_job_param;\
drop table tmp_etl_step_property;\
drop table tmp_etl_step_relation;\
\
<#if testfaelle?exists>\
\
<#foreach testfall in testfaelle>\
select 'testfall ${testfall.testcase}: ERFOLG'\
@ -408,30 +436,69 @@ where ${testfall.assertion}!=(${testfall.sql})\
@@ -408,30 +436,69 @@ where ${testfall.assertion}!=(${testfall.sql})\
\
\
</#foreach> --Ende Testfälle\
</#if>\
\
<#if SQLdialect='Informix'> \
--nun xupdates:\
--bei informix kann man TEXT Spalten nicht updaten, daher per jdbc updaten:\
--damit DOSQL nicht den xupdater beim Start dieses Scriptes anwirft,\
--wird das in eine temp. Datei ausgelagert.\
! echo "<xup""date>" > "./tmp"$MANDANTID".sql"\
<#foreach etl_step_property in etl_step_properties>\
\
! echo '<text table="etl_step_property" field="prop_value" where="prop_name='\\''${etl_step_property.prop_name}'\\'' and etl_step_id=(select S.tid from etl_step S where S.uniquename='\\''${etl_step_property.etl_step}'\\'')">${etl_step_property.prop_value}</text>' >>"./tmp"$MANDANTID".sql"\
update etl_step_property set prop_value='${etl_step_property.prop_value}' where prop_name='${etl_step_property.prop_name}' and etl_step_id=(select S.tid from etl_step S where S.uniquename='${etl_step_property.etl_step}');\
</#foreach>\
</#macro>\
\
\
<#-- Makro zum Prüfen der Definition auf mögliche Fehler -->\
<#if found=false> <#stop "DEFINITIONSFEHLER: Etl_step '"+step.uniquename+ "' verweist auf job '"+step.etl_job+"' der ist aber nicht definiert!"> </#if>\
<#-- checking step type-->\
<#switch step.type>\
<#case "LOAD">\
<#case "UNLOAD">\
<#case "DOSQL">\
<#case "DOQUERY">\
<#case "MSG"><#-- MSG wird von HisInOne noch nicht unterstuetzt-->\
<#break/>\
<#default>\
<#stop "DEFINITIONSFEHLER: Etl_step '"+step.uniquename+ "' hat unbekannten Typ '"+step.type+"'"> \
</#switch>\
</#foreach>\
! echo "</xup""date>" >> "./tmp"$MANDANTID".sql"\
! DOSQL "./tmp"$MANDANTID".sql"\
\
<#else>\
--Postgres:\
<#foreach etl_step_property in etl_step_properties>\
<#-- checking step properties existing step-->\
<#foreach step_prop in etl_step_properties>\
\
update etl_step_property set prop_value='${etl_step_property.prop_value?replace("'", "''")}' where prop_name='${etl_step_property.prop_name}' and etl_step_id=(select S.tid from etl_step S where S.uniquename='${etl_step_property.etl_step?replace("'", "''")}');\
<#if found=false> <#stop "DEFINITIONSFEHLER: Eine Etl_step_property '"+step_prop.prop_name+ "' verweist auf etl_step '"+step_prop.etl_step+"' der ist aber nicht definiert!"> </#if>\