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(''); - } - - 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(""); - } - 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(""); - } - print("\n"); - } - print("\n"); - print("
{$name}
{$value}
\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"; - ?> - - - - \ No newline at end of file diff --git a/PHP/admin/include/header.php b/PHP/admin/include/header.php deleted file mode 100644 index 2cf04b64..00000000 --- a/PHP/admin/include/header.php +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - SQLite Cloud Dashboard - - - - - - - - - - - - - - -
-
- - \ No newline at end of file diff --git a/PHP/admin/index.php b/PHP/admin/index.php deleted file mode 100644 index fa857328..00000000 --- a/PHP/admin/index.php +++ /dev/null @@ -1,24 +0,0 @@ - - -
- -

Nodes

-
- -
- - -

-
- -
- -
- - diff --git a/PHP/admin/info.php b/PHP/admin/info.php deleted file mode 100644 index f801e56b..00000000 --- a/PHP/admin/info.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/PHP/admin/latency.php b/PHP/admin/latency.php deleted file mode 100644 index ebc6a4a9..00000000 --- a/PHP/admin/latency.php +++ /dev/null @@ -1,15 +0,0 @@ - - -
- -

Latency

-
- -
- -
- - diff --git a/PHP/admin/login.js b/PHP/admin/login.js deleted file mode 100644 index 1346b522..00000000 --- a/PHP/admin/login.js +++ /dev/null @@ -1,48 +0,0 @@ -const form = document.getElementById('login-form'); - -form.addEventListener('submit', function(event) { - event.preventDefault(); - - // sanity check - if (!this.hostname.value) return false; - if (!this.port.value) return false; - if (!this.username.value) return false; - if (!this.password.value) return false; - - const data = { - hostname: this.hostname.value, - port: this.port.value, - username: this.username.value, - password: this.password.value - }; - - postData(data).then (reply => { - if (reply['result'] == 0) { - var div = document.getElementById('message'); - div.innerHTML = reply['msg']; - div.style.display = "block"; - return; - } - location.href = '/index.php'; - }); -}); - -async function postData(data) { - try { - const response = await fetch ('/login_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/login.php b/PHP/admin/login.php deleted file mode 100644 index be3f593a..00000000 --- a/PHP/admin/login.php +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - SQLite Cloud Admin - - - -
- -
- -

Dashboard Admin

-
- -
-
- -
- - - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
- -
-
-
- - - - - - - - diff --git a/PHP/admin/login_action.php b/PHP/admin/login_action.php deleted file mode 100644 index 428d617b..00000000 --- a/PHP/admin/login_action.php +++ /dev/null @@ -1,26 +0,0 @@ - 1); - $_SESSION['start'] = time(); - $_SESSION['port'] = $port; - $_SESSION['hostname'] = $hostname; - $_SESSION['username'] = $username; - $_SESSION['password'] = $password; - } else { - // error - $r = array('result' => 0, 'msg' => $rc); - } - - echo json_encode($r); -?> \ No newline at end of file diff --git a/PHP/admin/logout.php b/PHP/admin/logout.php deleted file mode 100644 index 908b2120..00000000 --- a/PHP/admin/logout.php +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - SQLite Cloud Admin - - - -
- -
- -

Goodbye!

-
- - - - - - - diff --git a/PHP/admin/logs.php b/PHP/admin/logs.php deleted file mode 100644 index dfcb6268..00000000 --- a/PHP/admin/logs.php +++ /dev/null @@ -1,45 +0,0 @@ - - -
- -

Logs

-
- PANIC'; - case 1: return 'FATAL'; - case 2: return 'ERROR'; - case 3: return 'WARNING'; - case 4: return 'INFO'; - case 5: return 'DEBUG'; - default: return $value; - } - } - - return false; - } - $rs = query_listlogs(50); - render_table($rs, 'on_column'); - ?> -
- -
- - diff --git a/PHP/admin/plugins.php b/PHP/admin/plugins.php deleted file mode 100644 index 56c89521..00000000 --- a/PHP/admin/plugins.php +++ /dev/null @@ -1,15 +0,0 @@ - - -
- -

Plugins

-
- -
- -
- - diff --git a/PHP/admin/settings.php b/PHP/admin/settings.php deleted file mode 100644 index b3d7f368..00000000 --- a/PHP/admin/settings.php +++ /dev/null @@ -1,15 +0,0 @@ - - -
- -

Settings

-
- -
- -
- - diff --git a/PHP/admin/stats.php b/PHP/admin/stats.php deleted file mode 100644 index 44daf5af..00000000 --- a/PHP/admin/stats.php +++ /dev/null @@ -1,37 +0,0 @@ - - -
- - -

Memory Usage

- - -

Bytes In

- - -

Bytes Out

- - -

CPU Usage

- - - - -
- - - - diff --git a/PHP/admin/upload.js b/PHP/admin/upload.js deleted file mode 100644 index 77a96340..00000000 --- a/PHP/admin/upload.js +++ /dev/null @@ -1,186 +0,0 @@ -const form = document.getElementById('upload-form'); -const enableLogging = true; - -const actionTypeUploadStart = 1 -const actionTypeUploadEnd = 2 -const actionTypeUploadError = 3 -const actionTypeUploadLoop = 4 - -form.addEventListener('submit', function(event) { - event.preventDefault(); - - if (!this.datafile.value) return false; - - var f = document.getElementById('datafile'); - var k = document.getElementById('enckey'); - - var file = f.files[0]; - var size = file.size; - var key = (k.value && k.value.length) ? k.value : null; - var sliceSize = 1024*1024; - var start = 0; - - var result = uploadDatabase(f.value, key, file, size, sliceSize); -}); - -function uploadDatabase(path, key, file, size, chunkSize) { - if (enableLogging) console.log("uploadDatabase: " + path + " key: " + key + " size: " + size + " chunk: " + chunkSize); - - if (uploadStart(path, key, size, chunkSize) == false) return false; - if (uploadLoop(file, 0, size, chunkSize) == false) return false; - return true; -} - -function uploadStart(file, key, size, chunkSize) { - resetUI(actionTypeUploadStart); - - var name = file.split(/(\\|\/)/g).pop(); - if (enableLogging) console.log('uploadStart ' + name); - - var formdata = new FormData(); - formdata.append('action', 0); // START - formdata.append('name', name); - if (key) formdata.append('key', key); - - var reqcount = Math.round((size / chunkSize) + 50); - if (enableLogging) console.log("reqcount: " + reqcount); - - var xhr = new XMLHttpRequest(); - xhr.open('POST', '/upload_action.php', false); - xhr.setRequestHeader("Connection", "keep-alive"); - xhr.setRequestHeader("Keep-Alive", "timeout=15, max=" + reqcount + "\""); - xhr.send(formdata); - - return true; -} - -function uploadEnd() { - resetUI(actionTypeUploadEnd); - - if (enableLogging) console.log('uploadEnd'); - - var formdata = new FormData(); - formdata.append('action', 2); // END - - var xhr = new XMLHttpRequest(); - xhr.open('POST', '/upload_action.php', false); - xhr.send(formdata); - - progressSet(100); - displayMessage("Database succesfully uploaded."); - - setTimeout(() => {location.href = '/databases.php';}, 500); - return true; -} - -function uploadAbort() { - resetUI(actionTypeUploadError); - - if (enableLogging) console.log('uploadAbort'); - - var formdata = new FormData(); - formdata.append('action', 666); // ABORT - - var xhr = new XMLHttpRequest(); - xhr.open('POST', '/upload_action.php', false); - xhr.send(formdata); - - return true; -} - -function uploadLoop (file, start, end, size) { - // compute local values - var islast = false; - var len = size; - if (start + len > end) {len = end - size; islast = true;} - if (len < 0) len = end; - - // send next/final chunk ONLY after the previous one has been sent - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function () { - if (xhr.readyState == XMLHttpRequest.DONE) { - if (this.responseText != 0) { - uploadAbort(); - displayError(this.responseText); - return; - } - - var value = Math.floor(( start / end) * 100); - progressSet(value); - (islast) ? uploadEnd() : uploadLoop(file, start + size, end, size); - } - } - - // compute chunk to send - var chunk = slice(file, start, start + len); - - // chunk is now a Blob that can only be read async - const reader = new FileReader(); - reader.onloadend = function () { - // prepare parameters - if (enableLogging) console.log('uploadChunk: ' + start + ' ' + len); - - var formdata = new FormData(); - formdata.append('action', 1); // UPLOAD - formdata.append('start', start); - formdata.append('len', len); - formdata.append('end', end); - formdata.append('chunk', reader.result); // reader.result contains the contents of blob - formdata.append('encoding', 1); // 1 -> base64, 2 -> binary - - // post data - xhr.open('POST', '/upload_action.php', true); - xhr.send(formdata); - } - reader.readAsDataURL(chunk); - - return true; -} - -function slice(file, start, end) { - var slice = file.mozSlice ? file.mozSlice : - file.webkitSlice ? file.webkitSlice : - file.slice ? file.slice : noop; - return slice.bind(file)(start, end); -} - -function noop() { -} - -function displayError(msg) { - var errorID = document.getElementById('upload_error'); - errorID.innerHTML = msg; - errorID.style.display = "block"; -} - -function displayMessage(msg) { - var messageID = document.getElementById('upload_message'); - messageID.innerHTML = '' + msg + ''; - messageID.style.display = "block"; -} - -function resetUI(actionType) { - var errorID = document.getElementById('upload_error'); - var messageID = document.getElementById('upload_message'); - var progressID = document.getElementById('upload_progress'); - var buttonID = document.getElementById('upload_button'); - - var showProgress = (actionType == actionTypeUploadStart); - var hideProgrss = (actionType == actionTypeUploadEnd); - var hideError = (actionType == actionTypeUploadStart); - var enableButton = (actionType == actionTypeUploadEnd) || (actionType == actionTypeUploadError); - var disableButton = (actionType == actionTypeUploadStart); - var hideMessage = (actionType == actionTypeUploadStart); - - if (showProgress) progressID.style.display = "block"; - if (hideProgrss) progressID.style.display = "none"; - if (hideError) errorID.style.display = "none"; - if (hideMessage) messageID.style.display = "none"; - if (enableButton) buttonID.disabled = false; - if (disableButton) buttonID.disabled = true; -} - -function progressSet(value) { - var progressID = document.getElementById('upload_progress'); - progressID.value = value; -} diff --git a/PHP/admin/upload_action.php b/PHP/admin/upload_action.php deleted file mode 100644 index 069c90dd..00000000 --- a/PHP/admin/upload_action.php +++ /dev/null @@ -1,58 +0,0 @@ - \ No newline at end of file diff --git a/PHP/admin/users.php b/PHP/admin/users.php deleted file mode 100644 index e01f249f..00000000 --- a/PHP/admin/users.php +++ /dev/null @@ -1,15 +0,0 @@ - - -
- -

Users

-
- -
- -
- - diff --git a/PHP/bootstrap.php b/PHP/bootstrap.php deleted file mode 100644 index af3b271e..00000000 --- a/PHP/bootstrap.php +++ /dev/null @@ -1,11 +0,0 @@ -load() as $key => $value) { - putenv("$key=$value"); -} diff --git a/PHP/composer.json b/PHP/composer.json deleted file mode 100644 index 041fe9cf..00000000 --- a/PHP/composer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "require-dev": { - "phpunit/phpunit": "^6.5", - "vlucas/phpdotenv": "^5.6" - } -} diff --git a/PHP/composer.lock b/PHP/composer.lock deleted file mode 100644 index d5ed9537..00000000 --- a/PHP/composer.lock +++ /dev/null @@ -1,2218 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "cbefa51744cd17e36c5f01124956ae20", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/deprecations", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.3" - }, - "time": "2024-01-30T19:34:25+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^11", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2022-12-30T00:15:36+00:00" - }, - { - "name": "graham-campbell/result-type", - "version": "v1.1.2", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\ResultType\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "An Implementation Of The Result Type", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Result Type", - "Result-Type", - "result" - ], - "support": { - "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", - "type": "tidelift" - } - ], - "time": "2023-11-12T22:16:48+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.11.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2023-03-08T13:26:56+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" - }, - "time": "2017-03-05T18:14:27+00:00" - }, - { - "name": "phar-io/version", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" - }, - "time": "2017-03-05T17:38:23+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.1", - "ext-filter": "*", - "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.5", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" - }, - "time": "2024-04-09T21:13:58+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.8.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "153ae662783729388a584b4361f2545e4d841e3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", - "reference": "153ae662783729388a584b4361f2545e4d841e3c", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", - "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" - }, - "require-dev": { - "ext-tokenizer": "*", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" - }, - "time": "2024-02-23T11:10:43+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.9.2", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2023-11-12T21:59:55+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.10.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "451c3cd1418cf640de218914901e51b064abb093" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", - "reference": "451c3cd1418cf640de218914901e51b064abb093", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" - }, - "time": "2020-03-05T15:02:03+00:00" - }, - { - "name": "phpstan/phpdoc-parser", - "version": "1.28.0", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "symfony/process": "^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "support": { - "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" - }, - "time": "2024-04-03T18:51:33+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "5.3.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac", - "reference": "c89677919c5dd6d3b3852f230a663118762218ac", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-xdebug": "^2.5.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/5.3" - }, - "time": "2018-04-06T15:36:58+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" - }, - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" - }, - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/master" - }, - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" - }, - "abandoned": true, - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "6.5.14", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7", - "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.9", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/6.5.14" - }, - "time": "2019-02-01T05:22:47+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.10", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f", - "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5.11" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", - "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/5.0.10" - }, - "abandoned": true, - "time": "2018-08-09T05:50:03+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", - "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-01T13:45:45+00:00" - }, - { - "name": "sebastian/comparator", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", - "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/diff": "^2.0 || ^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/master" - }, - "time": "2018-02-01T13:46:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/master" - }, - "time": "2017-08-03T08:09:46+00:00" - }, - { - "name": "sebastian/environment", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/master" - }, - "time": "2017-07-01T08:51:00+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1939bc8fd1d39adcfa88c5b35335910869214c56", - "reference": "1939bc8fd1d39adcfa88c5b35335910869214c56", - "shasum": "" - }, - "require": { - "php": ">=7.2", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-02T06:21:38+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" - }, - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "ac5b293dba925751b808e02923399fb44ff0d541" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541", - "reference": "ac5b293dba925751b808e02923399fb44ff0d541", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-01T13:54:02+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "1d439c229e61f244ff1f211e5c99737f90c67def" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def", - "reference": "1d439c229e61f244ff1f211e5c99737f90c67def", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-01T13:56:04+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/9bfd3c6f1f08c026f542032dfb42813544f7d64c", - "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-01T14:07:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" - }, - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/master" - }, - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.3" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2024-03-03T12:36:25+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v5.6.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", - "symfony/polyfill-ctype": "^1.24", - "symfony/polyfill-mbstring": "^1.24", - "symfony/polyfill-php80": "^1.24" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "ext-filter": "*", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator." - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2023-11-12T22:43:29+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" - }, - "time": "2022-06-03T18:03:27+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/PHP/phpunit.xml b/PHP/phpunit.xml deleted file mode 100644 index 1bd04ae8..00000000 --- a/PHP/phpunit.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - tests - - - diff --git a/PHP/src/sqcloud.php b/PHP/src/sqcloud.php deleted file mode 100644 index 27cd6a1f..00000000 --- a/PHP/src/sqcloud.php +++ /dev/null @@ -1,884 +0,0 @@ -= $this->nrows) return -1; - if ($col < 0 || $col >= $this->ncols) return -1; - return $row*$this->ncols+$col; - } - - public function value ($row, $col) { - $index = $this->compute_index($row, $col); - if ($index < 0) return NULL; - return $this->data[$index]; - } - - public function name ($col) { - if ($col < 0 || $col >= $this->ncols) return NULL; - return $this->colname[$col]; - } - - public function dump () { - print("version: {$this->version}\n"); - print("nrows: {$this->nrows}\n"); - print("ncols: {$this->ncols}\n"); - - print("colname: "); - print_r($this->colname); - print("\n"); - - if ($this->version == 2) { - print("decltype: "); - print_r($this->decltype); - print("\n"); - - print("dbname: "); - print_r($this->dbname); - print("\n"); - - print("tblname: "); - print_r($this->tblname); - print("\n"); - - print("origname: "); - print_r($this->origname); - print("\n"); - - print("notnull: "); - print_r($this->notnull); - print("\n"); - - print("prikey: "); - print_r($this->prikey); - print("\n"); - - print("autoinc: "); - print_r($this->autoinc); - print("\n"); - } - - if ($this->data && count($this->data) > 0) { - print("data: "); - print_r($this->data); - print("\n"); - } - } - } - - class SQLiteCloud { - const SDKVersion = '1.1.0'; - - // User name is required unless connectionstring is provided - public $username = ''; - // Password is required unless connection string is provided - public $password = ''; - // Password is hashed - public $password_hashed = false; - // API key instead of username and password - public $apikey = ''; - - // Name of database to open - public $database = ''; - // Optional query timeout passed directly to TLS socket - public $timeout = NULL; - // Socket connection timeout - public $connect_timeout = 20; - - // Enable compression - public $compression = false; - // Tell the server to zero-terminate strings - public $zerotext = false; - // Database will be created in memory - public $memory = false; - // Create the database if it doesn't exist? - public $create = false; - // Request for immediate responses from the server node without waiting for linerizability guarantees - public $non_linearizable = false; - // Connect using plain TCP port, without TLS encryption, NOT RECOMMENDED - public $insecure = false; - // Accept invalid TLS certificates - public $no_verify_certificate = false; - - // Certificates - public $tls_root_certificate = NULL; - public $tls_certificate = NULL; - public $tls_certificate_key = NULL; - - // Server should send BLOB columns - public $noblob = false; - // Do not send columns with more than max_data bytes - public $maxdata = 0; - // Server should chunk responses with more than maxRows - public $maxrows = 0; - // Server should limit total number of rows in a set to maxRowset - public $maxrowset = 0; - - public $errmsg = NULL; - public $errcode = 0; - public $xerrcode = 0; - - private $socket = NULL; - private $isblob = false; - private $rowset = NULL; - - // PUBLIC - public function connect ($hostname = "localhost", $port = 8860) { - $ctx = ($this->insecure) ? 'tcp' : 'tls'; - $address = "{$ctx}://{$hostname}:{$port}"; - - // check setup context for TLS connection - $context = NULL; - if (!$this->insecure) { - $context = stream_context_create(); - if ($this->tls_root_certificate) stream_context_set_option($context, 'ssl', 'cafile', $this->tls_root_certificate); - if ($this->tls_certificate) stream_context_set_option($context, 'ssl', 'local_cert', $this->tls_certificate); - if ($this->tls_certificate_key) stream_context_set_option($context, 'ssl', 'local_pk', $this->tls_certificate_key); - if ($this->no_verify_certificate) { - stream_context_set_option($context, 'ssl', 'verify_peer ', false); - stream_context_set_option($context, 'ssl', 'verify_peer_name ', false); - } - } - - // connect to remote socket - $socket = stream_socket_client($address, $this->errcode, $this->errmsg, $this->connect_timeout, STREAM_CLIENT_CONNECT, $context); - if (!$socket) { - if ($this->errcode == 0) { - // if the value returned in errcode is 0 and stream_socket_client returned false, it is an indication - // that the error occurred before the connect() call. This is most likely due to a problem initializing - // the socket - $extmsg = ($this->insecure) ? '(before connecting to remote host)' : '(possibly wrong TLS certificate)'; - $this->errmsg = "An error occurred while initializing the socket {$extmsg}."; - $this->errcode = -1; - } - return false; - } - - $this->socket = $socket; - if ($this->internal_config_apply() == false) return false; - - return true; - } - - public function connectWithString ($connectionString) { - // URL STRING FORMAT - // sqlitecloud://user:pass@host.com:port/dbname?timeout=10&key2=value2&key3=value3 - // or sqlitecloud://host.sqlite.cloud:8860/dbname?apikey=zIiAARzKm9XBVllbAzkB1wqrgijJ3Gx0X5z1A4m4xBA - - $params = parse_url($connectionString); - if (!is_array($params)) { - $this->errmsg = "Invalid connection string: {$connectionString}."; - $this->errcode = -1; - return false; - } - - $options = []; - $query = isset($params['query']) ? $params['query'] : ''; - parse_str($query, $options); - foreach ($options as $option => $value) { - $opt = strtolower($option); - - // prefix for certificate options - if (strcmp($opt, "root_certificate") == 0 - || strcmp($opt, "certificate") == 0 - || strcmp($opt, "certificate_key") == 0) { - $opt = "tls_" . $opt; - } - - if (property_exists($this, $opt)) { - if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null) { - $this->{$opt} = (bool) ($value); - } else if (is_numeric($value)) { - $this->{$opt} = (int) ($value); - } else { - $this->{$opt} = $value; - } - } - } - - // apikey or username/password is accepted - if (!$this->apikey) { - $this->username = isset($params['user']) ? urldecode($params['user']) : ''; - $this->password = isset($params['pass']) ? urldecode($params['pass']) : ''; - } - - $path = isset($params['path']) ? $params['path'] : ''; - $database = str_replace('/', '', $path); - if ($database) { - $this->database = $database; - } - - $hostname = $params['host']; - $port = isset($params['port']) ? (int)($params['port']) : null; - - if ($port) { - return $this->connect($hostname, $port); - } - - return $this->connect($hostname); - - } - - public function disconnect () { - $this->internal_clear_error(); - if ($this->socket) fclose($this->socket); - $this->socket = NULL; - } - - public function execute ($command) { - return $this->internal_run_command($command); - } - - public function sendblob ($blob) { - $this->isblob = true; - $rc = $this->internal_run_command($blob); - $this->isblob = false; - return $rc; - } - - // MARK: - - - // PRIVATE - - // lz4decode function from http://heap.ch/blog/2019/05/18/lz4-decompression/ - /* - MIT License - - Copyright (c) 2019 Stephan J. Müller - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - private function lz4decode($in, $offset = 0, $header = '') { - $len = strlen($in); - $out = $header; - $i = $offset; - $take = function() use ($in, &$i) { - return ord($in[$i++]); - }; - $addOverflow = function(&$sum) use ($take) { - do { - $sum += $summand = $take(); - } while ($summand === 0xFF); - }; - while ($i < $len) { - $token = $take(); - $nLiterals = $token >> 4; - if ($nLiterals === 0xF) $addOverflow($nLiterals); - $out .= substr($in, $i, $nLiterals); - $i += $nLiterals; - if ($i === $len) break; - $offset = $take() | $take() << 8; - $matchlength = $token & 0xF; - if ($matchlength === 0xF) $addOverflow($matchlength); - $matchlength += 4; - $j = strlen($out) - $offset; - while ($matchlength--) { - $out .= $out[$j++]; - } - } - return $out; - } - - private function internal_config_apply () { - if ($this->timeout > 0) stream_set_timeout($this->socket, $this->timeout); - - $buffer = ''; - - if ($this->apikey) { - $buffer .= "AUTH APIKEY {$this->apikey};"; - } - - if ($this->username && $this->password) { - $command = $this->password_hashed ? 'HASH' : 'PASSWORD'; - $buffer .= "AUTH USER {$this->username} {$command} {$this->password};"; - } - - if ($this->database) { - if ($this->create && !$this->memory) { - $buffer .= "CREATE DATABASE {$this->database} IF NOT EXISTS;"; - } - $buffer .= "USE DATABASE {$this->database};"; - } - - if ($this->compression) { - $buffer .= "SET CLIENT KEY COMPRESSION TO 1;"; - } - - if ($this->zerotext) { - $buffer .= "SET CLIENT KEY ZEROTEXT TO 1;"; - } - - if ($this->non_linearizable) { - $buffer .= "SET CLIENT KEY NONLINEARIZABLE TO 1;"; - } - - if ($this->noblob) { - $buffer .= "SET CLIENT KEY NOBLOB TO 1;"; - } - - if ($this->maxdata) { - $buffer .= "SET CLIENT KEY MAXDATA TO {$this->maxdata};"; - } - - if ($this->maxrows) { - $buffer .= "SET CLIENT KEY MAXROWS TO {$this->maxrows};"; - } - - if ($this->maxrowset) { - $buffer .= "SET CLIENT KEY MAXROWSET TO {$this->maxrowset};"; - } - - if (strlen($buffer) > 0) { - $result = $this->internal_run_command($buffer); - if ($result === false) return false; - } - - return true; - } - - private function internal_run_command ($buffer) { - $this->internal_clear_error(); - - if ($this->internal_socket_write($buffer) === false) return false; - return $this->internal_socket_read(); - } - - private function internal_setup_pubsub ($buffer) { - return true; - } - - private function internal_reconnect ($buffer) { - return true; - } - - private function internal_parse_array ($buffer) { - // extract the number of values in the array - $start = 0; - $n = $this->internal_parse_number($buffer, $start, $unused, 0); - - // loop to parse each individual value - $r = array(); - for ($i=0; $i < $n; ++$i) { - $cellsize = 0; - $len = strlen($buffer) - $start; - $value = $this->internal_parse_value($buffer, $len, $cellsize, $start); - $start += $cellsize; - array_push($r, $value); - } - - return $r; - } - - private function internal_clear_error () { - $this->errmsg = NULL; - $this->errcode = 0; - $this->xerrcode = 0; - } - - private function internal_socket_write ($buffer) { - // compute header - $delimit = ($this->isblob) ? '$' : '+'; - $len = ($buffer) ? strlen($buffer) : 0; - $header = "{$delimit}{$len} "; - - // write header and buffer - if (fwrite($this->socket, $header) === false) return false; - if ($len == 0) return true; - if (fwrite($this->socket, $buffer) === false) return false; - - return true; - } - - private function internal_socket_read () { - $buffer = ""; - $len = 8192; - - $nread = 0; - while (true) { - // read from socket - $temp = fread($this->socket, $len); - if ($temp === false) return false; - - // update buffers - $buffer .= $temp; - $nread += strlen($temp); - - // get first character - $c = $buffer[0]; - - // check if command does not have an explicit length - if (($c == CMD_INT) || ($c == CMD_FLOAT) || ($c == CMD_NULL)) { - // command is terminated by a space character - if ($buffer[$nread-1] != ' ') continue; - } elseif ($c == CMD_ROWSET_CHUNK) { - // chunkes are completed when the buffer contains the end-of-chunk marker - $isEndOfChunk = substr($buffer, -strlen(ROWSET_CHUNKS_END)) == ROWSET_CHUNKS_END; - if (!$isEndOfChunk) continue; - } else { - $cstart = 0; - $n = $this->internal_parse_number($buffer, $cstart); - - $can_be_zerolength = ($c == CMD_BLOB) || ($c == CMD_STRING); - if ($n == 0 && !$can_be_zerolength) continue; - - // check exit condition - if ($n + $cstart != $nread) continue; - } - - return $this->internal_parse_buffer($buffer, $nread); - } - - return false; - } - - private function internal_uncompress_data ($buffer) { - // %LEN COMPRESSED UNCOMPRESSED BUFFER - - // extract compressed size - $space_index = strpos($buffer, ' '); - $buffer = substr($buffer, $space_index + 1); - - // extract compressed size - $space_index = strpos($buffer, ' '); - $compressed_size = intval(substr($buffer, 0, $space_index)); - $buffer = substr($buffer, $space_index + 1); - - // extract decompressed size - $space_index = strpos($buffer, ' '); - $uncompressed_size = intval(substr($buffer, 0, $space_index)); - $buffer = substr($buffer, $space_index + 1); - - // extract data header - $header = substr($buffer, 0, -$compressed_size); - - // extract compressed data - $compressed_buffer = substr($buffer, -$compressed_size); - - $decompressed_buffer = $header . $this->lz4decode($compressed_buffer, 0); - - // sanity check result - if (strlen($decompressed_buffer) != $uncompressed_size + strlen($header)) { - return NULL; - } - - return $decompressed_buffer; - } - - private function internal_parse_value ($buffer, &$len, &$cellsize = NULL, $index = 0) { - if ($len <= 0) return NULL; - - // handle special NULL value case - if (is_null($buffer) || $buffer[$index] == CMD_NULL) { - $len = 0; - if (!is_null($cellsize)) $cellsize = 2; - return NULL; - } - - $cstart = $index; - $blen = $this->internal_parse_number($buffer, $cstart, $unused, $index+1); - - // handle decimal/float cases - if (($buffer[$index] == CMD_INT) || ($buffer[$index] == CMD_FLOAT)) { - $nlen = $cstart - $index; - $len = $nlen - 2; - if (!is_null($cellsize)) $cellsize = $nlen; - return substr($buffer, $index+1, $len); - } - - $len = ($buffer[$index] == CMD_ZEROSTRING) ? $blen - 1 : $blen; - if (!is_null($cellsize)) $cellsize = $blen + $cstart - $index; - - return substr($buffer, $cstart, $len); - } - - private function internal_parse_buffer ($buffer, $blen) { - // possible return values: - // true => OK - // false => error - // integer - // double - // string - // array - // object - // NULL - - // check OK value - if (strcmp($buffer, '+2 OK') == 0) return true; - - // check for compressed result - if ($buffer[0] == CMD_COMPRESSED) { - $buffer = $this->internal_uncompress_data ($buffer); - if ($buffer == NULL) { - $this->errcode = -1; - $this->errmsg = "An error occurred while decompressing the input buffer of len {$blen}."; - return false; - } - // after decompression length has changed - $blen = strlen($buffer); - } - - // first character contains command type - switch ($buffer[0]) { - case CMD_ZEROSTRING: - case CMD_RECONNECT: - case CMD_PUBSUB: - case CMD_COMMAND: - case CMD_STRING: - case CMD_ARRAY: - case CMD_BLOB: - case CMD_JSON: { - $cstart = 0; - $len = $this->internal_parse_number($buffer, $cstart); - if ($len == 0) return ""; - - if ($buffer[0] == CMD_ZEROSTRING) --$len; - $clone = substr($buffer, $cstart, $len); - - if ($buffer[0] == CMD_COMMAND) return $this->internal_run_command($clone); - else if ($buffer[0] == CMD_PUBSUB) return $this->internal_setup_pubsub($clone); - else if ($buffer[0] == CMD_RECONNECT) return $this->internal_reconnect($clone); - else if ($buffer[0] == CMD_ARRAY) return $this->internal_parse_array($clone); - - return $clone; - } - - case CMD_ERROR: { - // -LEN ERRCODE:EXTCODE ERRMSG - $cstart = 0; $cstart2 = 0; - $len = $this->internal_parse_number($buffer, $cstart); - $clone = substr($buffer, $cstart); - - $extcode = 0; - $errcode = $this->internal_parse_number($clone, $cstart2, $extcode, 0); - $this->errcode = $errcode; - $this->xerrcode = $extcode; - - $len -= $cstart2; - $this->errmsg = substr($clone, $cstart2); - - return false; - } - - case CMD_ROWSET: - case CMD_ROWSET_CHUNK: { - // CMD_ROWSET: *LEN 0:VERSION ROWS COLS DATA - // - When decompressed, LEN for ROWSET is *0 - // - // CMD_ROWSET_CHUNK: /LEN IDX:VERSION ROWS COLS DATA - // - $start = $this->internal_parse_rowset_signature($buffer, $len, $idx, $version, $nrows, $ncols); - if ($start < 0) return false; - - // check for end-of-chunk condition - if ($start == 0 && $version == 0) { - $rowset = $this->rowset; - $this->rowset = NULL; - return $rowset; - } - - $rowset = $this->internal_parse_rowset($buffer, $start, $idx, $version, $nrows, $ncols); - - // continue parsing next chunk in the buffer - if ($buffer[0] == CMD_ROWSET_CHUNK) { - $buffer = substr($buffer, $len + strlen("/{$len} ")); - if ($buffer) { - return $this->internal_parse_buffer($buffer, strlen($buffer)); - } - } - - return $rowset; - } - - case CMD_NULL: - return NULL; - - case CMD_INT: - case CMD_FLOAT: { - $clone = $this->internal_parse_value($buffer, $blen); - if (is_null($clone)) return 0; - if ($buffer[0] == CMD_INT) return intval($clone); - return floatval($clone); - } - - case CMD_RAWJSON: - return NULL; - } - - return NULL; - } - - private function internal_parse_number ($buffer, &$cstart, &$extcode = NULL, $index = 1) { - $value = 0; - $extvalue = 0; - $isext = false; - $blen = strlen($buffer); - - // from 1 to skip the first command type character - for ($i = $index; $i < $blen; $i++) { - $c = $buffer[$i]; - - // check for optional extended error code (ERRCODE:EXTERRCODE) - if ($c == ':') {$isext = true; continue;} - - // check for end of value - if ($c == ' ') { - $cstart = $i + 1; - if (!is_null($extcode)) $extcode = $extvalue; - return $value; - } - - // compute numeric value - if ($isext) $extvalue = ($extvalue * 10) + ((int)$buffer[$i]); - else $value = ($value * 10) + ((int)$buffer[$i]); - } - - return 0; - } - - // MARK: - - - function internal_parse_rowset_signature ($buffer, &$len, &$idx, &$version, &$nrows, &$ncols) { - // ROWSET: *LEN 0:VERS NROWS NCOLS DATA - // ROWSET in CHUNK: /LEN IDX:VERS NROWS NCOLS DATA - - // check for end-of-chunk condition - if ($buffer == ROWSET_CHUNKS_END) { - $version = 0; - return 0; - } - - $start = 1; - $counter = 0; - $n = strlen($buffer); - for ($i = 0; $i < $n; $i++) { - if ($buffer[$i] != ' ') continue; - ++$counter; - - $data = substr($buffer, $start, $i-$start); - $start = $i + 1; - - if ($counter == 1) { - $len = intval($data); - } - else if ($counter == 2) { - // idx:vers - $values = explode(":", $data); - $idx = intval($values[0]); - $version = intval($values[1]); - } - else if ($counter == 3) { - $nrows = intval($data); - } - else if ($counter == 4) { - $ncols = intval($data); - return $start; - } - else return -1; - } - return -1; - } - - function internal_parse_rowset_header ($rowset, $buffer, $start) { - $ncols = $rowset->ncols; - - // parse column names (header is guarantee to contain column names) - $rowset->colname = array(); - for ($i = 0; $i < $ncols; $i++) { - $len = $this->internal_parse_number($buffer, $cstart, $unused, $start); - $value = substr($buffer, $cstart, $len); - array_push($rowset->colname, $value); - $start = $cstart + $len; - } - - if ($rowset->version == 1) return $start; - - // if version != 2 returns an error because rowset version is not supported - if ($rowset->version != 2) return -1; - - // parse declared types - $rowset->decltype = array(); - for ($i = 0; $i < $ncols; $i++) { - $len = $this->internal_parse_number($buffer, $cstart, $unused, $start); - $value = substr($buffer, $cstart, $len); - array_push($rowset->decltype, $value); - $start = $cstart + $len; - } - - // parse database names - $rowset->dbname = array(); - for ($i = 0; $i < $ncols; $i++) { - $len = $this->internal_parse_number($buffer, $cstart, $unused, $start); - $value = substr($buffer, $cstart, $len); - array_push($rowset->dbname, $value); - $start = $cstart + $len; - } - - // parse table names - $rowset->tblname = array(); - for ($i = 0; $i < $ncols; $i++) { - $len = $this->internal_parse_number($buffer, $cstart, $unused, $start); - $value = substr($buffer, $cstart, $len); - array_push($rowset->tblname, $value); - $start = $cstart + $len; - } - - // parse column original names - $rowset->origname = array(); - for ($i = 0; $i < $ncols; $i++) { - $len = $this->internal_parse_number($buffer, $cstart, $unused, $start); - $value = substr($buffer, $cstart, $len); - array_push($rowset->origname, $value); - $start = $cstart + $len; - } - - // parse not null flags - $rowset->notnull = array(); - for ($i = 0; $i < $ncols; $i++) { - $value = $this->internal_parse_number($buffer, $cstart, $unused, $start); - array_push($rowset->notnull, $value); - $start = $cstart; - } - - // parse primary key flags - $rowset->prikey = array(); - for ($i = 0; $i < $ncols; $i++) { - $value = $this->internal_parse_number($buffer, $cstart, $unused, $start); - array_push($rowset->prikey, $value); - $start = $cstart; - } - - // parse autoincrement flags - $rowset->autoinc = array(); - for ($i = 0; $i < $ncols; $i++) { - $value = $this->internal_parse_number($buffer, $cstart, $unused, $start); - array_push($rowset->autoinc, $value); - $start = $cstart; - } - - return $start; - } - - function internal_parse_rowset_values ($rowset, $buffer, $start, $bound) { - // loop to parse each individual value - for ($i=0; $i < $bound; ++$i) { - $cellsize = 0; - $len = strlen($buffer) - $start; - $value = $this->internal_parse_value($buffer, $len, $cellsize, $start); - $start += $cellsize; - array_push($rowset->data, $value); - } - } - - function internal_parse_rowset($buffer, $start, $idx, $version, $nrows, $ncols) { - $rowset = NULL; - $n = $start; - $ischunk = ($buffer[0] == CMD_ROWSET_CHUNK); - - // idx == 0 means first (and only) chunk for rowset - // idx == 1 means first chunk for chunked rowset - $first_chunk = ($ischunk) ? ($idx == 1) : ($idx == 0); - if ($first_chunk) { - $rowset = new SQLiteCloudRowset(); - $rowset->nrows = $nrows; - $rowset->ncols = $ncols; - $rowset->version = $version; - $rowset->data = array(); - if ($ischunk) $this->rowset = $rowset; - $n = $this->internal_parse_rowset_header($rowset, $buffer, $start); - if ($n <= 0) return NULL; - } else { - $rowset = $this->rowset; - $rowset->nrows += $nrows; - } - - // parse values - $this->internal_parse_rowset_values($rowset, $buffer, $n, $nrows*$ncols); - - return $rowset; - } - - // MARK: - - - function __destruct() { - $this->disconnect(); - } - } - -?> \ No newline at end of file diff --git a/PHP/tests/integration/SQLiteCloudTest.php b/PHP/tests/integration/SQLiteCloudTest.php deleted file mode 100644 index d9c24ecc..00000000 --- a/PHP/tests/integration/SQLiteCloudTest.php +++ /dev/null @@ -1,718 +0,0 @@ -sqlite) { - $this->sqlite->disconnect(); - } - } - - /** - * @return SQLiteCloud - */ - private function getSQLiteConnection() - { - $this->sqlite = new SQLiteCloud(); - $this->sqlite->database = getenv('SQLITE_DB'); - $this->sqlite->apikey = getenv('SQLITE_API_KEY'); - - $result = $this->sqlite->connect(getenv('SQLITE_HOST')); - $this->assertTrue($result); - - return $this->sqlite; - } - - public function testConnectWithoutCredentialsAndApikey() - { - $sqlite = new SQLiteCloud(); - $sqlite->username = ''; - $sqlite->password = ''; - $sqlite->apikey = ''; - $sqlite->database = getenv('SQLITE_DB'); - - $result = $sqlite->connect(getenv('SQLITE_HOST'), getenv('SQLITE_PORT')); - - $this->assertFalse($result); - } - - public function testConnect(): void - { - $sqlite = new SQLiteCloud(); - $sqlite->username = getenv('SQLITE_USER'); - $sqlite->password = getenv('SQLITE_PASSWORD'); - $sqlite->database = getenv('SQLITE_DB'); - - $result = $sqlite->connect(getenv('SQLITE_HOST'), getenv('SQLITE_PORT')); - - $this->assertTrue($result, "Please, verify the connection parameters and the node is running. Message: {$sqlite->errmsg}"); - - $this->assertSame(0, $sqlite->errcode); - $this->assertEmpty($sqlite->errmsg); - - $sqlite->disconnect(); - } - - public function testConnectWithStringWithoutCredentialsAndApikey() - { - $sqlite = new SQLiteCloud(); - $sqlite->username = ''; - $sqlite->password = ''; - $sqlite->apikey = ''; - - $result = $sqlite->connectWithString('sqlitecloud://' . getenv('SQLITE_HOST') . '/' . getenv('SQLITE_DB')); - - $this->assertFalse($result); - - $sqlite->disconnect(); - } - - public function testConnectWithStringWithCredentials(): void - { - $sqlite = new SQLiteCloud(); - - $result = $sqlite->connectWithString(getenv('SQLITE_CONNECTION_STRING')); - - $this->assertTrue($result, "Please, verify the connection parameters and the node is running. Message: {$sqlite->errmsg}"); - - $this->assertSame(0, $sqlite->errcode); - $this->assertEmpty($sqlite->errmsg); - - $sqlite->disconnect(); - } - - public function testConnectWithStringWithApiKey(): void - { - $sqlite = new SQLiteCloud(); - - $result = $sqlite->connectWithString(getenv('SQLITE_CONNECTION_STRING') . '?apikey=' . getenv('SQLITE_API_KEY')); - - $this->assertTrue($result, "Please, verify the connection parameters and the node is running. Message: {$sqlite->errmsg}"); - - $this->assertSame(0, $sqlite->errcode); - $this->assertEmpty($sqlite->errmsg); - - $sqlite->disconnect(); - } - - public function testRowsetData() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute('SELECT AlbumId FROM albums LIMIT 2'); - - $this->assertSame(2, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame(2, $rowset->version); - } - - public function testGetValue() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute('SELECT * FROM albums'); - - $this->assertSame('1', $rowset->value(0, 0)); - $this->assertSame('For Those About To Rock We Salute You', $rowset->value(0, 1)); - $this->assertSame('2', $rowset->value(1, 0)); - } - - public function testSelectUTF8ValueAndColumnName() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute("SELECT 'Minha História'"); - - $this->assertSame('Minha História', $rowset->value(0, 0)); - $this->assertSame("'Minha História'", $rowset->name(0)); - } - - public function testColumnNotFound() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute("SELECT not_a_column FROM albums"); - - $this->assertFalse($rowset); - $this->assertSame(1, $sqlite->errcode); - $this->assertSame("no such column: not_a_column", $sqlite->errmsg); - } - - public function testInvalidRowNumberForValue() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute("SELECT 'one row'"); - - $this->assertNull($rowset->value(1, 1)); - } - - public function testColumnName() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute('SELECT * FROM albums'); - - $this->assertSame('AlbumId', $rowset->name(0)); - $this->assertSame('Title', $rowset->name(1)); - } - - public function testInvalidRowNumberForColumnName() - { - $sqlite = $this->getSQLiteConnection(); - - /** @var SQLiteCloudRowset */ - $rowset = $sqlite->execute('SELECT AlbumId FROM albums'); - - $this->assertNull($rowset->name(1)); - } - - /** - * @large - */ - public function testLongString() - { - $sqlite = $this->getSQLiteConnection(); - - $size = 1024 * 1024; - $value = 'LOOOONG'; - while (strlen($value) < $size) { - $value .= 'a'; - } - $rowset = $sqlite->execute("SELECT '{$value}' 'VALUE'"); - - $this->assertEmpty($sqlite->errmsg); - $this->assertNotFalse($rowset); - $this->assertSame(0, $sqlite->errcode); - - $this->assertSame(1, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame('VALUE', $rowset->name(0)); - $this->assertSame($value, $rowset->value(0, 0)); - } - - public function testInteger() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST INTEGER'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(123456, $rowset); - } - - public function testFloat() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST FLOAT'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(3.1415926, $rowset); - } - - public function testString() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST STRING'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame('Hello World, this is a test string.', $rowset); - } - - public function testZeroString() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ZERO_STRING'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame('Hello World, this is a zero-terminated test string.', $rowset); - } - - public function testEmptyString() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST STRING0'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame('', $rowset); - } - - public function testCommand() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST COMMAND'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame('PONG', $rowset); - } - - public function testJson() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST JSON'); - $this->assertEmpty($sqlite->errmsg); - $this->assertJson($rowset); - $this->assertEquals( - [ - 'msg-from' => ['class' => 'soldier', 'name' => 'Wixilav'], - 'msg-to' => ['class' => 'supreme-commander', 'name' => '[Redacted]'], - 'msg-type' => ['0xdeadbeef', 'irc log'], - 'msg-log' => [ - 'soldier: Boss there is a slight problem with the piece offering to humans', - 'supreme-commander: Explain yourself soldier!', - "soldier: Well they don't seem to move anymore...", - 'supreme-commander: Oh snap, I came here to see them twerk!' - ] - ], - json_decode($rowset, true) - ); - } - - public function testBlob() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST BLOB'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1000, strlen($rowset)); - } - - public function testBlob0() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST BLOB0'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(0, strlen($rowset)); - } - - public function testError() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ERROR'); - $this->assertSame(66666, $sqlite->errcode); - $this->assertSame('This is a test error message with a devil error code.', $sqlite->errmsg); - } - - public function testExtError() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST EXTERROR'); - $this->assertSame(66666, $sqlite->errcode); - $this->assertSame(333, $sqlite->xerrcode); - $this->assertSame('This is a test error message with an extcode and a devil error code.', $sqlite->errmsg); - } - - public function testArray() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ARRAY'); - $this->assertEmpty($sqlite->errmsg); - $this->assertTrue(is_array($rowset)); - $this->assertCount(5, $rowset); - $this->assertSame('Hello World', $rowset[0]); - $this->assertSame('123456', $rowset[1]); - $this->assertSame('3.1415', $rowset[2]); - $this->assertNull($rowset[3]); - } - - public function testRowset() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ROWSET'); - $this->assertEmpty($sqlite->errmsg); - $this->assertGreaterThanOrEqual(30, $rowset->nrows); - $this->assertSame(2, $rowset->ncols); - $this->assertTrue(in_array($rowset->version, [1, 2])); - $this->assertSame('key', $rowset->name(0)); - $this->assertSame('value', $rowset->name(1)); - } - - public function testMaxRowsOption() - { - $sqlite = new SQLiteCloud(); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->maxrows = 1; - $result = $sqlite->connect(getenv('SQLITE_HOST')); - - $this->assertTrue($result); - - $rowset = $sqlite->execute('SELECT * FROM albums'); - $this->assertNotFalse($rowset); - $this->assertGreaterThan(100, $rowset->nrows); - - $sqlite->disconnect(); - } - - public function testMaxRowsetOptionToFailWhenRowsetIsBigger() - { - $sqlite = new SQLiteCloud(); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->maxrowset = 1024; - $result = $sqlite->connect(getenv('SQLITE_HOST')); - - $this->assertTrue($result); - - $rowset = $sqlite->execute('SELECT * FROM albums'); - $this->assertFalse($rowset); - $this->assertSame('RowSet too big to be sent (limit set to 1024 bytes).', $sqlite->errmsg); - - $sqlite->disconnect(); - } - - public function testMaxRowsetOptionToSuccedWhenRowsetIsLighter() - { - $sqlite = new SQLiteCloud(); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->maxrowset = 1024; - $result = $sqlite->connect(getenv('SQLITE_HOST')); - - $this->assertTrue($result); - - $rowset = $sqlite->execute("SELECT 'hello world'"); - $this->assertNotFalse($rowset); - $this->assertSame(1, $rowset->nrows); - - $sqlite->disconnect(); - } - - public function testChunckedRowset() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ROWSET_CHUNK'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(147, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame('key', $rowset->name(0)); - } - - public function testChunckedRowsetTwice() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('TEST ROWSET_CHUNK'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(147, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame('key', $rowset->name(0)); - - $rowset = $sqlite->execute('TEST ROWSET_CHUNK'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(147, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame('key', $rowset->name(0)); - - $rowset = $sqlite->execute('SELECT 1'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1, $rowset->nrows); - } - - public function testSerializedOperations() - { - $numQueries = 20; - - $sqlite = $this->getSQLiteConnection(); - - for ($i = 0; $i < $numQueries; $i++) { - $rowset = $sqlite->execute("select {$i} as 'count', 'hello' as 'string'"); - - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1, $rowset->nrows); - $this->assertSame(2, $rowset->ncols); - $this->assertSame('count', $rowset->name(0)); - $this->assertSame('string', $rowset->name(1)); - $this->assertSame("{$i}", $rowset->value(0, 0)); - $this->assertTrue(in_array($rowset->version, [1, 2])); - } - } - - public function testQueryTimeout() - { - $sqlite = new SQLiteCloud(); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->timeout = 1; // 1 sec - - $result = $sqlite->connect(getenv('SQLITE_HOST')); - $this->assertTrue($result); - - // this operation should take more then 1s - $rowset = $sqlite->execute( - // just a long running query - "WITH RECURSIVE r(i) AS ( - VALUES(0) - UNION ALL - SELECT i FROM r - LIMIT 10000000 - ) - SELECT i FROM r WHERE i = 1;" - ); - $this->assertFalse($rowset); - - $sqlite->disconnect(); - } - - public function testXXLQuery() - { - $xxlQuery = 300000; - $longSql = ''; - - $sqlite = $this->getSQLiteConnection(); - - while (strlen($longSql) < $xxlQuery) { - for ($i = 0; $i < 5000; $i++) { - $longSql .= 'SELECT ' . strlen($longSql) . "'HowLargeIsTooMuch'; "; - } - - $rowset = $sqlite->execute($longSql); - $this->assertSame(1, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertGreaterThanOrEqual(strlen($longSql) - 50, $rowset->value(0, 0)); - } - } - - /** - * @large - */ - public function testSingleXXLQuery() - { - $xxlQuery = 200000; - $longSql = ''; - - $sqlite = $this->getSQLiteConnection(); - - while (strlen($longSql) < $xxlQuery) { - $longSql .= strlen($longSql) . "_"; - } - $selectedValue = "start_{$longSql}end"; - $longSql = "SELECT '{$selectedValue}'"; - - $rowset = $sqlite->execute($longSql); - - $this->assertSame(1, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame("'{$selectedValue}'", $rowset->name(0)); - } - - public function testMetadata() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('LIST METADATA'); - $this->assertEmpty($sqlite->errmsg); - $this->assertGreaterThanOrEqual(32, $rowset->nrows); - $this->assertSame(8, $rowset->ncols); - } - - public function testSelectResultsWithNoColumnName() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute("SELECT 42, 'hello'"); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1, $rowset->nrows); - $this->assertSame(2, $rowset->ncols); - $this->assertSame('42', $rowset->name(0)); - $this->assertSame("'hello'", $rowset->name(1)); - $this->assertSame('42', $rowset->value(0, 0)); - $this->assertSame('hello', $rowset->value(0, 1)); - } - - public function testSelectLongFormattedString() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute("USE DATABASE :memory:; SELECT '" . str_repeat('x', 1000) . "' AS DDD"); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertStringStartsWith('xxxxxxxx', $rowset->value(0, 0)); - $this->assertSame(1000, strlen($rowset->value(0, 0))); - } - - public function testSelectDatabase() - { - $sqlite = new SQLiteCloud(); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->database = ''; - - $sqlite->connect(getenv('SQLITE_HOST')); - - $rowset = $sqlite->execute('USE DATABASE chinook.sqlite'); - $this->assertEmpty($sqlite->errmsg); - $this->assertEmpty($rowset->nrows); - $this->assertEmpty($rowset->ncols); - } - - public function testSelectTracksWithoutLimit() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('SELECT * FROM tracks'); - $this->assertEmpty($sqlite->errmsg); - $this->assertGreaterThanOrEqual(3000, $rowset->nrows); - $this->assertSame(9, $rowset->ncols); - } - - public function testSelectTracksWithLimit() - { - $sqlite = $this->getSQLiteConnection(); - $rowset = $sqlite->execute('SELECT * FROM tracks LIMIT 10;'); - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(10, $rowset->nrows); - $this->assertSame(9, $rowset->ncols); - } - - /** - * @large - */ - public function testStressTest20xStringSelectIndividual() - { - $numQueries = 20; - $completed = 0; - $startTime = microtime(true); - - $sqlite = $this->getSQLiteConnection(); - - for ($i = 0; $i < $numQueries; $i++) { - $rowset = $sqlite->execute('TEST STRING'); - $this->assertNull($sqlite->errmsg); - $this->assertSame('Hello World, this is a test string.', $rowset); - - if (++$completed >= $numQueries) { - $queryMs = round((microtime(true) - $startTime) * 1000 / $numQueries); - if ($queryMs > self::WARN_SPEED_MS) { - $this->assertLessThan(self::EXPECT_SPEED_MS, $queryMs, "{$numQueries}x test string, {$queryMs}ms per query"); - } - } - } - } - - /** - * @large - */ - public function testStressTest20xIndividualSelect() - { - $numQueries = 20; - $completed = 0; - $startTime = microtime(true); - - $sqlite = $this->getSQLiteConnection(); - - for ($i = 0; $i < $numQueries; $i++) { - $rowset = $sqlite->execute('SELECT * FROM albums ORDER BY RANDOM() LIMIT 4;'); - $this->assertNull($sqlite->errmsg); - $this->assertSame(4, $rowset->nrows); - $this->assertSame(3, $rowset->ncols); - if (++$completed >= $numQueries) { - $queryMs = round((microtime(true) - $startTime) * 1000 / $numQueries); - if ($queryMs > self::WARN_SPEED_MS) { - $this->assertLessThan(self::EXPECT_SPEED_MS, $queryMs, "{$numQueries}x individual selects, {$queryMs}ms per query"); - } - } - } - } - - /** - * @long - */ - public function testStressTest20xBatchedSelects() - { - $numQueries = 20; - $completed = 0; - $startTime = microtime(true); - - $sqlite = $this->getSQLiteConnection(); - - for ($i = 0; $i < $numQueries; $i++) { - $rowset = $sqlite->execute( - 'SELECT * FROM albums ORDER BY RANDOM() LIMIT 16; SELECT * FROM albums ORDER BY RANDOM() LIMIT 12; SELECT * FROM albums ORDER BY RANDOM() LIMIT 8; SELECT * FROM albums ORDER BY RANDOM() LIMIT 4;' - ); - $this->assertNull($sqlite->errmsg); - $this->assertSame(4, $rowset->nrows); - $this->assertSame(3, $rowset->ncols); - if (++$completed >= $numQueries) { - $queryMs = round((microtime(true) - $startTime) * 1000 / $numQueries); - if ($queryMs > self::WARN_SPEED_MS) { - $this->assertLessThan(self::EXPECT_SPEED_MS, $queryMs, "{$numQueries}x batched selects, {$queryMs}ms per query"); - } - } - } - } - - public function testDownloadDatabase() - { - $sqlite = $this->getSQLiteConnection(); - - $dbInfo = $sqlite->execute('DOWNLOAD DATABASE ' . getenv('SQLITE_DB')); - $this->assertNotFalse($dbInfo); - $dbSize = $dbInfo[0]; - - $totRead = 0; - $data = ''; - while ($totRead < $dbSize) { - $data .= $sqlite->execute("DOWNLOAD STEP;"); - $totRead += strlen($data); - } - $tempFile = tempnam(sys_get_temp_dir(), 'chinook'); - file_put_contents($tempFile, $data); - - $db = new SQLite3($tempFile); - $rowset = $db->query('SELECT * from albums'); - - $this->assertNotFalse($rowset); - $this->assertSame('AlbumId', $rowset->columnName(0)); - $this->assertSame('Title', $rowset->columnName(1)); - } - - public function testCompressionSingleColumn() - { - $sqlite = new SQLiteCloud(); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->compression = true; - - $result = $sqlite->connect(getenv('SQLITE_HOST')); - $this->assertTrue($result); - - // min compression size for rowset set by default to 20400 bytes - $blobSize = 20 * 1024; - $rowset = $sqlite->execute("SELECT hex(randomblob({$blobSize})) AS 'someColumnName'"); - - $this->assertEmpty($sqlite->errmsg); - $this->assertSame(1, $rowset->nrows); - $this->assertSame(1, $rowset->ncols); - $this->assertSame("someColumnName", $rowset->name(0)); - $this->assertSame($blobSize * 2, strlen($rowset->value(0, 0))); - - $sqlite->disconnect(); - } - - public function testCompressionMultipleColumns() - { - $sqlite = new SQLiteCloud(); - $sqlite->apikey = getenv('SQLITE_API_KEY'); - $sqlite->database = getenv('SQLITE_DB'); - $sqlite->compression = true; - - $result = $sqlite->connect(getenv('SQLITE_HOST')); - $this->assertTrue($result); - - // min compression size for rowset set by default to 20400 bytes - $rowset = $sqlite->execute("SELECT * from albums inner join albums a2 on albums.AlbumId = a2.AlbumId"); - - $this->assertEmpty($sqlite->errmsg); - $this->assertGreaterThan(0, $rowset->nrows); - $this->assertGreaterThan(0, $rowset->ncols); - $this->assertSame("AlbumId", $rowset->name(0)); - - $sqlite->disconnect(); - } -} diff --git a/PHP/tests/unit/SQLiteCloudTest.php b/PHP/tests/unit/SQLiteCloudTest.php deleted file mode 100644 index 20a6f502..00000000 --- a/PHP/tests/unit/SQLiteCloudTest.php +++ /dev/null @@ -1,152 +0,0 @@ -getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->with('disney.sqlite.cloud', 9972) - ->willReturn(true); - - $connectionString = 'sqlitecloud://disney.sqlite.cloud:9972'; - - $sqlite->connectWithString($connectionString); - } - - public function testConnectWithStringWithBothApiKeyAndCredentials() - { - /** @var MockObject|SQLiteCloud */ - $sqlite = $this->getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->willReturn(true); - - $connectionString = 'sqlitecloud://pippo:pluto@disney.sqlite.cloud:8860?apikey=abc12345'; - - $sqlite->connectWithString($connectionString); - - $this->assertEmpty($sqlite->username); - $this->assertEmpty($sqlite->password); - $this->assertSame('abc12345', $sqlite->apikey); - } - - public function testConnectWithStringWithOptions() - { - /** @var MockObject|SQLiteCloud */ - $sqlite = $this->getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->with('disney.sqlite.cloud') - ->willReturn(true); - - $connectionString = 'sqlitecloud://disney.sqlite.cloud/mydb?apikey=abc12345&insecure=true&timeout=100'; - - $sqlite->connectWithString($connectionString); - - $this->assertSame('mydb', $sqlite->database); - $this->assertSame('abc12345', $sqlite->apikey); - $this->assertSame(true, $sqlite->insecure); - $this->assertSame(100, $sqlite->timeout); - } - - public function testConnectWithStringWithoutOptionals() - { - /** @var MockObject|SQLiteCloud */ - $sqlite = $this->getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->with('disney.sqlite.cloud') - ->willReturn(true); - - $connectionString = 'sqlitecloud://disney.sqlite.cloud'; - - $sqlite->connectWithString($connectionString); - - $this->assertEmpty($sqlite->username); - $this->assertEmpty($sqlite->password); - $this->assertEmpty($sqlite->database); - } - - public function parameterssDataProvider() - { - return [ - 'timeout' => ['timeout', 11], - 'compression /true' => ['compression', true], - 'compression /false' => ['compression', false], - 'zerotext' => ['zerotext', true], - 'memory' => ['memory', true], - 'create' => ['create', true], - 'non_linearizable' => ['non_linearizable', true], - 'insecure' => ['insecure', true], - 'no_verify_certificate' => ['no_verify_certificate', true], - 'noblob' => ['noblob', true], - 'maxdata' => ['maxdata', 12], - 'maxrows' => ['maxdata', 14], - 'maxrowset' => ['maxdata', 16], - ]; - } - - /** - * @dataProvider parameterssDataProvider - */ - public function testParameterToBeSet(string $param, $value) - { - /** @var MockObject|SQLiteCloud */ - $sqlite = $this->getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->willReturn(true); - - $connectionString = "sqlitecloud://myhost.sqlite.cloud?{$param}={$value}"; - - $sqlite->connectWithString($connectionString); - - $this->assertSame($value, $sqlite->{$param}); - } - - public function testTlsParameters() - { - /** @var MockObject|SQLiteCloud */ - $sqlite = $this->getMockBuilder(SQLiteCloud::class) - ->setMethods(['connect']) - ->getMock(); - - $sqlite->expects($this->once()) - ->method('connect') - ->willReturn(true); - - $connectionString = "sqlitecloud://myhost.sqlite.cloud?root_certificate=a%25cd&certificate=b%25de&certificate_key=c%25ef"; - - $sqlite->connectWithString($connectionString); - - $this->assertSame('a%cd', $sqlite->tls_root_certificate); - $this->assertSame('b%de', $sqlite->tls_certificate); - $this->assertSame('c%ef', $sqlite->tls_certificate_key); - } -} diff --git a/sqlitecloud-php b/sqlitecloud-php new file mode 160000 index 00000000..416628e9 --- /dev/null +++ b/sqlitecloud-php @@ -0,0 +1 @@ +Subproject commit 416628e92b0c4b992e3c12baed3fc77f57c93d40 diff --git a/sqlitecloud-py b/sqlitecloud-py new file mode 160000 index 00000000..fee7e2a7 --- /dev/null +++ b/sqlitecloud-py @@ -0,0 +1 @@ +Subproject commit fee7e2a70a9fa706e28458c4c60d98737a6a2361