-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathte_queryinfo.asp
157 lines (135 loc) · 4.72 KB
/
te_queryinfo.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_queryinfo.asp
' Description: Displays query information
' Initiated By Hakan Eskici on Nov 07, 2000
'--------------------------------------------------------------
' Copyright (c) 2002, 2eNetWorX/dev.
'
' TableEditoR is distributed with General Public License.
' Any derivatives of this software must remain OpenSource and
' must be distributed at no charge.
' (See license.txt for additional information)
'
' See Credits.txt for the list of contributors.
'
' Change Log:
'--------------------------------------------------------------
' # Nov 22, 2000 by Hakan Eskici
' Renamed the file from te_tableinfo.asp (which is replaced by
' te_tableedit.asp) to te_queryinfo.asp
' Removed listing of indexes
'==============================================================
%>
<!--#include file="te_config.asp"-->
<!--#include file="te_header.asp"-->
<table border=0 cellspacing=1 cellpadding=2 bgcolor="#ffe4b5" width="100%">
<tr>
<td class="smallertext">
<a href="index.asp">Home</a> » <a href="te_admin.asp">Connections</a> » <a href="te_listtables.asp?cid=<%=request("cid")%>"><%=arrDesc(request("cid"))%></a> » Table Info [<%=request("tablename")%>]
</td>
<td class="smallerheader" width=130 align=right>
<%
if bProtected then
response.write session("teFullName")
response.write " (<a href=""te_logout.asp"">logout</a>)"
end if
%>
</td>
</tr>
</table>
<%
lConnID = request("cid")
sTableName = request("tablename")
sType = request("type")
OpenRS arrConn(lConnID)
set adox = server.createobject("adox.catalog")
set cmd = server.createobject("adodb.command")
adox.ActiveConnection = conn
select case sType
case "query"
response.write "<br>Query : <br>"
response.write "<textarea cols=120 rows=5 class=""tbflat"" readonly>" & adox.views(sTableName).command.commandtext & "</textarea><br>"
%>
<br>
<table border=0 cellspacing=1 cellpadding=2 bgcolor = "#ffdead" width=100%>
<tr>
<td width=10></td>
<td class="smallerheader" colspan=4>Field Definitions</td>
</tr>
<tr bgcolor="#fffaf0">
<td width=10></td>
<td class="smallerheader">Field Name</td>
<td class="smallerheader">Field Type</td>
<td class="smallerheader">Size</td>
<td class="smallerheader">Attributes</td>
<td width=10></td>
</tr>
<%
rs.Open "SELECT * FROM [" & sTableName & "]", , ,adCmdTable
for each fld in rs.fields
sAttributes = ""
sFieldType = ""
select case fld.Type
case adSmallInt : sFieldType = "integer"
case adInteger : sFieldType = "long"
case adBoolean : sFieldType = "boolean"
case adDate : sFieldType = "date"
case adCurrency : sFieldType = "currency"
case adVarWChar : sFieldType = "text"
case adLongVarWChar : sFieldType = "memo"
case adLongVarBinary : sFieldType = "ole"
case adGUID : sFieldType = "guid"
case adUnsignedTinyInt : sFieldType = "byte"
case else : sFieldType = fld.type
end select
if fld.properties("IsAutoIncrement") = true then
sAttributes = sAttributes & "(auto increment)"
end if
'Actually this won't work, any recommendations are welcome
if (fld.attributes and adFldKeyColumn) = adFldKeyColumn then
sAttributes = sAttributes & " (primary key)"
end if
if (fld.attributes and adFldUpdatable) = adFldUpdatable then
sAttributes = sAttributes & " (updatable)"
end if
if (fld.attributes and adFldIsNullable) = adFldIsNullable then
sAttributes = sAttributes & " (nullable)"
end if
if (fld.attributes and adFldFixed) = adFldFixed then
sAttributes = sAttributes & " (fixed)"
end if
'if (fld.attributes and adFldMayBeNull) = adFldMayBeNull then
' sAttributes = sAttributes & " (may be null)"
'end if
if (fld.attributes and adFldLong) = adFldLong then
sAttributes = sAttributes & " (long)"
end if
if (fld.attributes and adFldRowID) = adFldRowID then
sAttributes = sAttributes & " (row id)"
end if
if (fld.attributes and adFldIsRowURL) = adFldIsRowURL then
sAttributes = sAttributes & " (url)"
end if
%>
<tr bgcolor="#fffaf0">
<td width=10></td>
<td class="smallertext"><%=fld.name%></td>
<td class="smallertext"><%=sFieldType%></td>
<td class="smallertext"><%=fld.definedsize%></td>
<td class="smallertext"><%=sAttributes%></td>
<td width=10></td>
</tr>
<%
next
response.write "</table><br>"
CloseRS
case "proc"
response.write "<br>Procedure : <br>"
response.write "<textarea cols=120 rows=5 class=""tbflat"">" & adox.procedures(sTableName).command.commandtext & "</textarea><br>"
end select
%>
<!--#include file="te_footer.asp"-->