Subversion Repositories DevTools

Rev

Rev 5957 | Rev 6579 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5957 Rev 6538
Line 68... Line 68...
68
    oJSON.data("sReq_" & vName) = Request.QueryString(vName)
68
    oJSON.data("sReq_" & vName) = Request.QueryString(vName)
69
next
69
next
70
 
70
 
71
' Extract selected range
71
' Extract selected range
72
result = 0
72
result = 0
73
dim firstRow,lastRow
73
dim firstRow,lastRow,noBuildTime
74
firstRow = CLng(Request.QueryString("iDisplayStart"))
74
firstRow = CLng(Request.QueryString("iDisplayStart"))
75
lastRow = firstRow + CLng(Request.QueryString("iDisplayLength"))
75
lastRow = firstRow + CLng(Request.QueryString("iDisplayLength"))
76
 
76
 
77
' Define the data items to extract from the database
-
 
78
' An array of items to extract
-
 
79
'
-
 
80
Dim dataCols: dataCols = Array ( _
-
 
81
        "bi.PV_ID", _
-
 
82
        "bi.RTAG_ID" ,_
-
 
83
        "pv.pkg_id", _
-
 
84
        "pj.PROJ_NAME", _
-
 
85
        "pj.PROJ_ID", _
-
 
86
        "RTAG_NAME", _
-
 
87
        "p.PKG_NAME", _
-
 
88
        "pv.PKG_VERSION", _
-
 
89
        "pv.PV_DESCRIPTION", _
-
 
90
        "pv.COMMENTS", _
-
 
91
        "NVL(pv.V_EXT, '') as V_EXT", _
-
 
92
        "TO_CHAR(bi.TIMESTAMP, 'Dy DD-Mon-YYYY HH24:MI:SS') as TIMESTAMPTXT", _
-
 
93
        "DECODE(bi.reason, 'N', 'New Version', 'R', 'Ripple', 'T', 'Test', 'P', 'Restored', 'Unknown') as REASON" ,_
-
 
94
        "DECODE(bi.state, 'B', 'Buiding', 'C', 'Complete', 'E', 'Error', 'S', 'SysErr', 'Unknown') as STATE",_
-
 
95
        "bi.build_id" )
-
 
96
 
-
 
97
'   Define array of colums to sort by
77
'   Define array of colums to sort by
98
'       Must match user sort column request
78
'       Must match user sort column request
99
Dim sortCols: sortCols = Array ( _
79
Dim sortCols: sortCols = Array ( _
100
        "UPPER(pj.PROJ_NAME)",_
80
        "UPPER(pj.PROJ_NAME)",_
101
        "UPPER(rt.RTAG_NAME)",_
81
        "UPPER(rt.RTAG_NAME),build_id",_
102
        "UPPER(p.PKG_NAME)",_
82
        "UPPER(p.PKG_NAME),build_id",_
103
        "UPPER(pv.PKG_VERSION)",_
83
        "UPPER(p.PKG_NAME),UPPER(pv.PKG_VERSION)",_
104
        "bi.BUILD_ID",_
84
        "bi.BUILD_ID",_
105
        "UPPER(bi.reason)",_
85
        "UPPER(bi.reason),build_id",_
-
 
86
        "build_time,build_id,NOBUILDTIME",_
106
        "UPPER(bi.state)",_
87
        "UPPER(bi.state),build_id",_
107
        "build_id" )
88
        "build_id" )
108
 
89
 
109
' Dim determine sorting options
90
' Dim determine sorting options
110
'On Error goto 0
91
'On Error goto 0
111
'Response.Write "<pre>"
92
'Response.Write "<pre>"
112
Dim sortString
93
Dim sortString
113
If Request.QueryString("iSortCol_0") <> "" Then
94
If Request.QueryString("iSortCol_0") <> "" Then
114
    sortString = " ORDER BY " & sortCols(CLng(Request.QueryString("iSortCol_0")))
95
    Dim splitArg: splitArg = Split( sortCols(CLng(Request.QueryString("iSortCol_0"))), "," )
-
 
96
    Dim splitItem, joiner
-
 
97
    joiner = ""
-
 
98
    for each splitItem in splitArg
-
 
99
        If splitItem = "NOBUILDTIME" Then
-
 
100
            noBuildTime = " AND PV.BUILD_TIME is not null"
-
 
101
        Else
115
    sortString = sortString & " " & Request.QueryString("sSortDir_0")
102
            sortString = sortString & joiner & splitItem & " " & Request.QueryString("sSortDir_0")
-
 
103
            joiner = ","
-
 
104
        End If
-
 
105
    next
-
 
106
    sortString = " ORDER BY " & sortString
116
End If
107
End If
117
 
108
 
118
' Filter (search )
109
' Filter (search )
119
Dim searchString
110
Dim searchString
120
If Request.QueryString("sSearch") <> "" Then
111
If Request.QueryString("sSearch") <> "" Then
121
    searchString = " AND upper(p.PKG_NAME) LIKE upper('%" & Request.QueryString("sSearch") & "%')" 
