forked from sql-js/sql.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!doctype html> | ||
<html> | ||
<!--Simple Read eval print loop for SQL--> | ||
<head> | ||
<meta charset="utf8"> | ||
<title>SQL REPL</title> | ||
<script src="../js/sql.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 = 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters