diff --git a/.gitmodules b/.gitmodules
index 9d37f1e0..cb0288a5 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,9 @@
[submodule "sqlitecloud-js"]
path = sqlitecloud-js
url = https://github.com/sqlitecloud/sqlitecloud-js.git
+[submodule "sqlitecloud-py"]
+ path = sqlitecloud-py
+ url = https://github.com/sqlitecloud/sqlitecloud-py
+[submodule "sqlitecloud-php"]
+ path = sqlitecloud-php
+ url = https://github.com/sqlitecloud/sqlitecloud-php
diff --git a/PHP/.devcontainer/Dockerfile b/PHP/.devcontainer/Dockerfile
deleted file mode 100644
index cd6a689a..00000000
--- a/PHP/.devcontainer/Dockerfile
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM mcr.microsoft.com/devcontainers/php:7-bullseye
-
-ADD https://dl.yarnpkg.com/debian/pubkey.gpg /etc/apt/trusted.gpg.d/yarn.asc
-
-RUN chmod +r /etc/apt/trusted.gpg.d/*.asc && \
- echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
diff --git a/PHP/.devcontainer/devcontainer.json b/PHP/.devcontainer/devcontainer.json
deleted file mode 100644
index 442cb999..00000000
--- a/PHP/.devcontainer/devcontainer.json
+++ /dev/null
@@ -1,36 +0,0 @@
-// For format details, see https://aka.ms/devcontainer.json. For config options, see the
-// README at: https://github.com/devcontainers/templates/tree/main/src/php
-{
- "name": "PHP",
- // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
- "build": {
- "dockerfile": "Dockerfile"
- },
-
- // Configure tool-specific properties.
- "customizations": {
- "vscode": {
- "extensions": [
- "brapifra.phpserver",
- "emallin.phpunit",
- "eamodio.gitlens"
- ]
- }
- },
-
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- "forwardPorts": [
- 8080
- ],
-
- // Use 'postCreateCommand' to run commands after the container is created.
- "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html",
-
- // Features to add to the dev container. More info: https://containers.dev/features.
- "features": {
- "ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
- }
-
- // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
- // "remoteUser": "root"
-}
diff --git a/PHP/.env.example b/PHP/.env.example
deleted file mode 100644
index d75af5ee..00000000
--- a/PHP/.env.example
+++ /dev/null
@@ -1,7 +0,0 @@
-SQLITE_CONNECTION_STRING=sqlitecloud://myhost.sqlite.cloud
-SQLITE_USER=admin
-SQLITE_PASSWORD=
-SQLITE_API_KEY=
-SQLITE_HOST=myhost.sqlite.cloud
-SQLITE_DB=chinook.sqlite
-SQLITE_PORT=8860
diff --git a/PHP/.gitignore b/PHP/.gitignore
deleted file mode 100644
index c442708d..00000000
--- a/PHP/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-# composer
-vendor
-
-# phpunit
-.phpunit.result.cache
-
-.env
diff --git a/PHP/admin/assets/images/logo.png b/PHP/admin/assets/images/logo.png
deleted file mode 100644
index 1fc3cb69..00000000
Binary files a/PHP/admin/assets/images/logo.png and /dev/null differ
diff --git a/PHP/admin/auth.php b/PHP/admin/auth.php
deleted file mode 100644
index 76b6e2ae..00000000
--- a/PHP/admin/auth.php
+++ /dev/null
@@ -1,14 +0,0 @@
-= $session_max_time))) {
- session_unset();
- session_destroy();
- header("Location: login.php");
- exit();
- }
-
-?>
\ No newline at end of file
diff --git a/PHP/admin/backups.php b/PHP/admin/backups.php
deleted file mode 100644
index d72c7877..00000000
--- a/PHP/admin/backups.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Backups
-
-
-
-
-
-
-
diff --git a/PHP/admin/commands.php b/PHP/admin/commands.php
deleted file mode 100644
index d420b1da..00000000
--- a/PHP/admin/commands.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Commands
-
-
-
-
-
-
-
diff --git a/PHP/admin/common.php b/PHP/admin/common.php
deleted file mode 100644
index 793aba63..00000000
--- a/PHP/admin/common.php
+++ /dev/null
@@ -1,302 +0,0 @@
-username = $username;
- $sqlitecloud->password = $password;
- if (file_exists('assets/ca.pem')) {$sqlitecloud->tls_root_certificate = 'assets/ca.pem';}
- $sqlitecloud->compression = false;
-
- try {
- if ($sqlitecloud->connect($hostname, $port) == false) {
- $msg = $sqlitecloud->errmsg;
- $sqlitecloud = NULL;
- return $msg;
- }
- } catch (Exception $e) {
- return $e->getMessage();
- }
-
- return true;
- }
-
- function do_check_connect() {
- global $sqlitecloud;
- if ($sqlitecloud == NULL) {
- $hostname = $_SESSION['hostname'];
- $username = $_SESSION['username'];
- $password = $_SESSION['password'];
- $port = $_SESSION['port'];
- do_real_connect($hostname, $port, $username, $password);
- }
-
- return $sqlitecloud;
- }
-
- function do_disconnect() {
- global $sqlitecloud;
- if ($sqlitecloud != NULL) $sqlitecloud->disconnect();
- }
-
- function query_nodeinfo() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST INFO;");
- }
-
- function query_listnodes() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST NODES;");
- }
-
- function query_listcommands() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST COMMANDS;");
- }
-
- function query_listdatabases($detailed = false) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute(($detailed) ? "LIST DATABASES DETAILED;" : "LIST DATABASES;");
- }
-
- function query_listconnections() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST CONNECTIONS;");
- }
-
- function query_listplugins() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST PLUGINS;");
- }
-
- function query_listlogs($n = 50) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST LOG LIMIT {$n};");
- }
-
- function query_listbackups() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST BACKUPS;");
- }
-
- function query_listusers($withrules = false) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute(($withrules) ? "LIST USERS WITH ROLES" : "LIST USERS;");
- }
-
- function query_liststats() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST STATS;");
- }
-
- function query_listlatency() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST LATENCY;");
- }
-
- function query_listkeys() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("LIST KEYS DETAILED;");
- }
-
- function exec_sql($dbname, $sql) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("SWITCH DATABASE {$dbname};{$sql}");
- }
-
- function exec_downloaddatabase($dbname) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("DOWNLOAD DATABASE {$dbname};");
- }
-
- function exec_downloadstep() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("DOWNLOAD STEP;");
- }
-
- function exec_uploaddatabase($dbname, $key) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- $command = ($key) ? "UPLOAD DATABASE '${dbname}' KEY '{$key}';" : "UPLOAD DATABASE '{$dbname}';";
- return $sqlitecloud->execute($command);
- }
-
- function exec_uploadabort() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->execute("DOWNLOAD ABORT;");
- }
-
- function exec_uploadblob($blob) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->sendblob($blob);
- }
-
- function exec_lasterror($detailed = false) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- if ($detailed) return $sqlitecloud->errmsg . ' (' . $sqlitecloud->errcode . ' - ' . $sqlitecloud->xerrcode . ')';
- return $sqlitecloud->errmsg;
- }
-
- function exec_lasterror_code() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->errcode;
- }
-
- function exec_lasterror_xcode() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- return $sqlitecloud->xerrcode;
- }
-
- // MARK: -
-
- function current_page() {
- return pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME);
- }
-
- function render_current_page($name) {
- if ($name == current_page()) print 'active';
- }
-
- function render_error($err) {
- // bootstrap 4 error alert: https://getbootstrap.com/docs/4.6/components/alerts/
- print('
');
- print($err);
- print('
');
- }
-
- function render_listdatabases() {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- $rs = $sqlitecloud->execute("LIST DATABASES;");
- if ($rs == false) return;
-
- for ($i=0; $i < $rs->nrows; ++$i) {
- $dbname = $rs->value($i, 0);
- echo "\n";
- }
- }
-
- function render_console_table($rs) {
- ob_start();
- render_table($rs);
- return ob_get_clean();
- }
-
- function render_table($rs, $oncolumn = NULL) {
- // check for error first
- if ($rs == false) {
- global $sqlitecloud;
- $sqlitecloud = do_check_connect();
- render_error($sqlitecloud->errmsg);
- return;
- }
-
- // table
- print('');
-
- // build header
- print("\n");
- for ($i=0; $i < $rs->ncols; ++$i) {
- $name = $rs->name($i);
- print("{$name} | ");
- }
- print("
\n");
-
- // build values
- print("\n");
- for ($i=0; $i < $rs->nrows; ++$i) {
- print("");
- for ($j=0; $j < $rs->ncols; ++$j) {
- $v = $rs->value($i, $j);
- $v2 = false;
- $value = NULL;
- if (!is_null($oncolumn)) $v2 = $oncolumn($v, $i, $j);
- if ($v2 === false) $value = (is_null($v)) ? 'N/A' : htmlentities($v);
- else $value = $v2;
- print("{$value} | ");
- }
- print("
\n");
- }
- print("\n");
- print("
\n");
- }
-
- function render_chart_js($rs, $divID, $kvalue, $debug = false) {
- $script = "var ctx = document.getElementById('{$divID}');";
- $script .= "var myChart = new Chart(ctx, {type: 'line',";
-
- $labels = "data: {labels: [";
- $dataset = "datasets: [{data: [";
-
- // date, key, value
- //$cols = $rs->ncols;
- //$count = $rs->nrows / $rs->ncols;
- //if ($count > 15) $count = 15 * $rs->ncols;
- if (!$rs == false) {
- $count = $rs->nrows;
- for ($i=0; $i<$count; $i+=1) {
- $key = $rs->value($i, 1);
- if ($key == $kvalue) {
- $vdate = $rs->value($i, 0);
- $value = $rs->value($i, 2);
- $labels .= "'{$vdate}',";
- $dataset .= "{$value},";
- }
- }
- }
-
- $labels .= "],";
- $dataset .= "],";
-
- $script .= $labels;
- $script .= $dataset;
-
- $script .= "lineTension: 0, backgroundColor: 'transparent', borderColor: '#007bff', borderWidth: 4, pointBackgroundColor: '#007bff'}]";
- $script .= "},
- options: {
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: false
- }
- }]
- },
- legend: {
- display: false
- }
- }
- });";
-
- return $script;
- }
-?>
diff --git a/PHP/admin/connections.php b/PHP/admin/connections.php
deleted file mode 100644
index 6056cc06..00000000
--- a/PHP/admin/connections.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- Connections
-
-
-
-
-
-
-
diff --git a/PHP/admin/console.js b/PHP/admin/console.js
deleted file mode 100644
index 223e61fc..00000000
--- a/PHP/admin/console.js
+++ /dev/null
@@ -1,69 +0,0 @@
-const form = document.getElementById('console-form');
-
-form.addEventListener('submit', function(event) {
- event.preventDefault();
-
- // sanity check
- if (!this.database.value) return false;
- if (!this.sql.value) return false;
-
- const data = {
- database: this.database.value,
- sql: this.sql.value
- };
-
- console.log(this.database.value);
- console.log(this.sql.value);
-
- postData(data).then (reply => {
- console.log(reply);
-
- var errorID = document.getElementById('console-error');
- var messageID = document.getElementById('console-message');
- var tableID = document.getElementById('console-table');
-
- // hide all
- errorID.style.display = "none";
- messageID.style.display = "none";
- tableID.style.display = "none";
-
- if (reply['result'] == 0) {
- errorID.innerHTML = reply['msg'];
- errorID.style.display = "block";
- return;
- }
-
- if (reply['result'] == 1) {
- messageID.innerHTML = reply['msg'];
- messageID.style.display = "block";
- return;
- }
-
- // else display table
- if (reply['result'] == 2) {
- tableID.innerHTML = reply['msg'];
- tableID.style.display = "block";
- }
-
- });
-});
-
-async function postData(data) {
- try {
- const response = await fetch ('/console_action.php', {
- method: 'POST',
- body: JSON.stringify(data)
- }
- );
-
- const reply = await response.json();
- return reply;
-
- } catch (error) {
- const reply = {
- result: 0,
- msg: error
- };
- return JSON.stringify(reply);
- }
-}
\ No newline at end of file
diff --git a/PHP/admin/console.php b/PHP/admin/console.php
deleted file mode 100644
index 46ad9c9a..00000000
--- a/PHP/admin/console.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- Console
-
-
-
-
-
-
-
-
-
-
diff --git a/PHP/admin/console_action.php b/PHP/admin/console_action.php
deleted file mode 100644
index 02494db5..00000000
--- a/PHP/admin/console_action.php
+++ /dev/null
@@ -1,25 +0,0 @@
- 0, 'msg' => exec_lasterror(true));
- } else if ($rc instanceof SQLiteCloudRowset) {
- $r = array('result' => 2, 'msg' => render_console_table($rc));
- } else if ($rc === true) {
- $r = array('result' => 1, 'msg' => 'Query succesfully executed.');
- } else if ($rc === null) {
- $r = array('result' => 1, 'msg' => 'NULL');
- } else {
- $r = array('result' => 1, 'msg' => $rc);
- }
-
- echo json_encode($r);
-?>
\ No newline at end of file
diff --git a/PHP/admin/dashboard.css b/PHP/admin/dashboard.css
deleted file mode 100644
index b71942ad..00000000
--- a/PHP/admin/dashboard.css
+++ /dev/null
@@ -1,103 +0,0 @@
-body {
- font-size: .875rem;
-}
-
-.feather {
- width: 16px;
- height: 16px;
- vertical-align: text-bottom;
-}
-
-/*
- * Sidebar
- */
-
-.sidebar {
- position: fixed;
- top: 0;
- bottom: 0;
- left: 0;
- z-index: 100; /* Behind the navbar */
- padding: 48px 0 0; /* Height of navbar */
- box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
-}
-
-@media (max-width: 767.98px) {
- .sidebar {
- top: 5rem;
- }
-}
-
-.sidebar-sticky {
- position: relative;
- top: 0;
- height: calc(100vh - 48px);
- padding-top: .5rem;
- overflow-x: hidden;
- overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
-}
-
-@supports ((position: -webkit-sticky) or (position: sticky)) {
- .sidebar-sticky {
- position: -webkit-sticky;
- position: sticky;
- }
-}
-
-.sidebar .nav-link {
- font-weight: 500;
- color: #333;
-}
-
-.sidebar .nav-link .feather {
- margin-right: 4px;
- color: #999;
-}
-
-.sidebar .nav-link.active {
- color: #007bff;
-}
-
-.sidebar .nav-link:hover .feather,
-.sidebar .nav-link.active .feather {
- color: inherit;
-}
-
-.sidebar-heading {
- font-size: .75rem;
- text-transform: uppercase;
-}
-
-/*
- * Navbar
- */
-
-.navbar-brand {
- padding-top: .75rem;
- padding-bottom: .75rem;
- font-size: 1rem;
- background-color: rgba(0, 0, 0, .25);
- box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
-}
-
-.navbar .navbar-toggler {
- top: .25rem;
- right: 1rem;
-}
-
-.navbar .form-control {
- padding: .75rem 1rem;
- border-width: 0;
- border-radius: 0;
-}
-
-.form-control-dark {
- color: #fff;
- background-color: rgba(255, 255, 255, .1);
- border-color: rgba(255, 255, 255, .1);
-}
-
-.form-control-dark:focus {
- border-color: transparent;
- box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
-}
diff --git a/PHP/admin/dashboard.js b/PHP/admin/dashboard.js
deleted file mode 100644
index c0ce2093..00000000
--- a/PHP/admin/dashboard.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* globals Chart:false, feather:false */
-
-(function () {
- 'use strict'
-
- feather.replace()
-
- /*
- // Graphs
- var ctx = document.getElementById('myChart')
- // eslint-disable-next-line no-unused-vars
- var myChart = new Chart(ctx, {
- type: 'line',
- data: {
- labels: [
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday'
- ],
- datasets: [{
- data: [
- 15339,
- 21345,
- 18483,
- 24003,
- 23489,
- 24092,
- 12034
- ],
- lineTension: 0,
- backgroundColor: 'transparent',
- borderColor: '#007bff',
- borderWidth: 4,
- pointBackgroundColor: '#007bff'
- }]
- },
- options: {
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: false
- }
- }]
- },
- legend: {
- display: false
- }
- }
- })
- */
-})()
diff --git a/PHP/admin/databases.php b/PHP/admin/databases.php
deleted file mode 100644
index eefa86f6..00000000
--- a/PHP/admin/databases.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- Databases
-
- ' . $value . '';
- }
- $rs = query_listdatabases(true);
- render_table($rs, "on_column");
- ?>
-
-
-
-
-
-
-
-
diff --git a/PHP/admin/download.php b/PHP/admin/download.php
deleted file mode 100644
index ce6c8118..00000000
--- a/PHP/admin/download.php
+++ /dev/null
@@ -1,25 +0,0 @@
-
\ No newline at end of file
diff --git a/PHP/admin/include/footer.php b/PHP/admin/include/footer.php
deleted file mode 100644
index 6677aecb..00000000
--- a/PHP/admin/include/footer.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- ' . $jscript . '';
- if (isset($jsinclude)) echo '';
- echo "\n";
- ?>
-