E5F2 txn support for bustub shell · cmu-db/bustub-web-shell@545ac9d · GitHub
[go: up one dir, main page]

Skip to content

Commit 545ac9d

Browse files
committed
txn support for bustub shell
Signed-off-by: Alex Chi <iskyzh@gmail.com>
1 parent c086862 commit 545ac9d

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

bpt-printer/bustub-wasm-bpt-printer.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-4.54 KB
Binary file not shown.

bpt-printer/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
<script src="bustub-wasm-bpt-printer.js"></script>
7373

7474
<script type="text/javascript">
75-
const BUSTUB_PUBLIC_VERSION_VAR = "957b347"
76-
const BUSTUB_PRIVATE_VERSION_VAR = "44fd44a"
77-
const BUSTUB_BUILD_TIME_VAR = "20231029"
75+
const BUSTUB_PUBLIC_VERSION_VAR = "ab79c88"
76+
const BUSTUB_PRIVATE_VERSION_VAR = "fff202bb"
77+
const BUSTUB_BUILD_TIME_VAR = "20231112"
7878
const viz = new Viz()
7979

8080
Module['onRuntimeInitialized'] = function () {

bustub/bustub-wasm-shell.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bustub/bustub-wasm-shell.wasm

40.1 KB
Binary file not shown.

bustub/index.html

Lines changed: 15 additions & 8 deletions
< 10000 tr class="diff-line-row">
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,26 @@
7575
<script src="bustub-wasm-shell.js"></script>
7676

7777
<script type="text/javascript">
78-
const BUSTUB_PUBLIC_VERSION_VAR = "957b347"
79-
const BUSTUB_PRIVATE_VERSION_VAR = "44fd44a"
80-
const BUSTUB_BUILD_TIME_VAR = "20231029"
78+
const BUSTUB_PUBLIC_VERSION_VAR = "ab79c88"
79+
const BUSTUB_PRIVATE_VERSION_VAR = "fff202bb"
80+
const BUSTUB_BUILD_TIME_VAR = "20231112"
8181
let is_ready = false
8282

8383
Module['onRuntimeInitialized'] = function () {
84-
const executeQuery = Module.cwrap('BustubExecuteQuery', 'number', ['string', 'number', 'number'])
84+
const executeQuery = Module.cwrap('BustubExecuteQuery', 'number', ['string', 'number', 'number', 'number'])
8585
const initialize = Module.cwrap('BustubInit', 'number', [])
8686
window.executeQuery = (x) => {
8787
const bufferSize = 64 * 1024
8888
let output = "\0".repeat(bufferSize)
8989
let ptrOutput = Module.allocateUTF8(output)
90-
const retCode = executeQuery(x, ptrOutput, bufferSize)
90+
let output2 = "\0".repeat(bufferSize)
91+
let ptrOutput2 = Module.allocateUTF8(output2)
92+
const retCode = executeQuery(x, ptrOutput2, ptrOutput, bufferSize)
9193
output = Module.UTF8ToString(ptrOutput)
94+
output2 = Module.UTF8ToString(ptrOutput2)
9295
Module._free(ptrOutput)
93-
return [retCode, output]
96+
Module._free(ptrOutput2)
97+
return [retCode, output2, output]
9498
}
9599
initialize()
96100
is_ready = true
@@ -105,6 +109,7 @@
105109
command: true
106110
}
107111
let line = ""
112+
let bustub_prompt = ""
108113
var term = $('body').terminal(function (command) {
109114
if (!is_ready) {
110115
this.echo("BusTub shell is still initializing, please wait.")
@@ -115,7 +120,9 @@
115120
if (line == "\\clear") {
116121
this.clear()
117122
} else {
118-
const [retCode, result] = executeQuery(line)
123+
const [retCode, new_prompt, result] = executeQuery(line)
124+
bustub_prompt = new_prompt
125+
console.log(bustub_prompt)
119126
this.echo(result, { raw: true })
120127
if (retCode == 1) {
121128
this.echo("Table truncated due to output limit.")
@@ -126,7 +133,7 @@
126133
}
127134
}, {
128135
greetings: `[[@;;;;bustub.svg]]`,
129-
prompt: () => line.length == 0 ? "[[b;;]bustub> ]" : "[[b;;]... ]"
136+
prompt: () => line.length == 0 ? "[[b;;]" + (bustub_prompt.length == 0 ? "bustub" : bustub_prompt) + "> ]" : "[[b;;]... ]"
130137
})
131138
term.echo(`<hr><h1>Live Database Shell</h1>`, { raw: true })
132139

0 commit comments

Comments
 (0)
0