summaryrefslogtreecommitdiffstats
path: root/ext/wasm/fiddle/fiddle.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/fiddle/fiddle.js')
-rw-r--r--ext/wasm/fiddle/fiddle.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/ext/wasm/fiddle/fiddle.js b/ext/wasm/fiddle/fiddle.js
index 2a3d174..d285898 100644
--- a/ext/wasm/fiddle/fiddle.js
+++ b/ext/wasm/fiddle/fiddle.js
@@ -403,8 +403,10 @@
E('#btn-reset').addEventListener('click',()=>SF.resetDb());
const taInput = E('#input');
const btnClearIn = E('#btn-clear');
+ const selectExamples = E('#select-examples');
btnClearIn.addEventListener('click',function(){
taInput.value = '';
+ selectExamples.selectedIndex = 0;
},false);
// Ctrl-enter and shift-enter both run the current SQL.
taInput.addEventListener('keydown',function(ev){
@@ -733,16 +735,15 @@
]},
//{name: "Timer on", sql: ".timer on"},
// ^^^ re-enable if emscripten re-enables getrusage()
+ {name: "Box Mode", sql: ".mode box"},
{name: "Setup table T", sql:[
".nullvalue NULL\n",
"CREATE TABLE t(a,b);\n",
"INSERT INTO t(a,b) VALUES('abc',123),('def',456),(NULL,789),('ghi',012);\n",
"SELECT * FROM t;\n"
]},
- {name: "Table list", sql: ".tables"},
- {name: "Box Mode", sql: ".mode box"},
- {name: "JSON Mode", sql: ".mode json"},
- {name: "Mandlebrot", sql:[
+ {name: "sqlite_schema", sql: "select * from sqlite_schema"},
+ {name: "Mandelbrot", sql:[
"WITH RECURSIVE",
" xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2),\n",
" yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0),\n",
@@ -760,7 +761,13 @@
" FROM m2 GROUP BY cy\n",
" )\n",
"SELECT group_concat(rtrim(t),x'0a') as Mandelbrot FROM a;\n",
- ]}
+ ]},
+ {name: "JSON pretty-print",
+ sql: "select json_pretty(json_object('ex',json('[52,3.14159]')))"
+ },
+ {name: "JSON pretty-print (with tabs)",
+ sql: "select json_pretty(json_object('ex',json('[52,3.14159]')),char(0x09))"
+ }
];
const newOpt = function(lbl,val){
const o = document.createElement('option');