Subversion Repositories DevTools

Rev

Rev 123 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 123 Rev 129
Line 371... Line 371...
371
   End Select
371
   End Select
372
 
372
 
373
End Sub
373
End Sub
374
'--------------------------------------------------------------------------------------------------------------------------
374
'--------------------------------------------------------------------------------------------------------------------------
375
Function Get_Record_Count ( SSsql )
375
Function Get_Record_Count ( SSsql )
376
	Dim rsTemp
376
   Dim rsTemp
377
   Set rsTemp = OraDatabase.DbCreateDynaset( "SELECT COUNT(*) as record_count FROM "& SSsql , cint(0))
377
   Set rsTemp = OraDatabase.DbCreateDynaset( "SELECT COUNT(*) as record_count FROM "& SSsql , cint(0))
378
 
378
 
379
	If (NOT rsTemp.BOF) AND (NOT rsTemp.EOF) Then
379
   If (NOT rsTemp.BOF) AND (NOT rsTemp.EOF) Then
380
		Get_Record_Count = rsTemp("record_count")
380
      Get_Record_Count = rsTemp("record_count")
381
	Else
381
   Else
382
		Get_Record_Count = 0
382
      Get_Record_Count = 0
383
	End If
383
   End If
384
	rsTemp.Close
384
   rsTemp.Close
385
	Set rsTemp = nothing
385
   Set rsTemp = nothing
386
End Function
386
End Function
387
'--------------------------------------------------------------------------------------------------------------------------
387
'--------------------------------------------------------------------------------------------------------------------------
388
' We need a way of discriminating between versions in the destination release that are pending, and those that are officially
388
' We need a way of discriminating between versions in the destination release that are pending, and those that are officially
389
' in the release. This function allows us to do that on the fly within the VBSCRIPT HTML generating code, indicating specifically
389
' in the release. This function allows us to do that on the fly within the VBSCRIPT HTML generating code, indicating specifically
390
' if the given PV_ID reflects a pending additive merge.
390
' if the given PV_ID reflects a pending additive merge.
391
Function Is_Pending_Add(NNrtag_id, NNpv_id)
391
Function Is_Pending_Add(NNrtag_id, NNpv_id)
392
   If IsNull(NNrtag_id) OR IsNull(NNpv_id) Then
392
   If IsNull(NNrtag_id) OR IsNull(NNpv_id) Then
393
      Is_Pending_Add = 0
393
      Is_Pending_Add = 0
394
   Else
394
   Else
395
      Is_Pending_Add = Get_Record_Count( "PLANNED pl WHERE pl.rtag_id = " & NNrtag_id & " AND pl.pv_id = " & NNpv_id & " AND pl.operation = 'A'" )
395
      Is_Pending_Add = Get_Record_Count( "PLANNED pl WHERE pl.rtag_id = " & NNrtag_id & " AND pl.pv_id = " & NNpv_id & " AND pl.operation = 'A'" )
396
	End If
396
   End If
397
End Function
397
End Function
398
'--------------------------------------------------------------------------------------------------------------------------
398
'--------------------------------------------------------------------------------------------------------------------------
399
' We need a way of discriminating between versions in the destination release that are pending, and those that are officially
399
' We need a way of discriminating between versions in the destination release that are pending, and those that are officially
400
' in the release. This function allows us to do that on the fly within the VBSCRIPT HTML generating code, indicating specifically
400
' in the release. This function allows us to do that on the fly within the VBSCRIPT HTML generating code, indicating specifically
401
' if the given PV_ID reflects a pending subtractive merge.
401
' if the given PV_ID reflects a pending subtractive merge.
Line 469... Line 469...
469
 
469
 
470
 
470
 
471
      ' Begin Database entry
471
      ' Begin Database entry
472
      objEH.TryORA ( OraSession )
472
      objEH.TryORA ( OraSession )
473
 
473
 
474
      OraSession.BeginTrans
-
 
475
 
-
 
476
      '-- Add Packages --
474
      '-- Add Packages --
477
      OraParameter("OPERATION").Value = "A"
475
      OraParameter("OPERATION").Value = "A"
478
      For Each PvId In aAddPkgList
476
      For Each PvId In aAddPkgList
479
         OraParameter("PV_ID").Value = PvId
477
         OraParameter("PV_ID").Value = PvId
480
         ' DEVI-45275, Merge into Planned (pending) table instead of release_content table.
478
         ' DEVI-45275, Merge into Planned (pending) table instead of release_content table.
481
         OraDatabase.ExecuteSQL _
-
 
482
         "BEGIN  "&_
-
 
483
         "  :VIEW_ID := PK_RELEASE.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_A ); "&_
-
 
484
         "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
-
 
485
         "END;"
-
 
486
      Next
-
 
487
 
-
 
488
      '-- Remove Packages --
-
 
489
      OraParameter("OPERATION").Value = "S"
-
 
490
      For Each PvId In aRemovePkgList
-
 
491
         OraParameter("PV_ID").Value = PvId
-
 
492
 
-
 
493
         ' Does this PV_ID exist in the destination release's planned table?
-
 
494
         rc = Get_Record_Count ("PLANNED pl WHERE pl.pv_id = " & PvId & " AND pl.rtag_id = " & Request("rtagB") )
-
 
495
         If  rc > 0 Then
479
         If Err.Number = 0 Then
