Ignore:
Timestamp:
Jun 24, 2010, 12:03:34 PM (11 years ago)
Author:
dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/sourcefile

    r9592 r9593  
    500500   query=" UPDATE "$step"Status "
    501501   # add joins to the influenced tables
     502   stepspecialjoin=""
    502503   for influence in $influences
    503504   do
    504       # make sure that the right join is done
    505       #   in case the is a 'Join' given for the
    506       #   influenced step, this is added
    507       # otherwise it is checked whether the executed step
    508       #   itself needs a 'Join' (i.e. has different primaries)
    509       #   if yes, the tables are joined with the primaries of the influenced step
    510       #   else with the primaries of the executed step itself
    511       stdjoin=`getjoin $influence`
    512       if ! [ "$stdjoin" = "" ]
     505      inflprims=( `getprimary $influence` )
     506      # make sure that the correct joins are used
     507      # in case the primaries of the step and the influence are
     508      #   the same, the tables are join with these primaries
     509      # otherwise they are joined with the primaries of the influence
     510      if [ "`echo ${inflprims[@]}`" == "`echo ${prims[@]}`" ]
    513511      then
    514          query=$query" "$stdjoin" "
    515       else
    516          stdjoin2=`getjoin $step`
    517          if [ "$stdjoin2" == "" ]
     512         query=$query" LEFT JOIN "$influence"Status USING (${prims[@]}) "
     513      else
     514         prims2=`getprimary $step | sed -e "s/\ //g"`
     515         primstest=`echo ${inflprims[@]} | sed -e "s/\ //g" | sed -e "s/$prims2//g"`
     516         if [ "$primstest" == "`echo ${inflprims[@]} | sed -e "s/\ //g"`" ]
    518517         then
    519             query=$query" LEFT JOIN "$influence"Status USING("`getprimary $influence`") "
     518            if [ "$stepspecialjoin" == "" ]
     519            then
     520               stepspecialjoin=`getspecialjoin $step`
     521               query=$query" "$stepspecialjoin" "
     522            fi
     523            query=$query" LEFT JOIN "$influence"Status USING (${inflprims[@]}) "
    520524         else
    521             query=$query" LEFT JOIN "$influence"Status USING("`getprimary $step`") "
     525            infljoin=`getjoin $influence`
     526            if [ "$infljoin" = "" ]
     527            then
     528               query=$query" LEFT JOIN "$influence"Status USING (${prims[@]}) "
     529            else
     530               query=$query" "$infljoin
     531               # warning: this is a workaround
     532               #  it has to be checked whether it works for all steps
     533               stepspecialjoin="not empty"
     534            fi
    522535         fi
    523536      fi
     
    543556      s=0
    544557   fi
    545    query=$query" "`echo ${prims[0]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}]}'"
     558   query=$query" "$step"Status."`echo ${prims[0]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}]}'"
    546559   for (( j=1 ; j < ${#prims[@]} ; j++ ))
    547560   do
    548       query=$query" AND "`echo ${prims[$j]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}+$j]}' "
     561      query=$query" AND "$step"Status."`echo ${prims[$j]} | sed -e 's/,//g'`"='${primaries[$s*${#prims[@]}+$j]}' "
    549562   done   
    550563   # print query
Note: See TracChangeset for help on using the changeset viewer.