//delete already copied record from master temp table
$query='DELETE FROM '.$this->GetTempName($master['TableName']).'
WHERE '.$master['IdField'].' = '.$id_to_copy;
if(isset($master['Constrain']))$query.=' AND '.$master['Constrain'];
$this->Conn->Query($query);
}
$this->CopiedTables[]=$table_sig;
// when all of ids in current master has been processed, copy all sub-tables data
$this->CopySubTablesToLive($master,$current_ids);
}
elseif(!in_array($table_sig,$this->CopiedTables)&&($this->FinalRefs[$table_sig]==$master['TableId'])){//If current master doesn't have sub-tables - we could use mass operations
// We don't need to delete items from live here, as it get deleted in the beggining of the method for MasterTable