forked from dsferruzza/simpleSqlParser
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo.html
More file actions
27 lines (26 loc) · 689 Bytes
/
demo.html
File metadata and controls
27 lines (26 loc) · 689 Bytes
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Demo - simpleSqlParser</title>
</head>
<body>
<p>
<label for="q">SQL query:</label><br>
<textarea id="q" cols="100" rows="5">SELECT * FROM table</textarea>
</p>
<p>
<button id="parse" type="button">Parse</button>
</p>
<h2>AST</h2>
<pre id="ast"></pre>
<script src="./dist/simpleSqlParser.min.js"></script>
<script>
var astElem = document.getElementById('ast');
var qElem = document.getElementById('q');
document.getElementById('parse').addEventListener('click', function(e) {
astElem.innerHTML = JSON.stringify(simpleSqlParser.sql2ast(q.value), null, " ");
});
</script>
</body>
</html>