-
Notifications
You must be signed in to change notification settings - Fork 0
/
DBApp.html
99 lines (98 loc) · 4.92 KB
/
DBApp.html
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
<body>
<div class="overlay" id="overlay"></div>
<div class="modal" id="modal">
<table style="width: 100%;">
<tr>
<th colspan="2">Login Details:</th>
</tr>
<tr>
<th style="text-align:left;">Server</th>
<td><input type="text" name="server" id="server" value="" size="57" />
<td>
</tr>
<tr>
<th style="text-align:left;">Login</th>
<td><input type="text" name="login" id="login" value="" />
<td>
</tr>
<tr>
<th style="text-align:left;">Password</th>
<td><input type="password" name="password" id="password" value="" />
<td>
</tr>
<tr>
<th colspan="2"><button name="Login" id="loginButton" onclick="doLogin()"
style="float: right;background-color: black;color: white;"><b>Login</b></button></th>
</tr>
<tr>
<th colspan="2">
<div id="loginmessage"></div>
</th>
</tr>
</table>
</div>
<header>
<b>DBApp</b> <span id="systemInfo"></span>
<button id="logout" style="float: right;" disabled="true" onclick="doLogout()">Logout</button>
<button id="clear" style="float: right;" disabled="true" onclick="document.getElementById('results').innerHTML=''">Clear Results</button>
<button id="runsql" style="float: right;" disabled="true" onclick="runSQL()">Run SQL</button>
</header>
<main>
<databases>
<input type="hidden" id="catalog" value="def" />
<input type="hidden" id="schema" value="mysql" />
<schemas>
<span id="schemasinfo" style="color: gray;"> Fetching Schemas <blink>...</blink></span>
<ul id="schemas"></ul>
</schemas>
<activity>
<action>
<schemainfo>
<span class="database"></span> <span id="schemainfo"></span></u>
<span id="tablelist"></span>
</schemainfo>
<query id="query">
<!-- <textarea id="sqlx" placeholder="Write your SQL here" style="width: 100%;height: 1000%;background-color: darkgrey;" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea> -->
<textarea id="sql" placeholder="Write your SQL here" style="width: 100%;height: 1000%;" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</query>
</action>
<results id="results">
</results>
<message>
<span id="message">Message</span>
</message>
</activity>
</databases>
</main>
<footer>
DBApp − V1.1 2021
</footer>
</body>
<script language="JavaScript">
/* track pressed keys globally so we can listen for Alt key (ModeChange on Linux) etc. */
var altKey = false;
var decorator;
window.addEventListener('keyup', function(eu) { if (eu.key == "Alt" || eu.key == "ModeChange") altKey = false; });
window.addEventListener('keydown', function(ed) { if (ed.key == "Alt" || ed.key == "ModeChange") altKey = true; });
/* These values have been set in the c++ app, set them on screen load */
document.getElementById('server').value = server;
document.getElementById('login').value = login;
document.getElementById('password').value = password;
function $(e){ return document.getElementById(e); };
var parser = new Parser({
whitespace: /\s+/,
number: /0x[\dA-Fa-f]+|-?(\d+\.?\d*|\.\d+)|#[\dA-Fa-f]{3,6}/,
comment: /\/\*([^\*]|\*[^\/])*(\*\/?)?|(\/\/|#)[^\r\n]*|--\s+.*/,
string: /"(\\.|[^"\r\n])*"?|'(\\.|[^'\r\n])*'?/,
keyword: /([S,s][E,e][L,l][E,e][C,c][T,t]|[F,f][R,r][O,o][M,m]|[W,w][H,h][E,e][R,r][E,e]|[A,a][N,n][D,d]|[O,o][R,r]|[B,b][E,e][T,t][W,w][E,e][E,e][N,n]|[L,l][I,i][M,m][I,i][T,t]|[C,c][A,a][S,s][E,e]|[W,w][H,h][E,e][N,n]|[T,t][H,h][E,e][N,n]|[I,i][S,s]|[N,n][O,o][T,t]|[E,e][L,l][S,s][E,e]|[E,e][N,n][D,d]|[N,n][U,u][L,l][L,l]|[O,o][N,n]|[[L,l][E,e][F,f][T,t]|[R,r][I,i][G,g][H,h][T,t]|[O,o][U,u][T,t][E,e][R,r]|[J,j][O,o][I,i][N,n]|[H,h][A,a][V,v][I,i][N,n][G,g]|[L,l][I,i][K,k][E,e]|[O,o][R,r][D,d][E,e][R,r]|[B,b][Y,y]|[G,g][R,r][O,o][U,u][P,p])(?!\w|=)/i, /* i not working */
variable: /[\$\%\@](\->|\w)+(?!\w)|\${\w*}?/,
define: /[$A-Z_a-z0-9]+/,
op: /[\+\-\*\/=<>!]=?|[\(\)\{\}\[\]\.\|]/,
other: /\S/,
});
window.onload = function(){
var textarea = document.getElementById('sql');
textarea.value = '-- comment\r\nSELECT CURRENT_DATE;\r\n';
decorator = new TextareaDecorator(textarea, parser);
};
</script>