Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Apr 30, 2019
1 parent e8c9494 commit a900f7b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/GUI/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var dbFileElm = document.getElementById('dbfile');
var savedbElm = document.getElementById('savedb');

// Start the worker in which sql.js will run
var worker = new Worker("/dist/worker.sql-wasm.js");
var worker = new Worker("../../dist/worker.sql-wasm.js");
worker.onerror = error;

// Open a database
Expand Down
3 changes: 2 additions & 1 deletion examples/persistent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
<head>
<meta charset="utf8">
<title>Persistent sqlite</title>
<script src="/dist/sql-wasm.js"></script>
<script src="../dist/sql-wasm.js"></script>
</head>
<body>
<p>You have seen this page <span id="views">0</span> times.</p>
<div>
You have been here on the following dates: <ol id="dates"></ol>
</div>
<script>
var baseUrl = '../dist/';

function toBinArray (str) {
var l = str.length,
Expand Down
29 changes: 29 additions & 0 deletions examples/repl.html
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>
2 changes: 1 addition & 1 deletion examples/requireJS.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<script src='http://requirejs.org/docs/release/2.3.6/minified/require.js'></script>

<script>
var baseUrl = '/dist'
var baseUrl = '../dist'
require.config({
baseUrl: baseUrl
});
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<meta charset="utf8" />
<html>
<script src='/dist/sql-wasm-debug.js'></script>
<script src='../../dist/sql-wasm-debug.js'></script>
<script>
config = {
locateFile: (filename, prefix) => {
Expand Down

0 comments on commit a900f7b

Please sign in to comment.