%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: te_listtables.asp
' Description: Lists the tables for a given connection
' Initiated By Hakan Eskici on Nov 01, 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 14, 2000 by Hakan Eskici
' Depending on the permissions, users will either see "info"
' or "edit" for the action with a link to te_tableedit.asp
' # Nov 17, 2000 by Hakan Eskici
' Added drop table links for tables and queries
' # Mar 27, 2001 by Hakan Eskici
' Added showing stored procedures
' # Mar 29, 2001 by Hakan Eskici
' Fixed the cid=0 security bug
' # May 28, 2001 by Alain Jacquot
' Fixed the "Object or provider is not capable of performing requested operation" bug
' # June 03, 2001 by Rakesh Jain
' Rearranged the code so that system tables and data tables do not show under Queries
'==============================================================
%>
|
Home » Connections » <%
if bComboTables then
allTablesCombo()
else
response.write arrDesc(request("cid"))
end if %> |
<%
'Which connection to use?
lConnID = request("cid")
if (lConnID = 0) and bAdmin = False then
response.write "Not authorised to view this connection."
%><%
response.end
end if
conn.Open arrConn(lConnID)
set rs = conn.OpenSchema(adSchemaTables)
%>
>
|
<%
'Addition: Search Link
'By Kevin Yochum on Nov 07, 2000
if bTableEdit then sAction = "edit" else sAction = "info"
do while not rs.eof
if rs("table_type") = "TABLE" then
%>
|
"><%=rs("table_name")%> |
<%=rs("descrIptIon")%> |
">search
&type=table"><%=sAction%>
<% if bTableDel then %>
">remove
<% end if %>
|
|
<%
end if
rs.movenext
loop
rs.close
%>
<%
if bQueryExec then
%>
>
|
<%
' # May 28, 2001 by Alain Jacquot
' Fixed the "Object or provider is not capable of performing requested operation" bug
' # June 03, 2001 by Rakesh Jain
' Rearranged the code so that system tables and data tables do not show under Queries
select case arrType(lConnID)
Case tedbAccess
set rs = conn.OpenSchema(adSchemaViews)
Case tedbSQLServer
set rs = conn.OpenSchema(adSchemaTables)
Case tedbDSN
set rs = conn.OpenSchema(adSchemaTables)
Case tedbConnStr
set rs = conn.OpenSchema(adSchemaViews)
Case else
if (lConnID = 0) and bAdmin = True then
set rs = conn.OpenSchema(adSchemaTables)
else
response.write "Not authorised to view this connection."
%><%
response.end
end if
end select
do while not rs.eof
if arrType(lConnID) = tedbAccess then
bProceed = True
else
if rs("table_type") = "VIEW" then
bProceed = True
end if
end if
if bProceed then
%>
|
"><%=rs("table_name")%> |
<%=rs("descrIptIon")%> |
<% if arrType(lConnID) = tedbAccess then %>
&type=query">info
<% end if %>
<% if bTableEdit and arrType(lConnID) = tedbAccess then %>
">edit
<% end if %>
<% if bTableDel then %>
">remove
<% end if %>
|
|
<%
end if
rs.movenext
loop
rs.close
response.write "
"
end if
set rs = conn.OpenSchema(adSchemaProcedures)
%>
>
|
<%
set cat = server.createobject("adox.catalog")
cat.ActiveConnection = conn
do while not rs.eof
sProcName = rs("procedure_name")
sProcDef = rs("descrIptIon")
iProcType = rs("procedure_type")
select case arrType(lConnID)
case tedbSQLServer
aProcName = split(sProcName, ";")
iProcType = 0
if isArray(aProcName) then
sProcName = aProcName(0)
iParamCount = aProcName(1)
end if
case tedbAccess
iParamCount = cat.Procedures(sProcName).command.parameters.count
case else
iParamCount = 0
iProcType = 0
end select
'if (iProcType = 3) and arrType(lConnID)<>tedbSQLServer then
' sProcURL = "" & sProcName & ""
'else
' sProcURL = sProcName & "(" & sProcType & ")"
'end if
select case iProcType
case 2 'Non-parameterized query
if iParamCount > 0 then
sProcURL = "" & sProcName & ""
else
sProcURL = "" & sProcName & ""
end if
case 3 'Query with parameters
sProcURL = "" & sProcName & ""
case else
sProcURL = "" & sProcName & ""
'sProcURL = sProcName
end select
%>
|
<%=sProcURL%> |
<%=iParamCount%> |
<%=sProcDef%> |
<% if arrType(lConnID) = tedbAccess then %>
info
<% end if %>
<% if bTableEdit and arrType(lConnID) = tedbAccess then %>
edit
<% end if %>
<% if bTableDel then %>
remove
<% end if %>
|
|
<%
rs.movenext
loop
%>