Initial commit

This commit is contained in:
2020-10-07 10:37:15 +02:00
commit ce5f440392
28157 changed files with 4429172 additions and 0 deletions

21
vendor/jdorn/sql-formatter/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013 Jeremy Dorn <jeremy@jeremydorn.com>
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.

422
vendor/jdorn/sql-formatter/composer.lock generated vendored Normal file
View File

@@ -0,0 +1,422 @@
{
"hash": "a709b40d4a35e7077aa40fbd0f78f6c6",
"packages": [
],
"packages-dev": [
{
"name": "phpunit/php-code-coverage",
"version": "1.2.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1.2.9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.9",
"reference": "1.2.9",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
"phpunit/php-text-template": ">=1.1.1@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.0.5"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.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"
],
"time": "2013-02-26 18:55:56"
},
{
"name": "phpunit/php-file-iterator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "2deb24c65ea78e126daa8d45b2089ddc29ec1d26"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2deb24c65ea78e126daa8d45b2089ddc29ec1d26",
"reference": "2deb24c65ea78e126daa8d45b2089ddc29ec1d26",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"File/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"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"
],
"time": "2013-01-07 10:47:05"
},
{
"name": "phpunit/php-text-template",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "1eeef106193d2f8c539728e566bb4793071a9e18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/1eeef106193d2f8c539728e566bb4793071a9e18",
"reference": "1eeef106193d2f8c539728e566bb4793071a9e18",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"Text/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2013-01-07 10:56:17"
},
{
"name": "phpunit/php-timer",
"version": "1.0.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "ecf7920b27003a9412b07dad79dbb5ad1249e6c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/ecf7920b27003a9412b07dad79dbb5ad1249e6c3",
"reference": "ecf7920b27003a9412b07dad79dbb5ad1249e6c3",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"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"
],
"time": "2013-01-30 06:08:51"
},
{
"name": "phpunit/php-token-stream",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "c25dd88e1592e66dee2553c99ef244203d5a1b98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c25dd88e1592e66dee2553c99ef244203d5a1b98",
"reference": "c25dd88e1592e66dee2553c99ef244203d5a1b98",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"PHP/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2013-01-07 10:56:35"
},
{
"name": "phpunit/phpunit",
"version": "3.7.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2c67e52445416bb7c14046b432acd7eb79e4e612"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2c67e52445416bb7c14046b432acd7eb79e4e612",
"reference": "2c67e52445416bb7c14046b432acd7eb79e4e612",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": ">=1.2.1,<1.3.0",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
"phpunit/php-timer": ">=1.0.2,<1.1.0",
"phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0",
"symfony/yaml": ">=2.2.0"
},
"require-dev": {
"pear-pear/pear": "1.9.4"
},
"suggest": {
"ext-json": "*",
"ext-simplexml": "*",
"ext-tokenizer": "*",
"phpunit/php-invoker": ">=1.1.0,<1.2.0"
},
"bin": [
"composer/bin/phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.7.x-dev"
}
},
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2013-03-11 07:06:05"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "d49b5683200b5db9b1c64cb06f52f50d147891c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d49b5683200b5db9b1c64cb06f52f50d147891c4",
"reference": "d49b5683200b5db9b1c64cb06f52f50d147891c4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-text-template": ">=1.1.1@stable"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"autoload": {
"classmap": [
"PHPUnit/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2013-02-05 07:46:41"
},
{
"name": "symfony/yaml",
"version": "dev-master",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "f198ac28048eeceae852419c076123aaee59cd1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/f198ac28048eeceae852419c076123aaee59cd1c",
"reference": "f198ac28048eeceae852419c076123aaee59cd1c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2013-01-31 21:39:01"
}
],
"aliases": [
],
"minimum-stability": "dev",
"stability-flags": [
],
"platform": {
"php": ">=5.2.4"
},
"platform-dev": [
]
}

View File

@@ -0,0 +1,17 @@
<?php
if(php_sapi_name() !== "cli") {
echo "<p>Run this php script from the command line to see CLI syntax highlighting and formatting. It support Unix pipes or command line argument style.</p>";
echo "<pre><code>php examples/cli.php \"SELECT * FROM MyTable WHERE (id>5 AND \\`name\\` LIKE \\&quot;testing\\&quot;);\"</code></pre>";
echo "<pre><code>echo \"SELECT * FROM MyTable WHERE (id>5 AND \\`name\\` LIKE \\&quot;testing\\&quot;);\" | php examples/cli.php</code></pre>";
}
if(isset($argv[1])) {
$sql = $argv[1];
}
else {
$sql = stream_get_contents(fopen("php://stdin", "r"));
}
require_once(__DIR__.'/../lib/SqlFormatter.php');
echo SqlFormatter::format($sql);

View File

