Skip to content

Commit 7db91f8

Browse files
authored
Merge pull request #2 from phpmyadmin/master
Pull the official codes into mine
2 parents e4c0b58 + 5fe8a8d commit 7db91f8

File tree

237 files changed

+5182
-3496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+5182
-3496
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ coverage.xml
88
.php_cs.cache
99
*sw[op]
1010
phpunit.xml
11+
phpcs.xml
12+
/.phpunit.result.cache
13+
phpstan.neon

.php_cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

.travis.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,51 @@
11
language: php
2-
3-
dist: trusty
2+
sudo: false
3+
dist: xenial
44

55
php:
66
- 7.1
77
- 7.2
88
- 7.3
9-
- nightly
9+
- 7.4
1010

1111
matrix:
1212
fast_finish: true
1313
allow_failures:
1414
- php: nightly
1515
include:
16-
- php: 7.2
17-
env: DOCS=yes
1816
- php: 7.1
19-
env: REQUIRE="phpmyadmin/motranslator:^3.0"
20-
21-
sudo: false
17+
name: "Coding standard check"
18+
script: vendor/bin/phpcs
19+
- php: 7.1
20+
name: "PHPStan"
21+
script: vendor/bin/phpstan analyze
22+
- php: 7.1
23+
name: "phpmyadmin/motranslator"
24+
install:
25+
- composer require "phpmyadmin/motranslator:^3.0"
26+
- composer install --no-interaction
27+
after_success:
28+
- bash <(curl -s https://codecov.io/bash) -F motranslator
29+
- php: 7.2
30+
name: "API docs"
31+
install:
32+
- composer global require "sami/sami:^4.0"
33+
- composer install --no-interaction
34+
script:
35+
- $HOME/.composer/vendor/bin/sami.php --no-interaction update ./tools/sami-config.php
36+
- php: nightly
37+
install:
38+
- composer install --no-interaction --ignore-platform-reqs
39+
- php: 7.4
40+
name: "Backward compatibility check"
41+
install:
42+
- composer require --dev roave/backward-compatibility-check
43+
- composer install --no-interaction
44+
script:
45+
- vendor/bin/roave-backward-compatibility-check
2246

2347
install:
24-
- if [ -n "$REQUIRE" ] ; then composer require "$REQUIRE" ; fi
25-
- composer install
48+
- composer install --no-interaction
2649

2750
after_success:
2851
- bash <(curl -s https://codecov.io/bash)
@@ -32,5 +55,4 @@ cache:
3255
- $HOME/.composer/cache
3356

3457
script:
35-
- if [ "$DOCS" != "yes" ] ; then ./vendor/bin/phpunit --configuration phpunit.xml.dist ; fi
36-
- if [ "$DOCS" = "yes" ] ; then ./vendor/bin/sami.php --no-interaction update ./tools/sami-config.php ; fi
58+
- vendor/bin/phpunit --configuration phpunit.xml.dist

CHANGELOG.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,67 @@
11
# Change Log
22

3-
## [Unreleased]
3+
## [Unreleased] -
4+
5+
* Stop instanciating an object to check its class name. (#290)
6+
* Replace sscanf by equivalent native PHP functions because sscanf can be disabled for security reasons. (#270)
7+
8+
## [5.2.0] - 2020-01-07
9+
10+
* Fix ALTER TABLE ... PRIMARY/UNIQUE KEY results in error (#267)
11+
* Prevent overwrite of offset in Limit clause by parenthesis (#275)
12+
* Allow SCHEMA to be used in CREATE Database statement (#231)
13+
* Add missing options in SET statement (#255)
14+
* Add support for DROP USER statement (#259)
15+
* Fix php error "undefined index" when replacing a non existing clause (#249)
16+
17+
## [5.1.0] - 2019-11-12
18+
19+
* Fix for PHP deprecations messages about implode for php 7.4+ (#258)
20+
* Parse CHECK keyword on table definition (#264)
21+
* Parse truncate statement (#221)
22+
* Fix wrong parsing of partitions (#265)
23+
24+
## [5.0.0] - 2019-05-09
425

526
* Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
27+
* Enable strict mode on PHP files
28+
* Fix redundant whitespaces in build() outputs (#228)
29+
* Fix incorrect error on DEFAULT keyword in ALTER operation (#229)
30+
* Fix incorrect outputs from Query::getClause (#233)
31+
* Add support for reading an SQL file from stdin
32+
* Fix for missing tokenize-query in Composer's vendor/bin/ directory
33+
* Fix for PHP warnings with an incomplete CASE expression (#241)
34+
* Fix for error message with multiple CALL statements (#223)
35+
* Recognize the question mark character as a parameter (#242)
36+
37+
## [4.5.0] - 2020-01-07
38+
39+
* Fix ALTER TABLE ... PRIMARY/UNIQUE KEY results in error (#267)
40+
* Prevent overwrite of offset in Limit clause by parenthesis (#275)
41+
* Allow SCHEMA to be used in CREATE Database statement (#231)
42+
* Add missing options in SET statement (#255)
43+
* Add support for DROP USER statement (#259)
44+
* Fix php error "undefined index" when replacing a non existing clause (#249)
45+
46+
## [4.4.0] - 2019-11-12
47+
48+
* Fix for PHP deprecations messages about implode for php 7.4+ (#258)
49+
* Parse CHECK keyword on table definition (#264)
50+
* Parse truncate statement (#221)
51+
* Fix wrong parsing of partitions (#265)
52+
53+
## [4.3.2] - 2019-06-03
54+
55+
Backport fixes from 5.0.0 to QA branch:
56+
57+
* Fix redundant whitespaces in build() outputs (#228)
58+
* Fix incorrect error on DEFAULT keyword in ALTER operation (#229)
59+
* Fix incorrect outputs from Query::getClause (#233)
60+
* Add support for reading an SQL file from stdin
61+
* Fix for missing tokenize-query in Composer's vendor/bin/ directory
62+
* Fix for PHP warnings with an incomplete CASE expression (#241)
63+
* Fix for error message with multiple CALL statements (#223)
64+
* Recognize the question mark character as a parameter (#242)
665

766
## [4.3.1] - 2019-01-05
867

@@ -85,7 +144,7 @@
85144

86145
## [4.1.3] - 2017-04-06
87146

88-
* Added suppport for DELETE ... JOIN clauses.
147+
* Added support for DELETE ... JOIN clauses.
89148
* Changed BufferedQuery to include comments in output.
90149
* Fixed parsing of inline comments.
91150

@@ -239,7 +298,7 @@
239298
* Misc: Added PHPUnit's Code Coverage 3.0 as a dependency.
240299
* Misc: Added support for PHP 5.4 back.
241300
* Misc: Removed dependency to Ctype.
242-
* Misc: Repository transfered from @udan11 to @phpMyAdmin.
301+
* Misc: Repository transferred from @udan11 to @phpMyAdmin.
243302
* Misc: Updated `.gitignore` to ignore `composer.lock`.
244303
* Misc: Updated Composer and Travis configuration for PHP 7 and PHPUnit 5.
245304
* Tools: Documented tags in `ContextGenerator`.

CONTRIBUTING.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ them and to run automated tests on the code.
2424

2525
## Coding standards
2626

27-
We do follow PSR-1 and PSR-2 coding standards.
27+
We do follow PSR-1 and PSR-2 coding standards.
2828

29-
You can use php-cs-fixer to fix the code to match our expectations:
29+
You can use phpcbf to fix the code to match our expectations:
3030

3131
```
32-
php-cs-fixer fix .
32+
./vendor/bin/phpcbf
3333
```
3434

3535
## Testsuite
@@ -38,7 +38,7 @@ Our code comes with quite comprehensive testsuite, it is automatically executed
3838
on every commit and pull request, you can also run it locally:
3939

4040
```
41-
./vendor/bin/phpunit -c phpunit.xml
41+
./vendor/bin/phpunit
4242
```
4343

4444
The testsuite relies on fixtures of parser states, in case you need to
@@ -48,7 +48,6 @@ regenerate some of these there are helper scripts in tools directory:
4848
# Remove file you want to regenerate
4949
rm tests/data/parser/parse.out
5050
51-
# Run the generator in the tools directory
52-
cd tools
53-
./run_generators.sh
51+
# Run the generator located in the tools directory
52+
./tools/run_generators.sh
5453
```

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ Command line utility to tokenize SQL query:
4747
./vendor/bin/tokenize-query --query "SELECT 1"
4848
```
4949

50+
All commands are able to parse input from stdin (standard in), such as:
51+
52+
```sh
53+
echo "SELECT 1" | ./vendor/bin/highlight-query
54+
cat example.sql | ./vendor/bin/lint-query
55+
```
5056
### Formatting SQL query
5157

5258
```php
53-
echo PhpMyAdmin\SqlParser\Utils\Formatter::format($query, array('type' => 'html'));
59+
echo PhpMyAdmin\SqlParser\Utils\Formatter::format($query, ['type' => 'html']);
5460
```
5561

5662
### Discoverying query type

bin/highlight-query

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env php
22
<?php
3+
declare(strict_types=1);
34

4-
$files = array(
5+
$files = [
56
__DIR__ . "/../vendor/autoload.php",
67
__DIR__ . "/../../vendor/autoload.php",
78
__DIR__ . "/../../../autoload.php",
89
"vendor/autoload.php"
9-
);
10+
];
1011

1112
$found = false;
1213
foreach ($files as $file) {

bin/lint-query

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env php
22
<?php
3+
declare(strict_types=1);
34

4-
$files = array(
5+
$files = [
56
__DIR__ . "/../vendor/autoload.php",
67
__DIR__ . "/../../vendor/autoload.php",
78
__DIR__ . "/../../../autoload.php",
89
"vendor/autoload.php"
9-
);
10+
];
1011

1112
$found = false;
1213
foreach ($files as $file) {
@@ -27,4 +28,3 @@ if (!$found) {
2728

2829
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
2930
exit($cli->runLint());
30-

bin/tokenize-query

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env php
22
<?php
3+
declare(strict_types=1);
34

4-
$files = array(
5+
$files = [
56
__DIR__ . "/../vendor/autoload.php",
67
__DIR__ . "/../../vendor/autoload.php",
78
__DIR__ . "/../../../autoload.php",
89
"vendor/autoload.php"
9-
);
10+
];
1011

1112
$found = false;
1213
foreach ($files as $file) {

composer.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
"symfony/polyfill-mbstring": "^1.3"
2121
},
2222
"require-dev": {
23-
"sami/sami": "^4.0",
23+
"phpmyadmin/coding-standard": "^1.0",
24+
"phpmyadmin/motranslator": "^4.0",
25+
"phpstan/extension-installer": "^1.0",
26+
"phpstan/phpstan": "^0.12.3",
27+
"phpstan/phpstan-phpunit": "^0.12.1",
2428
"phpunit/php-code-coverage": "*",
25-
"phpunit/phpunit": "^7.4"
29+
"phpunit/phpunit": "^7.4 || ^8"
2630
},
2731
"conflict": {
2832
"phpmyadmin/motranslator": "<3.0"
@@ -33,7 +37,8 @@
3337
},
3438
"bin": [
3539
"bin/highlight-query",
36-
"bin/lint-query"
40+
"bin/lint-query",
41+
"bin/tokenize-query"
3742
],
3843
"autoload": {
3944
"psr-4": {
@@ -44,5 +49,8 @@
4449
"psr-4": {
4550
"PhpMyAdmin\\SqlParser\\Tests\\": "tests"
4651
}
52+
},
53+
"config":{
54+
"sort-packages": true
4755
}
4856
}

locale/cs/LC_MESSAGES/sqlparser.mo

56 Bytes
Binary file not shown.

locale/cs/LC_MESSAGES/sqlparser.po

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ msgstr ""
66
"Project-Id-Version: SQL parser 0\n"
77
"Report-Msgid-Bugs-To: [email protected]\n"
88
"POT-Creation-Date: 2017-08-21 12:54+0200\n"
9-
"PO-Revision-Date: 2018-02-04 10:25+0000\n"
10-
"Last-Translator: Michal Čihař <[email protected]>\n"
11-
"Language-Team: Czech <https://hosted.weblate.org/projects/phpmyadmin/sql-"
12-
"parser/cs/>\n"
9+
"PO-Revision-Date: 2019-04-28 12:48+0000\n"
10+
"Last-Translator: William Desportes <[email protected]>\n"
11+
"Language-Team: Czech <https://hosted.weblate.org/projects/phpmyadmin/"
12+
"sql-parser/cs/>\n"
1313
"Language: cs\n"
1414
"MIME-Version: 1.0\n"
1515
"Content-Type: text/plain; charset=UTF-8\n"
1616
"Content-Transfer-Encoding: 8bit\n"
1717
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
18-
"X-Generator: Weblate 2.19-dev\n"
18+
"X-Generator: Weblate 3.6.1\n"
1919

2020
#: src/Component.php:43 src/Component.php:63
2121
msgid "Not implemented yet."
@@ -150,8 +150,6 @@ msgid "Missing expression."
150150
msgstr "jako regulární výraz"
151151

152152
#: src/Lexer.php:237
153-
#, fuzzy
154-
#| msgid "Unexpected characters on line %s."
155153
msgid "Unexpected character."
156154
msgstr "Neočekávaný znak."
157155

locale/fa/LC_MESSAGES/sqlparser.mo

192 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)