Subversion Repositories DevTools

Rev

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

Rev 5957 Rev 7250
Line 45... Line 45...
45
    End If
45
    End If
46
rsQry.Close
46
rsQry.Close
47
Set rsQry = Nothing
47
Set rsQry = Nothing
48
 
48
 
49
' Basic Header
49
' Basic Header
50
oJSON.data("sEcho") = CInt(Request.QueryString("sEcho"))
50
oJSON.data("draw") = CInt(Request.QueryString("draw"))
51
oJSON.data("iTotalRecords") = MaxCount
51
oJSON.data("recordsTotal") = MaxCount
52
oJSON.data("iTotalDisplayRecords") = MaxCount
52
oJSON.data("recordsFiltered") = MaxCount
53
 
53
 
54
' Assist in debug
54
' Assist in debug
55
oJSON.data("iReqDisplayStart") = CInt(Request.QueryString("iDisplayStart"))
55
oJSON.data("start") = CInt(Request.QueryString("start"))
56
oJSON.data("iReqDisplayLength") = CInt(Request.QueryString("iDisplayLength"))
56
oJSON.data("length") = CInt(Request.QueryString("length"))
57
 
57
 
58
Dim vName
58
Dim vName
59
for each vName in Request.QueryString
59
for each vName in Request.QueryString
60
    oJSON.data("sReq_" & vName) = Request.QueryString(vName)
60
    oJSON.data("sReq_" & vName) = Request.QueryString(vName)
61
next
61
next
62
 
62
 
63
' Extract selected range
63
' Extract selected range
64
result = 0
64
result = 0
65
dim firstRow,lastRow
65
dim firstRow,lastRow
66
firstRow = CInt(Request.QueryString("iDisplayStart"))
66
firstRow = CInt(Request.QueryString("start"))
67
lastRow = firstRow + CInt(Request.QueryString("iDisplayLength"))
67
lastRow = firstRow + CInt(Request.QueryString("length"))
68
 
68
 
69
' Define the data items to extract from the database
69
' Define the data items to extract from the database
70
' Format is:
70
' Format is:
71
'   1) Name of Database column
71
'   1) Name of Database column
72
'   2) Expression::Name of Database column
72
'   2) Expression::Name of Database column
Line 98... Line 98...
98
Next
98
Next
99
 
99
 
100
 
100
 
101
' Dim determine sorting options
101
' Dim determine sorting options
102
Dim sortString
102
Dim sortString
103
If Request.QueryString("iSortCol_0") <> "" Then
103
If Request.QueryString("order[0][column]") <> "" Then
104
    sortString = " ORDER BY " & dataCols(CInt(Request.QueryString("iSortCol_0")))
104
    sortString = " ORDER BY " & dataCols(CInt(Request.QueryString("order[0][column]")))
105
    sortString = sortString & " " & Request.QueryString("sSortDir_0")
105
    sortString = sortString & " " & Request.QueryString("order[0][dir]")
106
End If
106
End If
107
 
107
 
108
' Create a list of cols that we need. Avoids ambiguity in selections
108
' Create a list of cols that we need. Avoids ambiguity in selections
109
Dim colList,colListJoin
109
Dim colList,colListJoin
110
For x = Lbound(dataCols) to Ubound(dataCols)
110
For x = Lbound(dataCols) to Ubound(dataCols)
Line 129... Line 129...
129
' Assist in debug
129
' Assist in debug
130
oJSON.data("BasicSql") = BasicSql
130
oJSON.data("BasicSql") = BasicSql
131
'oJSON.data("SqlQry") = SqlQry
131
'oJSON.data("SqlQry") = SqlQry
132
 
132
 
133
' Perform the database query
133
' Perform the database query
134
Set oJSON.data("aaData") = oJSON.Collection()
134
Set oJSON.data("data") = oJSON.Collection()
135
On Error Resume Next
135
On Error Resume Next
136
objEH.ErrorRedirect = FALSE
136
objEH.ErrorRedirect = FALSE
137
objEH.TryORA ( OraSession )
137
objEH.TryORA ( OraSession )
138
Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
138
Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
139
objEH.CatchORA ( OraSession )
139
objEH.CatchORA ( OraSession )
140
 
140
 
141
' Return all fields to the user as an array
141
' Return all fields to the user as an array
142
If objEH.Finally Then
142
If objEH.Finally Then
143
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
143
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
144
        Set newitem = oJSON.AddToCollection(oJSON.data("aaData"))
144
        Set newitem = oJSON.AddToCollection(oJSON.data("data"))
145
        Dim ii
145
        Dim ii
146
        for ii = 0 to rsQry.Fields.Count - 1
146
        for ii = 0 to rsQry.Fields.Count - 1
147
            newitem(ii) = rsQry.Fields(ii)
147
            newitem(ii) = rsQry.Fields(ii)
148
        Next
148
        Next
149
        rsQry.MoveNext
149
        rsQry.MoveNext