@@ -0,0 +1,270 @@
<!DOCTYPE html>
<html>
<head>
<title>SqlFormatter Examples</title>
<style>
body {
font-family: arial;
}
table, td, th {
border: 1px solid #aaa;
}
table {
border-width: 1px 1px 0 0;
border-spacing: 0;
}
td, th {
border-width: 0 0 1px 1px;
padding: 5px 10px;
vertical-align: top;
}
pre {
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<?php
require_once(__DIR__.'/../lib/SqlFormatter.php');
// Example statements for formatting and highlighting
$statements = array(
"SELECT DATE_FORMAT(b.t_create, '%Y-%c-%d') dateID, b.title memo
FROM (SELECT id FROM orc_scheme_detail d WHERE d.business=208
AND d.type IN (29,30,31,321,33,34,3542,361,327,38,39,40,41,42,431,4422,415,4546,47,48,'a',
29,30,31,321,33,34,3542,361,327,38,39,40,41,42,431,4422,415,4546,47,48,'a')
AND d.title IS NOT NULL AND t_create >=
DATE_FORMAT((DATE_SUB(NOW(),INTERVAL 1 DAY)),'%Y-%c-%d') AND t_create
< DATE_FORMAT(NOW(), '%Y-%c-%d') ORDER BY d.id LIMIT 2,10) a,
orc_scheme_detail b WHERE a.id = b.id",
"SELECT * from Table1 LEFT
OUTER JOIN Table2 on Table1.id = Table2.id",
"SELECT * FROM MyTable WHERE id = 46",
"SELECT count(*),`Column1` as count,`Testing`, `Testing Three` FROM `Table1`
WHERE Column1 = 'testing' AND ( (`Column2` = `Column3` OR Column4 >= NOW()) )
GROUP BY Column1 ORDER BY Column3 DESC LIMIT 5,10",
"select * from `Table`, (SELECT group_concat(column1) as col FROM Table2 GROUP BY category)
Table2, Table3 where Table2.col = (Table3.col2 - `Table`.id)",
"insert ignore into Table3 (column1, column2) VALUES ('test1','test2'), ('test3','test4');",
"UPDATE MyTable SET name='sql', category='databases' WHERE id > '65'",
"delete from MyTable WHERE name LIKE \"test%\"",
"SELECT * FROM UnmatchedParens WHERE ( A = B)) AND (((Test=1)",
"-- This is a comment
SELECT
/* This is another comment
On more than one line */
Id #This is one final comment
as temp, DateCreated as Created FROM MyTable;",
);
// Example statements for splitting SQL strings into individual queries
$split_statements = array(
"DROP TABLE IF EXISTS MyTable;
CREATE TABLE MyTable ( id int );
INSERT INTO MyTable (id)
VALUES
(1),(2),(3),(4);
SELECT * FROM MyTable;",
"SELECT \";\"; SELECT \";\\\"; a;\";
SELECT \";
abc\";
SELECT a,b #comment;
FROM test;",
"
-- Drop the table first if it exists
DROP TABLE IF EXISTS MyTable;
-- Create the table
CREATE TABLE MyTable ( id int );
-- Insert values
INSERT INTO MyTable (id)
VALUES
(1),(2),(3),(4);
-- Done",
);
// Example statements for removing comments
$comment_statements = array(
"-- This is a comment
SELECT
/* This is another comment
On more than one line */
Id #This is one final comment
as temp, DateCreated as Created FROM MyTable;",
);
?>
<h1>Formatting And Syntax Highlighting</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$formatted = SqlFormatter::format($sql);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Formatted And Highlighted</th>
</tr>
<?php foreach ($statements as $sql) { ?>
<tr>
<td>
<pre><?php echo $sql; ?></pre>
</td>
<td><?php echo SqlFormatter::format($sql); ?></td>
</tr>
<?php } ?>
</table>
<h1>Formatting Only</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$formatted = SqlFormatter::format($sql, false);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Formatted</th>
</tr>
<?php foreach ($statements as $sql) { ?>
<tr>
<td>
<pre><?php echo $sql; ?></pre>
</td>
<td><pre><?php echo htmlentities(SqlFormatter::format($sql,false)); ?></pre></td>
</tr>
<?php } ?>
</table>
<h1>Syntax Highlighting Only</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$highlighted = SqlFormatter::highlight($sql);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Highlighted</th>
</tr>
<?php foreach ($statements as $sql) { ?>
<tr>
<td>
<pre><?php echo $sql; ?></pre>
</td>
<td><?php echo SqlFormatter::highlight($sql); ?></td>
</tr>
<?php } ?>
</table>
<h1>Compress Query</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$compressed = SqlFormatter::compress($sql);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Compressed</th>
</tr>
<?php foreach ($statements as $sql) { ?>
<tr>
<td>
<pre><?php echo $sql; ?></pre>
</td>
<td><pre><?php echo SqlFormatter::compress($sql); ?></pre></td>
</tr>
<?php } ?>
</table>
<h1>Splitting SQL Strings Into Individual Queries</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$queries = SqlFormatter::splitQuery($sql);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Split</th>
</tr>
<?php foreach ($split_statements as $sql) { ?>
<tr>
<td>
<pre><?php echo SqlFormatter::highlight($sql); ?></pre>
</td>
<td><?php
$queries = SqlFormatter::splitQuery($sql);
echo "<ol>";
foreach ($queries as $query) {
echo "<li><pre>" . SqlFormatter::highlight($query) . "</pre></li>";
}
echo "</ol>";
?></td>
</tr>
<?php } ?>
</table>
<h1>Removing Comments</h1>
<div>
Usage:
<pre>
<?php highlight_string('<?php' . "\n" . '$nocomments = SqlFormatter::removeComments($sql);' . "\n" . '?>'); ?>
</pre>
</div>
<table>
<tr>
<th>Original</th>
<th>Comments Removed</th>
</tr>
<?php foreach ($comment_statements as $sql) { ?>
<tr>
<td>
<pre><?php echo SqlFormatter::highlight($sql); ?></pre>
</td>
<td>
<pre><?php echo SqlFormatter::highlight(SqlFormatter::removeComments($sql)) ?></pre>
</td>
</tr>
<?php } ?>
</table>
</body>
</html>

File diff suppressed because it is too large Load Diff