This repository was archived by the owner on Nov 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_db.asp
More file actions
122 lines (109 loc) · 3.65 KB
/
Copy pathexport_db.asp
File metadata and controls
122 lines (109 loc) · 3.65 KB
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
<%@ Language=VBScript %>
<!--#include file=scripts\inc_common.asp -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>DBA:<%=langDatabaseExport%></title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<link href="default.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript" src="scripts/common.js" defer></script>
</head>
<body>
<% call DBA_WriteNavigation%>
<%
dim dba, action
action = CStr(Request("action").Item)
set dba = new DBAdmin
dba.Connect Session(DBA_cfgSessionDBPathName), Session(DBA_cfgSessionDBPassword)
if dba.HasError then DBA_WriteError dba.LastError
Select Case action
Case "generatesql" call GenerateSQLScript
Case Else call WriteTablesSelect
End Select
set dba = nothing
%>
<!--#include file=scripts\inc_footer.inc -->
</body>
</html>
<%
Sub WriteTablesSelect
dim item
DBA_BeginNewTable langDatabaseExport, langDatabaseExportNote, "90%", ""
%>
<form action="export_db.asp" method="post">
<table align="left" border="0" cellspacing="1" cellpadding="10">
<tr class="evenrow">
<td><b><%=langTablesList%></b><br><select multiple name="table" size="10">
<% for each item in dba.Tables.Items%>
<option value="<%=item.Name%>"><%=item.Name%></option>
<% next%>
</select></td>
<td><b><%=langViews%><br></b><select name="view" multiple size="10">
<% for each item in dba.Views.Items%>
<option value="<%=item.Name%>"><%=item.Name%></option>
<% next%>
</select></td>
<td><b><%=langProcedures%><br></b><select name="procedure" multiple size="10">
<% for each item in dba.Procedures.Items%>
<option value="<%=item.Name%>"><%=item.Name%></option>
<% next%>
</select></td>
<!--
<td valign="top">
<b><%=langOptions%></b><br>
<input type="checkbox" name="relations" value="-1"> <%=langIncludeRelations%>
</td>
--> </tr>
<tr>
<td colspan="4">
<input type="hidden" name="action" value="generatesql">
<input type="submit" name="submit" value="<%=langGenerateSQLScript%>" class="button">
</td>
</tr>
</table>
</form>
<%
call DBA_EndNewTable
End Sub
%>
<%
Sub GenerateSQLScript
dim item, sSQLScript, arr, sqlRelations, rel
sSQLScript = ""
sqlRelations = ""
'tables
arr = Split(Request.Form("table").Item, ",")
for each item in arr
item = Trim(item)
if dba.Tables.Exists(item) then sSQLScript = sSQLScript & dba.Tables.Item(item).SQL & vbCrLf
next
'views
arr = Split(Request.Form("view").Item, ",")
for each item in arr
item = Trim(item)
if dba.Views.Exists(item) then sSQLScript = sSQLScript & dba.Views.Item(item).SQL & vbCrLf
next
'stored procedures
arr = Split(Request.Form("procedure").Item, ",")
for each item in arr
item = Trim(item)
if dba.Procedures.Exists(item) then sSQLScript = sSQLScript & dba.Procedures.Item(item).SQL & vbCrLf
next
DBA_BeginNewTable langDatabaseExport, langSQLScriptNote, "90%", ""
%>
<table align="left" border="0">
<tr>
<td><textarea cols="60" rows="20" id="taSQL" style="width: 100%"><%=sSQLScript%></textarea></td>
</tr>
<tr>
<td>
<input type="button" value="<%=langCopyToClipboard%>" onclick="javascript:copyToClipboard(document.getElementById('taSQL'));" class="button">
<input type="button" value="<%=langCancel%>" onclick="javascript:window.location.href='export_db.asp';" class="button">
</td>
</tr>
</table>
<%
call DBA_EndNewTable
End Sub
%>