112
    searchString = " AND upper(p.PKG_NAME) LIKE upper('%" & Request.QueryString("sSearch") & "%')" 
122
End If
113
End If
123
 
114
 
124
' Create a list of cols that we need. Avoids ambiguity in selections
-
 
125
Dim x,colList,colListJoin
-
 
126
For x = Lbound(dataCols) to Ubound(dataCols)
-
 
127
    colList = colList & colListJoin & dataCols(x)
-
 
128
    colListJoin = ","
-
 
129
Next
-
 
130
 
-
 
131
Dim whereString
115
Dim whereString
132
If parRtagId <> "" Then
116
If parRtagId <> "" Then
133
    whereString = " AND bi.rtag_id = " &  parRtagId
117
    whereString = " AND bi.rtag_id = " &  parRtagId
134
End If
118
End If
135
 
119
 
136
Dim BasicSql
120
Dim BasicSql
137
BasicSql = "select " & colList &_
121
BasicSql =  "SELECT bi.PV_ID, " &_
-
 
122
            "  bi.RTAG_ID, " &_
-
 
123
            "  pv.pkg_id, " &_
-
 
124
            "  pj.PROJ_NAME, " &_
-
 
125
            "  pj.PROJ_ID, " &_
-
 
126
            "  RTAG_NAME, " &_
-
 
127
            "  p.PKG_NAME, " &_
-
 
128
            "  NVL(pv.V_EXT, '') AS V_EXT, " &_
-
 
129
            "  TO_CHAR(bi.TIMESTAMP, 'Dy DD-Mon-YYYY HH24:MI:SS') AS TIMESTAMPTXT, " &_
-
 
130
            "  DECODE(bi.reason, 'N', 'New Version', 'R', 'Ripple', 'T', 'Test', 'P', 'Restored', 'Unknown') AS REASON, " &_
-
 
131
            "  DECODE(bi.state, 'B', 'Buiding', 'C', 'Complete', 'E', 'Error', 'S', 'SysErr', 'Unknown') AS STATE, " &_
-
 
132
            "  bi.build_id " &_
138
            " from BUILD_INSTANCES bi, " &_
133
            "FROM BUILD_INSTANCES bi, " &_
139
            "     projects pj, " &_
134
            "  projects pj, " &_
140
            "     RELEASE_TAGS rt, " &_
135
            "  RELEASE_TAGS rt, " &_
141
            "     packages p, " &_
136
            "  packages p, " &_
142
            "     PACKAGE_VERSIONS pv" &_
137
            "  PACKAGE_VERSIONS pv " &_
143
            " where bi.PV_ID = pv.pv_id " &_
138
            "WHERE bi.PV_ID = pv.pv_id " &_
144
            "  and pv.PKG_ID = p.PKG_ID" &_
139
            "AND pv.PKG_ID  = p.PKG_ID " &_
145
            "  and bi.RTAG_ID = rt.RTAG_ID" &_
140
            "AND bi.RTAG_ID = rt.RTAG_ID " &_
146
            "  and rt.proj_id = pj.proj_id" &_
141
            "AND rt.proj_id = pj.proj_id " &_
-
 
142
            noBuildTime &_
147
            whereString &_
143
            whereString &_
148
            searchString &_
144
            searchString &_
149
            sortString
145
            sortString
150
 
146
 
-
 
147
SqlQry = "Select z.*," &_
151
SqlQry = "Select z.*, (SELECT COUNT(*) FROM TEST_RUN tr WHERE tr.build_id = z.build_id ) AS test_count from (select * from ( "&_
148
            "(SELECT COUNT(*) FROM TEST_RUN tr WHERE tr.build_id = z.build_id ) AS test_count, " &_
-
 
149
            "(SELECT PKG_VERSION FROM PACKAGE_VERSIONS pv1 WHERE pv1.pv_id = z.pv_id ) AS PKG_VERSION, " &_
-
 
150
            "(SELECT PV_DESCRIPTION FROM PACKAGE_VERSIONS pv1 WHERE pv1.pv_id = z.pv_id ) AS PV_DESCRIPTION, " &_
-
 
151
            "(SELECT COMMENTS FROM PACKAGE_VERSIONS pv1 WHERE pv1.pv_id = z.pv_id ) AS COMMENTS, " &_
-
 
152
            "(SELECT BUILD_TIME FROM PACKAGE_VERSIONS pv1 WHERE pv1.pv_id = z.pv_id  ) AS BUILD_TIME" &_
-
 
153
            " from (select * from ( "&_
152
            "select /*+ FIRST_ROWS(n) */ a.*, ROWNUM rnum from (" & BasicSql &_
154
            "select /*+ FIRST_ROWS("& lastRow &") */ a.*, ROWNUM rnum from (" & BasicSql &_
