-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathindex.html
162 lines (146 loc) · 6.34 KB
/
index.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
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
158
159
160
161
162
<html>
<head>
<title>BusTub Shell</title>
<!-- jQuery -->
<script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>
<!-- jQuery Terminal -->
<script src="https://unpkg.com/[email protected]/js/jquery.terminal.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/jquery.terminal.min.css" />
<!-- prismjs -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/themes/prism.min.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/prism.css" />
<script src="https://unpkg.com/[email protected]/prism.js"></script>
<script src="https://unpkg.com/[email protected]/components/prism-sql.min.js"></script>
<script src="https://unpkg.com/[email protected]/js/prism.js"></script>
<!-- CJK characters -->
<script src="https://cdn.jsdelivr.net/gh/jcubic/static/js/wcwidth.js"></script>
<!-- Roboto Mono -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;700&display=swap" rel="stylesheet">
<!-- Preview -->
<meta property="og:site_name" content="CMU 15-445/645" />
<meta property="og:type" content="website" />
<meta property="og:title" content="BusTub SQL Database Shell " />
<meta property="og:url" content="https://15445.courses.cs.cmu.edu" />
<meta property="og:description" content="Interactive BusTub shell right in your browser!" />
<meta property="og:image" content="https://15445.courses.cs.cmu.edu/fall2022/images/bustub-shell.png" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@CMUDB">
<meta name="twitter:creator" content="@CMUDB">
<meta name="twitter:domain" content=".">
<meta property="twitter:label1" content="Semester" />
<meta property="twitter:data1" content="Fall 2024" />
<meta property="twitter:label1" content="SQL Database?" />
<meta property="twitter:data1" content="You Know It!" />
</head>
<body>
</body>
<style>
.terminal {
--color: black;
--background: white;
--link-color: darkblue;
--size: 1.2;
--font: "Source Code Pro", monospace;
}
.terminal::after {
content: "";
background-image: url("bustub.svg");
opacity: 0.02;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
position: absolute;
z-index: -1;
transform: rotate(-30deg);
}
table,
tr,
td,
tbody,
thead,
div {
font-size: calc(var(--size, 1)*(12px/var(--pixel-density, 1)));
white-space: pre;
}
</style>
<script src="bustub-wasm-shell.js"></script>
<script type="text/javascript">
const BUSTUB_PUBLIC_VERSION_VAR = "${BUSTUB_PUBLIC_VERSION}"
const BUSTUB_PRIVATE_VERSION_VAR = "${BUSTUB_PRIVATE_VERSION}"
const BUSTUB_BUILD_TIME_VAR = "${BUSTUB_BUILD_TIME}"
let is_ready = false
Module['onRuntimeInitialized'] = function () {
const executeQuery = Module.cwrap('BusTubExecuteQuery', 'number', ['string', 'number', 'number', 'number'])
const initialize = Module.cwrap('BusTubInit', 'number', [])
window.executeQuery = (x) => {
const bufferSize = 64 * 1024
const ptrOutput = Module._malloc(bufferSize)
Module.stringToUTF8("", ptrOutput, bufferSize)
const ptrOutput2 = Module._malloc(bufferSize)
Module.stringToUTF8("", ptrOutput2, bufferSize)
const retCode = executeQuery(x, ptrOutput2, ptrOutput, bufferSize)
output = Module.UTF8ToString(ptrOutput)
output2 = Module.UTF8ToString(ptrOutput2)
Module._free(ptrOutput)
Module._free(ptrOutput2)
return [retCode, output2, output]
}
initialize()
is_ready = true
}
$(document).ready(() => {
$.terminal.syntax('sql')
$.terminal.prism_formatters = {
prompt: false,
echo: false,
animation: false,
command: true
}
let line = ""
let bustub_prompt = ""
var term = $('body').terminal(function (command) {
if (!is_ready) {
this.echo("BusTub shell is still initializing, please wait.")
return
}
line += command
if (line.endsWith(';') || line.startsWith("\\")) {
if (line == "\\clear") {
this.clear()
} else {
const [retCode, new_prompt, result] = executeQuery(line)
bustub_prompt = new_prompt
console.log(bustub_prompt)
this.echo(result, { raw: true })
if (retCode == 1) {
this.echo("Table truncated due to output limit.")
}
this.echo()
}
line = ""
}
}, {
greetings: `[[@;;;;bustub.svg]]`,
prompt: () => line.length == 0 ? "[[b;;]" + (bustub_prompt.length == 0 ? "bustub" : bustub_prompt) + "> ]" : "[[b;;]... ]"
})
term.echo(`<hr><h1>Live Database Shell</h1>`, { raw: true })
term.echo(`
[[b;;]Solution Version:] ${BUSTUB_PRIVATE_VERSION_VAR} . [[b;;]BusTub Version:] ${BUSTUB_PUBLIC_VERSION_VAR} . [[b;;]Built Date:] ${BUSTUB_BUILD_TIME_VAR}
BusTub is a relational database management system built at Carnegie Mellon University for the Introduction to Database Systems (15-445/645) course. This system was developed for educational purposes and should not be used in production environments. [[[!;;;;https://github.com/cmu-db/bustub]BusTub on GitHub]] [[[!;;;;https://15445.courses.cs.cmu.edu/]Course Website]] [[[!;;;;https://github.com/cmu-db/bustub/issues/new]Report Bugs]]
Use \\help to learn about the usage. Use \\clear to clear the page.
This is BusTub reference solution running in your browser.
`)
})
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-52525161-8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-52525161-8');
</script>
</html>