Subversion Repositories DevTools

Rev

Rev 6688 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   gotoLatestInRelease.asp
'   
'   This page will redirect the user the current version of a package within a release
'   It may be used to provide a dynamic link to a user
'
'   Can also provide text output for the purposes of scripting
'
'   Requires one of
'             rtag_id=nnn               ' Release Tag
'             pname=aaaa&rname=aaaa     ' Project Name and Release Name
'
'   Requires one of:
'             pv_id=nnn
'             pkg_id=nn
'             pkgName=aaaa
'   Optional: page=name
'             If page is 'show' then the version of the package will be retuened as a single line of text
'=====================================================
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<%
Dim Query_String
Dim pvId
Dim pkgVersion
Dim parPage
Dim parPkgId
Dim parPkgName
Dim parProjName
Dim parRelName
Dim url

parPage = RequestDefault("page", "dependencies.asp")
parPkgId = Request("pkg_id")
parPkgName = Request("pkgName")
parProjName = Request("pname")
parRelName = Request("rname")

'
'   Determine the release (rtag_id)
'   If we have an rtg_id, then ist simple, otherwise we need to locate it
'
If DB_RTAG_ID = -1 Then
    OraDatabase.Parameters.Add "PROJ_NAME",  parProjName, ORAPARM_INPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "REL_NAME",   parRelName, ORAPARM_INPUT, ORATYPE_NUMBER
    Query_String = "select rt.rtag_id from release_tags rt, projects p" &_
                   " where p.PROJ_ID = rt.PROJ_ID" &_
                   " and Upper(p.PROJ_NAME) = Upper(:PROJ_NAME)" &_
                   " and Upper(rt.RTAG_NAME) = Upper(:REL_NAME)"

    Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
    If rsTemp.RecordCount > 0 Then
        DB_RTAG_ID = (rsTemp.Fields("rtag_id"))
    End If
    OraDatabase.Parameters.Remove "REL_NAME"
    OraDatabase.Parameters.Remove "PROJ_NAME"
End If


OraDatabase.Parameters.Add "PKG_NAME",  parPkgName, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "PKG_ID",    parPkgId,   ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "PV_ID",     DB_PV_ID,   ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "RTAG_ID",   DB_RTAG_ID, ORAPARM_INPUT, ORATYPE_NUMBER

If parPkgName <> "" Then
    Query_String = "select rc.pv_id, pv.pkg_version from" &_
                   " release_content rc, PACKAGE_VERSIONS pv, PACKAGES p" &_
                   " WHERE rc.rtag_id = :RTAG_ID" &_
                   " and rc.PV_ID = pv.pv_id" &_
                   " and pv.pkg_id = p.pkg_id" &_
                   " and ( p.pkg_name = :PKG_NAME or p.pkg_name || NVL(pv.V_EXT,'') = :PKG_NAME)"

ElseIf DB_PV_ID <> -1 Then
    Query_String = "select rc.pv_id, pv.pkg_version from" &_
                   " release_content rc, PACKAGE_VERSIONS pv" &_
                   " WHERE rc.rtag_id = :RTAG_ID" &_
                   " and rc.PV_ID = pv.pv_id" &_
                   " and pv.pkg_id = ( select pkg_id from PACKAGE_VERSIONS where pv_id = :PV_ID)" &_
                   " and NVL(pv.V_EXT,'.NULL') = ( select NVL(v_ext,'.NULL') from PACKAGE_VERSIONS where pv_id = :PV_ID)"
Else
    Query_String = "select rc.pv_id, pv.PKG_VERSION from" &_
                   " release_content rc, PACKAGE_VERSIONS pv" &_
                   " WHERE rc.rtag_id = :RTAG_ID" &_
                   " and rc.PV_ID = pv.pv_id" &_
                   " and pv.pkg_id = :PKG_ID"
End If

Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
If rsTemp.RecordCount > 0 Then
    pvId = (rsTemp.Fields("pv_id"))
    pkgVersion = (rsTemp.Fields("pkg_version"))
End If

OraDatabase.Parameters.Remove "PKG_NAME"
OraDatabase.Parameters.Remove "PKG_ID"
OraDatabase.Parameters.Remove "PV_ID"
OraDatabase.Parameters.Remove "RTAG_ID"

' Determine output mode
'   show or redirectuion
  
If parPage = "show" Then
    Response.Write pkgVersion & vbCrLf
    Response.End
End If

url = parPage & "?rtag_id=" & DB_RTAG_ID & "&pv_id=" & pvId
Response.Redirect url
%>