496
            ' Given that merging now merges into pending, the merge page may be used to remove items that have
-
 
497
            ' previously been merged but have not yet been committed to the destination release. For these,
-
 
498
            ' we cannot call PK_RELEASE.GET_PACKAGE_VIEW(). We have to call PK_PLANNED.GET_PACKAGE_VIEW() instead.
-
 
499
            OraDatabase.ExecuteSQL _
480
            OraDatabase.ExecuteSQL _
500
            "BEGIN  "&_
481
            "BEGIN  "&_
501
            "  :VIEW_ID := PK_PLANNED.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_B ); "&_
-
 
502
            "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
-
 
503
            "END;"
-
 
504
         Else
-
 
505
            ' DEVI-45275, Merge into Planned (pending) table instead of release_content table.
-
 
506
            OraDatabase.ExecuteSQL _
-
 
507
            "BEGIN  "&_
-
 
508
            "  :VIEW_ID := PK_RELEASE.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_B ); "&_
482
            "  :VIEW_ID := PK_RELEASE.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_A ); "&_
509
            "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
483
            "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
510
            "END;"
484
            "END;"
511
         End If
485
         End If
512
 
-
 
513
         OraDatabase.Parameters.Remove "RECORD_COUNT"
-
 
514
      Next
486
      Next
515
 
487
 
516
      '-- Log Project Merge Action
488
      '-- Remove Packages --
517
      OraDatabase.ExecuteSQL _
489
      If Err.Number = 0 Then
518
      "BEGIN  LOG_PROJECT_ACTION ( :PROJB, 'merge_release', :USER_ID, :COMMENTS, :RTAG_B );  END;"
490
         OraParameter("OPERATION").Value = "S"
-
 
491
         For Each PvId In aRemovePkgList
-
 
492
            OraParameter("PV_ID").Value = PvId
519
 
493
 
-
 
494
            If Err.Number = 0 Then
-
 
495
               ' Does this PV_ID exist in the destination release's planned table?
-
 
496
               rc = Get_Record_Count ("PLANNED pl WHERE pl.pv_id = " & PvId & " AND pl.rtag_id = " & Request("rtagB") )
520
      '-- Force package state recalculate
497
               If  rc > 0 Then
-
 
498
                  ' Given that merging now merges into pending, the merge page may be used to remove items that have
-
 
499
                  ' previously been merged but have not yet been committed to the destination release. For these,
-
 
500
                  ' we cannot call PK_RELEASE.GET_PACKAGE_VIEW(). We have to call PK_PLANNED.GET_PACKAGE_VIEW() instead.
521
      OraDatabase.ExecuteSQL _
501
                  OraDatabase.ExecuteSQL _
522
      "BEGIN  "&_
502
                  "BEGIN  "&_
-
 
503
                  "  :VIEW_ID := PK_PLANNED.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_B ); "&_
-
 
504
                  "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
-
 
505
                  "END;"
-
 
506
               Else
-
 
507
                  ' DEVI-45275, Merge into Planned (pending) table instead of release_content table.
-
 
508
                  OraDatabase.ExecuteSQL _
523
      "  TOUCH_RELEASE ( :RTAG_B );  "&_
509
                  "BEGIN  "&_
-
 
510
                  "  :VIEW_ID := PK_RELEASE.GET_PACKAGE_VIEW ( :PV_ID, :RTAG_B ); "&_
-
 
511
                  "  PK_PLANNED.MERGE_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_B, :USER_ID, :OPERATION );  "&_
-
 
512
                  "END;"
-
 
513
               End If
-
 
514
            End If
524
      "END;"
515
         Next
525
 
516
 
-
 
517
         '-- Log Project Merge Action
526
      OraSession.CommitTrans
518
         If Err.Number = 0 Then
-
 
519
            OraDatabase.ExecuteSQL _
-
 
520
            "BEGIN  LOG_PROJECT_ACTION ( :PROJB, 'merge_release', :USER_ID, :COMMENTS, :RTAG_B );  END;"
-
 
521
         End If
527
 
522
 
-
 
523
      End If
-
 
524
 
-
 
525
      objEH.CatchORA ( OraSession )    ' sets up LastOraFailed as appropriate
-
 
526
 
-
 
527
      ' NOTE, The Touch_Release stored procedure does a commit itself, so we should not do it unless all the ExecuteSQL's we
-
 
528
      ' have just performed, were successful
-
 
529
      If objEH.LastOraFailed = FALSE Then
-
 
530
         '-- Force package state recalculate
-
 
531
         objEH.TryORA ( OraSession )
-
 
532
         OraDatabase.ExecuteSQL _
-
 
533
            "BEGIN  "&_
-
 
534
            "  TOUCH_RELEASE ( :RTAG_B );  "&_
-
 
535
            "END;"
528
      objEH.CatchORA ( OraSession )
536
         objEH.CatchORA ( OraSession )
-
 
537
      End If
529
 
538
 
530
      Set OraParameter = Nothing
539
      Set OraParameter = Nothing
531
      OraDatabase.Parameters.Remove "PV_ID"
540
      OraDatabase.Parameters.Remove "PV_ID"
532
      OraDatabase.Parameters.Remove "VIEW_ID"
541
      OraDatabase.Parameters.Remove "VIEW_ID"
533
      OraDatabase.Parameters.Remove "RTAG_A"
542
      OraDatabase.Parameters.Remove "RTAG_A"