diff --git a/install_prerequisite.sh b/install_prerequisite.sh index ad8e8dc0..faa1a620 100755 --- a/install_prerequisite.sh +++ b/install_prerequisite.sh @@ -169,6 +169,9 @@ cd ~ #install tcl apt-get install -y --no-install-recommends tcl +#install sqlite3 +apt-get install -y --no-install-recommends sqlite3 + # Docker: Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown # if using docker use privileged mode with cgroup mounted (-v /sys/fs/cgroup:/sys/fs/cgroup:rw ) mkdir /sys/fs/cgroup/systemd || true @@ -225,6 +228,7 @@ if [ $run_tests -eq 1 ]; then "rustc --version" "rust-gdb --version" "evcxr --version" + "sqlite3 --version" ) diff --git a/src/containers/container.go b/src/containers/container.go index 669c8266..9e935aa1 100644 --- a/src/containers/container.go +++ b/src/containers/container.go @@ -33,6 +33,7 @@ var Commands2memLimitMap = map[string]int64{ "tclsh": 2, "java": 128, // jvm takes lot of memory "evcxr": 50, // rust REPL + "sqlite3": 10, } var memLimitMutex sync.Mutex diff --git a/src/resources/chat-widget/src/openreplkeywords.ts b/src/resources/chat-widget/src/openreplkeywords.ts index 25e083e5..3d93aacf 100644 --- a/src/resources/chat-widget/src/openreplkeywords.ts +++ b/src/resources/chat-widget/src/openreplkeywords.ts @@ -75,6 +75,12 @@ export const documentation = `\nOpenREPL is an Online platform for checking code "title": "Rust Book", "documentation": "https://doc.rust-lang.org/book/title-page.html", "github": "https://github.com/evcxr/evcxr" + }, + { + "language": "SQLite", + "title": "SQLite Doc", + "documentation": "https://sqlite.org/cli.html", + "github": "https://github.com/sqlite/sqlite" } ] }` \ No newline at end of file diff --git a/src/resources/index.html b/src/resources/index.html index 08572345..04a73526 100755 --- a/src/resources/index.html +++ b/src/resources/index.html @@ -236,6 +236,7 @@

Openbash +
@@ -462,7 +463,7 @@

Welcome to OpenREPL

- + diff --git a/src/resources/js/scribbler.js b/src/resources/js/scribbler.js index e83d1d3a..03e16585 100755 --- a/src/resources/js/scribbler.js +++ b/src/resources/js/scribbler.js @@ -1385,7 +1385,8 @@ $(function() { 'yaml': 'yaml', 'proto': 'protobuf', 'tcl': 'tcl', - 'rs': 'rust' + 'rs': 'rust', + 'sql': 'sql' }; const imageext = ['jpg', 'jpeg', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico']; const archiveext = ['zip', 'rar', '7z', 'tar', 'gz', 'bz2']; diff --git a/src/resources/meta/demos.xml b/src/resources/meta/demos.xml index 7cfe27f6..44080a2b 100644 --- a/src/resources/meta/demos.xml +++ b/src/resources/meta/demos.xml @@ -2032,6 +2032,131 @@ if [ $? -eq 0 ] && [ -f "$WORKDIR/$FILE" ]; then fi fi printf "\n"; +sleep 0.05 + + + + + + sqlite3 + https://github.com/sqlite/sqlite + https://sqlite.org/cli.html + + + sqlite> + create table tbl1(one text, two int); + + + sqlite> + insert into tbl1 values('hello!',10); + + + sqlite> + insert into tbl1 values('goodbye', 20); + + + sqlite> + select * from tbl1; + hello!|10 +goodbye|20 + + + + + sqlite> + .open ex1.db + + + sqlite> + .save ex1.db + + + + + sqlite> + .help + .archive ... Manage SQL archives +.auth ON|OFF Show authorizer callbacks +.backup ?DB? FILE Backup DB (default "main") to FILE +.bail on|off Stop after hitting an error. Default OFF +.cd DIRECTORY Change the working directory to DIRECTORY +... +.dump ?OBJECTS? Render database content as SQL +.echo on|off Turn command echo on or off +.eqp on|off|full|... Enable or disable automatic EXPLAIN QUERY PLAN +.excel Display the output of next command in spreadsheet +... + + + + + .help + Print command help + + + .quit + Quit evaluation and exit + + -- Welcome to OpenREPL! +-- Create the Resources table +CREATE TABLE IF NOT EXISTS Resources ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + language TEXT, + title TEXT, + documentation TEXT, + github TEXT +); + +-- Insert the data +INSERT INTO Resources (language, title, documentation, github) VALUES +('C++', 'Cling Documentation', './docs/cling.html', 'https://github.com/root-project/cling'), +('Go', 'Yaegi Documentation', 'https://pkg.go.dev/github.com/traefik/yaegi', 'https://github.com/traefik/yaegi'), +('Go', 'Go Interpreter Documentation', './docs/gointerpreter.html', 'https://github.com/vickeykumar/Go-interpreter'), +('jq', 'jq Manual', 'https://stedolan.github.io/jq/manual', 'https://github.com/vickeykumar/jq-repl'), +('Python', 'Python Documentation', './docs/python.html', ''), +('Java', 'Java Documentation', './docs/java.html', 'https://github.com/javaterminal/tryjshell'), +('Bash', 'Linux Command', 'http://linuxcommand.org/index.php', ''), +('Ruby', 'Ruby Quickstart', 'https://www.ruby-lang.org/en/documentation/quickstart/', ''), +('JavaScript', 'JavaScript Documentation', 'https://developer.mozilla.org/bm/docs/Web/JavaScript', 'https://github.com/vickeykumar/jsconsole'), +('Node.js', 'Node.js REPL Documentation', 'https://nodejs.org/dist/latest-v10.x/docs/api/repl.html', 'https://github.com/nodejs/node'), +('Perl', 'Perl Tutorials', 'https://www.guru99.com/perl-tutorials.html', 'https://github.com/mklement0/perli'), +('Tcl', 'Tcl Tutorial', 'https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html', ''), +('Rust', 'Rust Book', 'https://doc.rust-lang.org/book/title-page.html', 'https://github.com/evcxr/evcxr'), +('SQLite', 'SQLite Doc', 'https://sqlite.org/cli.html', 'https://github.com/sqlite/sqlite'); + +-- List all records +SELECT * FROM Resources; + + +COMPILER=sqlite3 +FILE=test.sql +debug=false +WORKDIR=$HOME +if [ "$CompilerOption" = "debug" ]; then + debug=true; +fi + +if [ "$IdeFileName" != "" ]; then + WORKDIR=$(dirname "$IdeFileName"); + FILE=$(basename "$IdeFileName"); +else + echo $0|base64 --decode > "$WORKDIR/$FILE"; +fi + +cd $WORKDIR; +if [ $? -eq 0 ] && [ -f "$WORKDIR/$FILE" ]; then + if $debug; then + $COMPILER $@<<EOF +.eqp full +.echo on +.timer on +.read $FILE +EOF + else + $COMPILER $@ -init $FILE + fi +fi +printf "\n"; sleep 0.05