Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit06f6789

Browse files
author
Christopher J. Brody
committed
Merge branch 'master' ofhttps://github.com/kripken/sql.js into custom-functions
2 parentse316007 +091395f commit06f6789

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

‎Makefile‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ EMFLAGS = \
3737
-s SINGLE_FILE=0\
3838
-s NODEJS_CATCH_EXIT=0
3939

40+
EMFLAGS_ASM =\
41+
-s WASM=0
42+
43+
EMFLAGS_ASM_MEMORY_GROWTH =\
44+
-s WASM=0\
45+
-s ALLOW_MEMORY_GROWTH=1
46+
4047
EMFLAGS_WASM =\
4148
-s WASM=1\
4249
-s ALLOW_MEMORY_GROWTH=1
@@ -55,40 +62,47 @@ BITCODE_FILES = out/sqlite3.bc out/extension-functions.bc out/custom_extensions.
5562

5663
OUTPUT_WRAPPER_FILES = src/shell-pre.js src/shell-post.js
5764

65+
OUTPUT_API_FILES = out/api.js
66+
67+
EMFLAGS_PRE_JS_FILES =\
68+
--pre-js out/api.js
69+
70+
EXPORTED_METHODS_JSON_FILES = src/exported_functions.json src/exported_runtime_methods.json
71+
5872
all: optimized debug worker
5973

6074
.PHONY: debug
6175
debug: dist/sql-asm-debug.js dist/sql-wasm-debug.js
6276

63-
dist/sql-asm-debug.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)out/api.js src/exported_functions.json src/exported_runtime_methods.json
64-
$(EMCC)$(EMFLAGS)$(EMFLAGS_DEBUG)-s WASM=0$(BITCODE_FILES)--pre-js out/api.js -o$@
77+
dist/sql-asm-debug.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)$(OUTPUT_API_FILES)$(EXPORTED_METHODS_JSON_FILES)
78+
$(EMCC)$(EMFLAGS)$(EMFLAGS_DEBUG)$(EMFLAGS_ASM)$(BITCODE_FILES)$(EMFLAGS_PRE_JS_FILES) -o$@
6579
mv$@ out/tmp-raw.js
6680
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js>$@
6781
rm out/tmp-raw.js
6882

69-
dist/sql-wasm-debug.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)out/api.js src/exported_functions.json src/exported_runtime_methods.json
70-
$(EMCC)$(EMFLAGS)$(EMFLAGS_DEBUG)$(EMFLAGS_WASM)$(BITCODE_FILES)--pre-js out/api.js -o$@
83+
dist/sql-wasm-debug.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)$(OUTPUT_API_FILES)$(EXPORTED_METHODS_JSON_FILES)
84+
$(EMCC)$(EMFLAGS)$(EMFLAGS_DEBUG)$(EMFLAGS_WASM)$(BITCODE_FILES)$(EMFLAGS_PRE_JS_FILES) -o$@
7185
mv$@ out/tmp-raw.js
7286
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js>$@
7387
rm out/tmp-raw.js
7488

7589
.PHONY: optimized
7690
optimized: dist/sql-asm.js dist/sql-wasm.js dist/sql-asm-memory-growth.js
7791

78-
dist/sql-asm.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)out/api.js src/exported_functions.json src/exported_runtime_methods.json
79-
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)-s WASM=0$(BITCODE_FILES)--pre-js out/api.js -o$@
92+
dist/sql-asm.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)$(OUTPUT_API_FILES)$(EXPORTED_METHODS_JSON_FILES)
93+
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)$(EMFLAGS_ASM)$(BITCODE_FILES)$(EMFLAGS_PRE_JS_FILES) -o$@
8094
mv$@ out/tmp-raw.js
8195
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js>$@
8296
rm out/tmp-raw.js
8397

