FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sql.js/examples/repl.html at master · sql-js/sql.js · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
sql-js
/
sql.js
Public
Notifications
You must be signed in to change notification settings
Fork
1.1k
Star
13.7k
Code
Issues
127
Pull requests
15
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
sql.js
/
examples
/
repl.html
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (30 loc) · 962 Bytes
Breadcrumbs
sql.js
/
examples
/
repl.html
Copy path
File metadata and controls
34 lines (30 loc) · 962 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<!doctype html
>
<
html
>
<!--Simple Read eval print loop for SQL-->
<
head
>
<
meta
charset
="
utf8
"
>
<
title
>
SQL REPL
</
title
>
<
script
src
="
../dist/sql-wasm.js
"
>
</
script
>
</
head
>
<
body
>
<
input
type
='
text
'
id
='
input
'
placeholder
="
ENTER SOME SQL
"
size
='
50
'
value
="
CREATE TABLE test(val);INSERT INTO test VALUES (666); SELECT * FROM test
"
>
<
button
id
='
submit
'
>
Execute
</
button
>
<
pre
id
='
result
'
>
</
pre
>
<
pre
id
='
error
'
>
</
pre
>
<
script
>
//Open a blank database
var
db
;
initSqlJs
(
{
locateFile
:
filename
=>
`../dist/
${
filename
}
`
}
)
.
then
(
function
(
SQL
)
{
db
=
new
SQL
.
Database
(
)
;
}
)
;
document
.
getElementById
(
'submit'
)
.
onclick
=
function
(
)
{
var
sql
=
document
.
getElementById
(
'input'
)
.
value
;
var
result
=
''
,
error
=
''
;
try
{
result
=
db
.
exec
(
sql
)
;
}
catch
(
e
)
{
error
=
e
;
}
document
.
getElementById
(
'result'
)
.
innerHTML
=
JSON
.
stringify
(
result
,
null
,
' '
)
;
document
.
getElementById
(
'error'
)
.
innerHTML
=
error
;
}
;
</
script
>
</
body
>
Back
|
FazBrowse Home
|
New Git URL