153
                ") a where ROWNUM <= " & lastRow &_
155
                ") a where ROWNUM <= " & lastRow &_
154
            ") where rnum >= " & firstRow & ") z"
156
            ") where rnum >= " & firstRow & ") z"
155
 
157
 
156
' Assist in debug
158
' Assist in debug
157
oJSON.data("BasicSql") = BasicSql
159
oJSON.data("BasicSql") = BasicSql
Line 172... Line 174...
172
       ' Attempt to speed up access tot he data
174
       ' Attempt to speed up access tot he data
173
       '    Extract all fields for the row
175
       '    Extract all fields for the row
174
       '    Access fields by index
176
       '    Access fields by index
175
       Dim fields
177
       Dim fields
176
       Set fields = rsQry.Fields
178
       Set fields = rsQry.Fields
-
 
179
       Dim pv_id        : pv_id = fields(0)
-
 
180
       Dim rtag_id      : rtag_id = fields(1)
-
 
181
       Dim pkg_id       : pkg_id = fields(2)
177
       Dim proj_name    : proj_name = fields(3)
182
       Dim proj_name    : proj_name = fields(3)
178
       Dim proj_id      : proj_id = fields(4)
183
       Dim proj_id      : proj_id = fields(4)
179
       Dim rtag_name    : rtag_name = fields(5)
184
       Dim rtag_name    : rtag_name = fields(5)
180
       Dim pkg_name     : pkg_name = fields(6)
185
       Dim pkg_name     : pkg_name = fields(6)
181
       Dim pkg_id       : pkg_id = fields(2)
186
       Dim v_ext        : v_ext = fields(7)
182
       Dim v_ext        : v_ext = fields(10)
187
       Dim timestamp    : timestamp = fields(8)
183
       Dim description  : description = Server.HTMLEncode(fields(8))
188
       Dim reason       : reason = fields(9)
184
       Dim pv_id        : pv_id = fields(0)
189
       Dim state        : state = fields(10)
185
       Dim rtag_id      : rtag_id = fields(1)
190
       Dim buildId      : buildId = fields(11)
186
       Dim comments     : comments = Server.HTMLEncode(fields(9))
191
       Dim tcount       : tcount = fields(13)
187
       Dim pkg_version  : pkg_version = fields(7)
192
       Dim pkg_version  : pkg_version = fields(14)
188
       Dim timestamp    : timestamp = fields(11)
-
 
189
       Dim reason       : reason = fields(12)
193
       Dim description  : description = Server.HTMLEncode(fields(15))
190
       Dim state        : state = fields(13)
194
       Dim comments     : comments = Server.HTMLEncode(fields(16))
191
       Dim tcount       : tcount = fields(16)
195
       Dim buildTime    : buildTime = Server.HTMLEncode(fields(17))
192
 
196
 
193
       Set fields = nothing
197
       Set fields = nothing
194
 
198
 
-
 
199
        If buildTime <= 0 Then buildTime = ""
-
 
200
        If tcount <= 0 Then tcount = ""
-
 
201
 
195
        newitem(0) = "<a href='rtree.asp?proj_id=" & proj_id & "'>" & proj_name & "</a>"
202
        newitem(0) = "<a href='rtree.asp?proj_id=" & proj_id & "'>" & proj_name &"</a>"
196
        newitem(1) = "<a href='dependencies.asp?rtag_id=" & rtag_id & "'>" & rtag_name & "</a>"
203
        newitem(1) = "<a href='dependencies.asp?rtag_id=" & rtag_id & "'>" & rtag_name & "</a>"
197
        newitem(2) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title=""" & description & """>" & pkg_name & "</a>"
204
        newitem(2) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title=""" & description & """>" & pkg_name & "</a>"
198
        newitem(3) =  "<a href='dependencies.asp?pv_id=" & pv_id & "&rtag_id=" & rtag_id &"' title=""" & comments & """>" & pkg_version & "</a>"
205
        newitem(3) =  "<a href='dependencies.asp?pv_id=" & pv_id & "&rtag_id=" & rtag_id &"' title=""" & comments & """>" & pkg_version & "</a>"
199
        newitem(4) = timestamp
206
        newitem(4) = timestamp
200
        newitem(5) = reason
207
        newitem(5) = reason
-
 
208
        newitem(6) = buildTime
201
        newitem(6) = "<a href='unit_test_log.asp?rtag_id=" & rtag_id & "&pv_id=" & pv_id & "'>" & state & "</a>"
209
        newitem(7) = "<a href='unit_test_log.asp?rtag_id=" & rtag_id & "&pv_id=" & pv_id & "'>" & state & "</a>"
202
        If tcount <= 0 Then tcount = ""
-
 
203
        newitem(7) = tcount
210
        newitem(8) = tcount
204
 
211
 
205
       rsQry.MoveNext
212
       rsQry.MoveNext
206
   Wend
213
   Wend
207
End IF
214
End IF
208
 
215