84-
dist/sql-wasm.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)out/api.js src/exported_functions.json src/exported_runtime_methods.json
85-
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)$(EMFLAGS_WASM)$(BITCODE_FILES)--pre-js out/api.js -o$@
98+
dist/sql-wasm.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)$(OUTPUT_API_FILES)$(EXPORTED_METHODS_JSON_FILES)
99+
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)$(EMFLAGS_WASM)$(BITCODE_FILES)$(EMFLAGS_PRE_JS_FILES) -o$@
86100
mv$@ out/tmp-raw.js
87101
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js>$@
88102
rm out/tmp-raw.js
89103

90-
dist/sql-asm-memory-growth.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)out/api.js src/exported_functions.json src/exported_runtime_methods.json
91-
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)-s WASM=0 -s ALLOW_MEMORY_GROWTH=1$(BITCODE_FILES)--pre-js out/api.js -o$@
104+
dist/sql-asm-memory-growth.js:$(BITCODE_FILES)$(OUTPUT_WRAPPER_FILES)$(OUTPUT_API_FILES)$(EXPORTED_METHODS_JSON_FILES)
105+
$(EMCC)$(EMFLAGS)$(EMFLAGS_OPTIMIZED)$(EMFLAGS_ASM_MEMORY_GROWTH)$(BITCODE_FILES)$(EMFLAGS_PRE_JS_FILES) -o$@
92106
mv$@ out/tmp-raw.js
93107
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js>$@
94108
rm out/tmp-raw.js
@@ -117,14 +131,14 @@ dist/worker.sql-wasm-debug.js: dist/sql-wasm-debug.js out/worker.js
117131
# However, since we can't tell emcc that we don't need the wasm generated, and just want the wrapper, we have to pay to have the .wasm generated
118132
# even though we would have already generated it with our sql-wasm.js target above.
119133
# This would be made easier if this is implemented: https://github.com/emscripten-core/emscripten/issues/8506
120-
# dist/worker.sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js out/worker.jssrc/exported_functions.json src/exported_runtime_methods.json dist/sql-wasm-debug.wasm
134+
# dist/worker.sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js out/worker.js$(EXPORTED_METHODS_JSON_FILES) dist/sql-wasm-debug.wasm
121135
# $(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s ENVIRONMENT=worker -s $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js out/api.js -o out/sql-wasm.js
122136
# mv out/sql-wasm.js out/tmp-raw.js
123137
# cat src/shell-pre.js out/tmp-raw.js src/shell-post.js out/worker.js > $@
124138
# #mv out/sql-wasm.wasm dist/sql-wasm.wasm
125139
# rm out/tmp-raw.js
126140

127-
# dist/worker.sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js out/worker.jssrc/exported_functions.json src/exported_runtime_methods.json dist/sql-wasm-debug.wasm
141+
# dist/worker.sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js out/worker.js$(EXPORTED_METHODS_JSON_FILES) dist/sql-wasm-debug.wasm
128142
# $(EMCC) -s ENVIRONMENT=worker $(EMFLAGS) $(EMFLAGS_DEBUG) -s ENVIRONMENT=worker -s WASM_BINARY_FILE=sql-wasm-foo.debug $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js out/api.js -o out/sql-wasm-debug.js
129143
# mv out/sql-wasm-debug.js out/tmp-raw.js
130144
# cat src/shell-pre.js out/tmp-raw.js src/shell-post.js out/worker.js > $@

‎examples/GUI/gui.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ function execute(commands) {
3232
worker.onmessage=function(event){
3333
varresults=event.data.results;
3434
toc("Executing SQL");
35+
if(!results){
36+
error({message:event.data.error});
37+
return;
38+
}
3539

3640
tic();
3741
outputElm.innerHTML="";

‎src/worker.coffee‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ if typeof importScripts is 'function' # Detect webworker context
4848
when'close'
4949
db?.close()
5050
else
51-
thrownew'Invalid action :'+ data?['action']
51+
thrownewError'Invalid action :'+ data?['action']
52+
.catch (err)->
53+
postMessage
54+
'id': event['data']['id']
55+
'error': err['message']

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp