init web ems all
This commit is contained in:
407
phpMyAdmin/vendor/phpmyadmin/sql-parser/CHANGELOG.md
vendored
Executable file
407
phpMyAdmin/vendor/phpmyadmin/sql-parser/CHANGELOG.md
vendored
Executable file
@@ -0,0 +1,407 @@
|
||||
# Change Log
|
||||
|
||||
## [4.7.3] - 2021-12-08
|
||||
|
||||
- Fixed BufferedQuery when it has an odd number of backslashes in the end (#340)
|
||||
- Fixed the issue that ignored the body tokens when creating views with union (#343)
|
||||
- Fixed parser errors on "ALTER TABLE" statements to add columns with SET type (#168)
|
||||
- Fixed parser errors for "ALTER USER" with options (#342)
|
||||
- Fixed handling of the procedures and functions's options where part of the body (#339)
|
||||
- Fix PHP notice "Undefined index: name in src/Components/Key.php#206" for table keys using functions (#347)
|
||||
- Fix MySQL 8.0 table structure KEY expression not recognized (#347)
|
||||
- Fix KEY order (ASC/DESC) not part of the KEY definition (#296)
|
||||
- Fix missing KEY options for MySQL and MariaDB (#348)
|
||||
- Fix validation error when using ENFORCED option (#341)
|
||||
|
||||
## [4.7.2] - 2021-02-05
|
||||
|
||||
- Added check for quoted symbol to avoid parser error in case of keyword (#317)
|
||||
- Adjust PHP version constraint to not support PHP 8.0 on the 4.7 series (5.x series supports it)
|
||||
|
||||
## [4.7.1] - 2020-10-15
|
||||
|
||||
* Fix array_key_exists warning when parsing a "DEFAULT FALSE" token (#299)
|
||||
|
||||
## [4.7.0] - 2020-10-08
|
||||
|
||||
* EXISTS is also a function. (#297)
|
||||
* Remove some useless dev-dependencies
|
||||
* Fix lexer to not allow numbers with letters (#300)
|
||||
* Add support for INVISIBLE keyword (#292)
|
||||
* Fix the "$" might be a character used in a name (#301)
|
||||
* Fix use stream_select instead of non-blocking STDIN (#309)
|
||||
* Add select validation to a create view statement (#310)
|
||||
|
||||
## [4.6.1] - 2020-03-20
|
||||
|
||||
* Revert some changes with the understanding of ANSI_QUOTES mode and identifiers
|
||||
* Suggest motranslator 4.0 in README
|
||||
|
||||
## [4.6.0] - 2020-03-20
|
||||
|
||||
* Stop instanciating an object to check its class name. (#290)
|
||||
* Replace sscanf by equivalent native PHP functions because sscanf can be disabled for security reasons. (#270)
|
||||
* Allow phpunit 7
|
||||
* Fix for php error when "INSERT INTO x SET a = 1" is "INSERT INTO x SET = 1" (#295)
|
||||
* Fixed lexer fails to detect "*" as a wildcard (#288)
|
||||
* Fixed ANSI_QUOTES support (#284)
|
||||
* Fixed parser mistakes with comments (#156)
|
||||
|
||||
## [4.5.0] - 2020-01-07
|
||||
|
||||
* Fix ALTER TABLE ... PRIMARY/UNIQUE KEY results in error (#267)
|
||||
* Prevent overwrite of offset in Limit clause by parenthesis (#275)
|
||||
* Allow SCHEMA to be used in CREATE Database statement (#231)
|
||||
* Add missing options in SET statement (#255)
|
||||
* Add support for DROP USER statement (#259)
|
||||
* Fix php error "undefined index" when replacing a non existing clause (#249)
|
||||
|
||||
## [4.4.0] - 2019-11-12
|
||||
|
||||
* Fix for PHP deprecations messages about implode for php 7.4+ (#258)
|
||||
* Parse CHECK keyword on table definition (#264)
|
||||
* Parse truncate statement (#221)
|
||||
* Fix wrong parsing of partitions (#265)
|
||||
|
||||
## [4.3.2] - 2019-06-03
|
||||
|
||||
* Fix redundant whitespaces in build() outputs (#228)
|
||||
* Fix incorrect error on DEFAULT keyword in ALTER operation (#229)
|
||||
* Fix incorrect outputs from Query::getClause (#233)
|
||||
* Add support for reading an SQL file from stdin
|
||||
* Fix for missing tokenize-query in Composer's vendor/bin/ directory
|
||||
* Fix for PHP warnings with an incomplete CASE expression (#241)
|
||||
* Fix for error message with multiple CALL statements (#223)
|
||||
* Recognize the question mark character as a parameter (#242)
|
||||
|
||||
## [4.3.1] - 2019-01-05
|
||||
|
||||
* Fixed incorrect error thrown on DEFAULT keyword in ALTER statement (#218)
|
||||
|
||||
## [4.3.0] - 2018-12-25
|
||||
|
||||
* Add support for aliases on CASE expressions (#162 and #192)
|
||||
* Add support for INDEX hints in SELECT statement (#199)
|
||||
* Add support for LOCK and UNLOCK TABLES statement (#180)
|
||||
* Add detection of extraneous comma in UPDATE statement (#160)
|
||||
* Add detection of a missing comma between two ALTER operations (#189)
|
||||
* Add missing support for STRAIGHT_JOIN (#196)
|
||||
* Add support for end options in SET statement (#190)
|
||||
* Fix building of RENAME statements (#201)
|
||||
* Add support for PURGE statements (#207)
|
||||
* Add support for COLLATE keyword (#190)
|
||||
|
||||
## [4.2.5] - 2018-10-31
|
||||
|
||||
* Fix issue with CREATE OR REPLACE VIEW.
|
||||
|
||||
## [4.2.4] - 2017-12-06
|
||||
|
||||
* Fix parsing of CREATE TABLE with per field COLLATE.
|
||||
* Improved Context::loadClosest to better deal with corner cases.
|
||||
* Localization updates.
|
||||
|
||||
## [4.2.3] - 2017-10-10
|
||||
|
||||
* Make mbstring extension optional (though Symfony polyfill).
|
||||
* Fixed build CREATE TABLE query with PARTITIONS having ENGINE but not VALUES.
|
||||
|
||||
## [4.2.2] - 2017-09-28
|
||||
|
||||
* Added support for binding parameters.
|
||||
|
||||
## [4.2.1] - 2017-09-08
|
||||
|
||||
* Fixed minor bug in Query::getFlags.
|
||||
* Localization updates.
|
||||
|
||||
## [4.2.0] - 2017-08-30
|
||||
|
||||
* Initial support for MariaDB SQL contexts.
|
||||
* Add support for MariaDB 10.3 INTERSECT and EXCEPT.
|
||||
|
||||
## [4.1.10] - 2017-08-21
|
||||
|
||||
* Use custom LoaderException for context loading errors.
|
||||
|
||||
## [4.1.9] - 2017-07-12
|
||||
|
||||
* Various code cleanups.
|
||||
* Improved error handling of several invalid statements.
|
||||
|
||||
## [4.1.8] - 2017-07-09
|
||||
|
||||
* Fixed parsing SQL comment at the end of query.
|
||||
* Improved handing of non utf-8 strings.
|
||||
* Added query flag for SET queries.
|
||||
|
||||
## [4.1.7] - 2017-06-06
|
||||
|
||||
* Fixed setting combination SQL Modes.
|
||||
|
||||
## [4.1.6] - 2017-06-01
|
||||
|
||||
* Fixed building query with GROUP BY clause.
|
||||
|
||||
## [4.1.5] - 2017-05-15
|
||||
|
||||
* Fixed invalid lexing of queries with : in strings.
|
||||
* Properly handle maximal length of delimiter.
|
||||
|
||||
## [4.1.4] - 2017-05-05
|
||||
|
||||
* Fixed wrong extract of string tokens with escaped characters.
|
||||
* Properly handle lowercase begin statement.
|
||||
|
||||
## [4.1.3] - 2017-04-06
|
||||
|
||||
* Added support for DELETE ... JOIN clauses.
|
||||
* Changed BufferedQuery to include comments in output.
|
||||
* Fixed parsing of inline comments.
|
||||
|
||||
## [4.1.2] - 2017-02-20
|
||||
|
||||
* Coding style improvements.
|
||||
* Chinese localization.
|
||||
* Improved order validatin for JOIN clauses.
|
||||
* Improved pretty printing of JOIN clauses.
|
||||
* Added support for LOAD DATA statements.
|
||||
|
||||
## [4.1.1] - 2017-02-07
|
||||
|
||||
* Localization using phpmyadmin/motranslator is now optional.
|
||||
* Improved testsuite.
|
||||
* Better handling of non upper cased not reserved keywords.
|
||||
* Minor performance and coding style improvements.
|
||||
|
||||
## [4.1.0] - 2017-01-23
|
||||
|
||||
* Use phpmyadmin/motranslator to localize messages.
|
||||
|
||||
## [4.0.1] - 2017-01-23
|
||||
|
||||
* Fixed CLI wrappers for new API.
|
||||
* Fixed README for new API.
|
||||
|
||||
## [4.0.0] - 2017-01-23
|
||||
|
||||
* Added PhpMyAdmin namespace prefix to follow PSR-4.
|
||||
|
||||
## [3.4.17] - 2017-01-20
|
||||
|
||||
* Coding style fixes.
|
||||
* Fixed indentation in HTML formatting.
|
||||
* Fixed parsing of unterminated variables.
|
||||
* Improved comments lexing.
|
||||
|
||||
## [3.4.16] - 2017-01-06
|
||||
|
||||
* Coding style fixes.
|
||||
* Properly handle operators AND, NOT, OR, XOR, DIV, MOD
|
||||
|
||||
## [3.4.15] - 2017-01-02
|
||||
|
||||
* Fix return value of Formatter.toString() when type is text
|
||||
* Fix parsing of FIELDS and LINES options in SELECT..INTO
|
||||
* PHP 7.2 compatibility.
|
||||
* Better parameter passing to query formatter.
|
||||
|
||||
## [3.4.14] - 2016-11-30
|
||||
|
||||
* Improved parsing of UNION queries.
|
||||
* Recognize BINARY function.
|
||||
|
||||
## [3.4.13] - 2016-11-15
|
||||
|
||||
* Fix broken incorrect clause order detection for Joins.
|
||||
* Add parsing of end options in Select statements.
|
||||
|
||||
## [3.4.12] - 2016-11-09
|
||||
|
||||
* Added verification order of SELECT statement clauses.
|
||||
|
||||
## [3.4.11] - 2016-10-25
|
||||
|
||||
* Fixed parsing of ON UPDATE option in field definition of TIMESTAMP type with precision
|
||||
* Fixed parsing of NATURAL JOIN, CROSS JOIN and related joins.
|
||||
* Fixed parsing of BEGIN/END labels.
|
||||
|
||||
## [3.4.10] - 2016-10-03
|
||||
|
||||
* Fixed API regression on DELETE statement
|
||||
|
||||
## [3.4.9] - 2016-10-03
|
||||
|
||||
* Added support for CASE expressions
|
||||
* Support for parsing and building DELETE statement
|
||||
* Support for parsing subqueries in FROM clause
|
||||
|
||||
## [3.4.8] - 2016-09-22
|
||||
|
||||
* No change release to sync GitHub releases with Packagist
|
||||
|
||||
## [3.4.7] - 2016-09-20
|
||||
|
||||
* Fix parsing of DEFINER without backquotes
|
||||
* Fixed escaping HTML entities in HTML formatter
|
||||
* Fixed escaping of control chars in CLI formatter
|
||||
|
||||
## [3.4.6] - 2016-09-13
|
||||
|
||||
* Fix parsing of REPLACE INTO ...
|
||||
* Fix parsing of INSERT ... ON DUPLICATE KEY UPDATE ...
|
||||
* Extended testsuite
|
||||
* Re-enabled PHP 5.3 support
|
||||
|
||||
## [3.4.5] - 2016-09-13
|
||||
|
||||
* Fix parsing of INSERT...SELECT and INSERT...SET syntax
|
||||
* Fix parsing of CREATE TABLE ... PARTITION
|
||||
* Fix parsing of SET CHARACTER SET, CHARSET, NAMES
|
||||
* Add Support for 'CREATE TABLE `table_copy` LIKE `table`
|
||||
|
||||
## [3.4.4] - 2016-04-26
|
||||
|
||||
* Add support for FULL OUTER JOIN
|
||||
|
||||
## [3.4.3] - 2016-04-19
|
||||
|
||||
* Fix parsing of query with \
|
||||
|
||||
## [3.4.2] - 2016-04-07
|
||||
|
||||
* Recognize UNION DISTINCT
|
||||
* Recognize REGEXP and RLIKE operators
|
||||
|
||||
## [3.4.1] - 2016-04-06
|
||||
|
||||
* Add FULLTEXT and SPATIAL keywords
|
||||
* Properly parse CREATE TABLE [AS] SELECT
|
||||
* Fix parsing of table with DEFAULT and COMMENT
|
||||
|
||||
## [3.4.0] - 2016-02-23
|
||||
|
||||
* Fix parsing DEFAULT value on CREATE
|
||||
* Fix parsing of ALTER VIEW
|
||||
|
||||
## [3.3.1] - 2016-02-12
|
||||
|
||||
* Condition: Allow keyword `INTERVAL`.
|
||||
|
||||
## [3.3.0] - 2016-02-12
|
||||
|
||||
* Expression: Refactored parsing options.
|
||||
|
||||
## [3.2.0] - 2016-02-11
|
||||
|
||||
* Context: Added custom mode that avoids escaping when possible.
|
||||
|
||||
## [3.1.0] - 2016-02-10
|
||||
|
||||
* ArrayObj: Handle more complex expressions in arrays.
|
||||
* BufferedQuery: Backslashes in comments escaped characters in comments.
|
||||
* Condition: Allow `IF` in conditions.
|
||||
* Context: Add `;` as operator.
|
||||
* Context: Updated contexts to contain `BIT` data type.
|
||||
* CreateStatement: The `DEFAULT` option may be an expression.
|
||||
* DescribeStatement: Added `DESC` as alias for `DESCRIBE`.
|
||||
* Expression: Rewrote expression parsing.
|
||||
* Misc: Added PHPUnit's Code Coverage 3.0 as a dependency.
|
||||
* Misc: Added support for PHP 5.4 back.
|
||||
* Misc: Removed dependency to Ctype.
|
||||
* Misc: Repository transferred from @udan11 to @phpMyAdmin.
|
||||
* Misc: Updated `.gitignore` to ignore `composer.lock`.
|
||||
* Misc: Updated Composer and Travis configuration for PHP 7 and PHPUnit 5.
|
||||
* Tools: Documented tags in `ContextGenerator`.
|
||||
|
||||
## [3.0.8] - 2015-12-18
|
||||
|
||||
* Allow `NULL` in expressions.
|
||||
* Downgraded PHPUnit to 4.8. Removed old PHP versions.
|
||||
* Updated PHPUnit to 5.1 and fixed some of the tests.
|
||||
* Added `UNION ALL` as a type of `UNION`.
|
||||
* Expressions are permitted in `SET` operations.
|
||||
* Added `STRAIGHT_JOIN` as a known type of join.
|
||||
* Added missing definitions for `MATCH` and `AGAINST`.
|
||||
* Added missing statement (`FLUSH` and `DEALLOCATE`).
|
||||
|
||||
## [3.0.7] - 2015-11-12
|
||||
|
||||
* Expressions may begin with a function that is also a reserved keyword (e.g. `IF`).
|
||||
|
||||
## [3.0.6] - 2015-11-12
|
||||
|
||||
* Fixed a bug where formatter split the function name and the parameters list.
|
||||
|
||||
## [3.0.5] - 2015-11-08
|
||||
|
||||
* Add GRANT as known statement.
|
||||
* Use JOIN expressions for flag detection.
|
||||
* Fix the order of clauses in SELECT statements involving UNIONs.
|
||||
* Added dummy parsers for CREATE USER and SET PASSWORD statements.
|
||||
* Accept NOT operator in conditions.
|
||||
* Fixed DELIMITER statements in BufferedQuery.
|
||||
* Added INSERT statement builder.
|
||||
|
||||
## [3.0.4] - 2015-10-21
|
||||
|
||||
* Fix error message in `SqlParser\Components\OptionsArray`.
|
||||
|
||||
## [3.0.3] - 2015-10-10
|
||||
|
||||
* Avoid building a field multiple times if clause has synonyms.
|
||||
|
||||
## [3.0.2] - 2015-10-10
|
||||
|
||||
* Add EXISTS as an acceptable keyword in conditions.
|
||||
|
||||
## [3.0.1] - 2015-10-06
|
||||
|
||||
* Handle backslashes separately for `SqlParser\Utils\BufferedQuery`. Fixes a bug where backslashes in combination with strings weren't handled properly.
|
||||
|
||||
## [3.0.0] - 2015-10-02
|
||||
|
||||
__Breaking changes:__
|
||||
|
||||
* `SqlParser\Components\Reference::$table` is now an instance of `SqlParser\Components\Expression` to support references from other tables.
|
||||
|
||||
## [2.1.3] - 2015-10-02
|
||||
|
||||
* Add definitions for all JOIN clauses.
|
||||
|
||||
## [2.1.2] - 2015-10-02
|
||||
|
||||
* Properly parse options when the value of the option is '='.
|
||||
|
||||
## [2.1.1] - 2015-09-30
|
||||
|
||||
* Only RANGE and LIST type partitions support VALUES.
|
||||
|
||||
## [2.1.0] - 2015-09-30
|
||||
|
||||
* Added utilities for handling tokens and tokens list.
|
||||
|
||||
## [2.0.3] - 2015-09-30
|
||||
|
||||
* Added missing NOT IN operator. This caused troubles when parsing conditions that contained the `NOT IN` operator.
|
||||
|
||||
## [2.0.2] - 2015-09-30
|
||||
|
||||
* Added support for `OUTER` as an optional keyword in joins.
|
||||
|
||||
## [2.0.1] - 2015-09-30
|
||||
|
||||
* Fixed a bug related to (sub)partitions options not being included in the built component. Also, the option `ENGINE` was unrecognized.
|
||||
|
||||
## [2.0.0] - 2015-09-25
|
||||
|
||||
* Better parsing for CREATE TABLE statements (related to breaking change 1).
|
||||
* Added support for JSON data type.
|
||||
* Refactoring and minor documentation improvements.
|
||||
|
||||
__Breaking changes:__
|
||||
* `SqlParser\Components\Key::$columns` is now an array of arrays. Each array must contain a `name` key which represents the name of the column and an optional `length` key which represents the length of the column.
|
||||
|
||||
## [1.0.0] - 2015-08-20
|
||||
|
||||
* First release of this library.
|
||||
76
phpMyAdmin/vendor/phpmyadmin/sql-parser/CODE_OF_CONDUCT.md
vendored
Executable file
76
phpMyAdmin/vendor/phpmyadmin/sql-parser/CODE_OF_CONDUCT.md
vendored
Executable file
@@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at info@phpmyadmin.net. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
53
phpMyAdmin/vendor/phpmyadmin/sql-parser/CONTRIBUTING.md
vendored
Executable file
53
phpMyAdmin/vendor/phpmyadmin/sql-parser/CONTRIBUTING.md
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
# Contributing to SQL Parser
|
||||
|
||||
## Reporting issues
|
||||
|
||||
Our issue tracker is hosted at GitHub:
|
||||
|
||||
https://github.com/phpmyadmin/sql-parser/issues
|
||||
|
||||
Please search for existing issues before reporting new ones.
|
||||
|
||||
## Working with Git checkout
|
||||
|
||||
The dependencies are managed by Composer, to get them all installed (or update
|
||||
on consequent runs) do:
|
||||
|
||||
```
|
||||
composer update
|
||||
```
|
||||
|
||||
## Submitting patches
|
||||
|
||||
Please submit your patches using GitHub pull requests, this allows us to review
|
||||
them and to run automated tests on the code.
|
||||
|
||||
## Coding standards
|
||||
|
||||
We do follow PSR-1 and PSR-2 coding standards.
|
||||
|
||||
You can use phpcbf to fix the code to match our expectations:
|
||||
|
||||
```
|
||||
./vendor/bin/phpcbf
|
||||
```
|
||||
|
||||
## Testsuite
|
||||
|
||||
Our code comes with quite comprehensive testsuite, it is automatically executed
|
||||
on every commit and pull request, you can also run it locally:
|
||||
|
||||
```
|
||||
./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
The testsuite relies on fixtures of parser states, in case you need to
|
||||
regenerate some of these there are helper scripts in tools directory:
|
||||
|
||||
```
|
||||
# Remove file you want to regenerate
|
||||
rm tests/data/parser/parse.out
|
||||
|
||||
# Run the generator located in the tools directory
|
||||
./tools/run_generators.sh
|
||||
```
|
||||
339
phpMyAdmin/vendor/phpmyadmin/sql-parser/LICENSE.txt
vendored
Executable file
339
phpMyAdmin/vendor/phpmyadmin/sql-parser/LICENSE.txt
vendored
Executable file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
132
phpMyAdmin/vendor/phpmyadmin/sql-parser/README.md
vendored
Executable file
132
phpMyAdmin/vendor/phpmyadmin/sql-parser/README.md
vendored
Executable file
@@ -0,0 +1,132 @@
|
||||
# SQL Parser
|
||||
|
||||
A validating SQL lexer and parser with a focus on MySQL dialect.
|
||||
|
||||
## Code status
|
||||
|
||||

|
||||
[](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/?branch=master)
|
||||
[](https://codecov.io/github/phpmyadmin/sql-parser?branch=QA)
|
||||
[](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/?branch=master)
|
||||
[](https://hosted.weblate.org/engage/phpmyadmin/?utm_source=widget)
|
||||
[](https://packagist.org/packages/phpmyadmin/sql-parser)
|
||||
[](https://www.codetriage.com/phpmyadmin/sql-parser)
|
||||
|
||||
## Installation
|
||||
|
||||
Please use [Composer][1] to install:
|
||||
|
||||
```sh
|
||||
composer require phpmyadmin/sql-parser
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The API documentation is available at
|
||||
<https://develdocs.phpmyadmin.net/sql-parser/>.
|
||||
|
||||
## Usage
|
||||
|
||||
### Command line utilities
|
||||
|
||||
Command line utility to syntax highlight SQL query:
|
||||
|
||||
```sh
|
||||
./vendor/bin/highlight-query --query "SELECT 1"
|
||||
```
|
||||
|
||||
Command line utility to lint SQL query:
|
||||
|
||||
```sh
|
||||
./vendor/bin/lint-query --query "SELECT 1"
|
||||
```
|
||||
|
||||
Command line utility to tokenize SQL query:
|
||||
|
||||
```sh
|
||||
./vendor/bin/tokenize-query --query "SELECT 1"
|
||||
```
|
||||
|
||||
All commands are able to parse input from stdin (standard in), such as:
|
||||
|
||||
```sh
|
||||
echo "SELECT 1" | ./vendor/bin/highlight-query
|
||||
cat example.sql | ./vendor/bin/lint-query
|
||||
```
|
||||
|
||||
### Formatting SQL query
|
||||
|
||||
```php
|
||||
echo PhpMyAdmin\SqlParser\Utils\Formatter::format($query, array('type' => 'html'));
|
||||
```
|
||||
|
||||
### Discoverying query type
|
||||
|
||||
```php
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Utils\Query;
|
||||
|
||||
$query = 'OPTIMIZE TABLE tbl';
|
||||
$parser = new Parser($query);
|
||||
$flags = Query::getFlags($parser->statements[0]);
|
||||
|
||||
echo $flags['querytype'];
|
||||
```
|
||||
|
||||
### Parsing and building SQL query
|
||||
|
||||
```php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$query1 = "select * from a";
|
||||
$parser = new PhpMyAdmin\SqlParser\Parser($query1);
|
||||
|
||||
// inspect query
|
||||
var_dump($parser->statements[0]); // outputs object(PhpMyAdmin\SqlParser\Statements\SelectStatement)
|
||||
|
||||
// modify query by replacing table a with table b
|
||||
$table2 = new \PhpMyAdmin\SqlParser\Components\Expression("", "b", "", "");
|
||||
$parser->statements[0]->from[0] = $table2;
|
||||
|
||||
// build query again from an array of object(PhpMyAdmin\SqlParser\Statements\SelectStatement) to a string
|
||||
$statement = $parser->statements[0];
|
||||
$query2 = $statement->build();
|
||||
var_dump($query2); // outputs string(19) "SELECT * FROM `b` "
|
||||
|
||||
// Change SQL mode
|
||||
PhpMyAdmin\SqlParser\Context::setMode('ANSI_QUOTES');
|
||||
|
||||
// build the query again using different quotes
|
||||
$query2 = $statement->build();
|
||||
var_dump($query2); // outputs string(19) "SELECT * FROM "b" "
|
||||
```
|
||||
|
||||
## Localization
|
||||
|
||||
You can localize error messages installing `phpmyadmin/motranslator` version `4.0` or newer:
|
||||
```sh
|
||||
composer require phpmyadmin/motranslator:^4.0
|
||||
```
|
||||
|
||||
The locale is automatically detected from your environment, you can also set a different locale
|
||||
|
||||
**From cli**:
|
||||
```sh
|
||||
LC_ALL=pl ./vendor/bin/lint-query --query "SELECT 1"
|
||||
```
|
||||
|
||||
**From php**:
|
||||
```php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$GLOBALS['lang'] = 'pl';
|
||||
|
||||
$query1 = "select * from a";
|
||||
$parser = new PhpMyAdmin\SqlParser\Parser($query1);
|
||||
```
|
||||
|
||||
## More information
|
||||
|
||||
This library was originally created during the Google Summer of Code 2015 and has been used by phpMyAdmin since version 4.5.
|
||||
|
||||
[1]:https://getcomposer.org/
|
||||
29
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/highlight-query
vendored
Executable file
29
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/highlight-query
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$files = array(
|
||||
__DIR__ . "/../vendor/autoload.php",
|
||||
__DIR__ . "/../../vendor/autoload.php",
|
||||
__DIR__ . "/../../../autoload.php",
|
||||
"vendor/autoload.php"
|
||||
);
|
||||
|
||||
$found = false;
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
die(
|
||||
"You need to set up the project dependencies using the following commands:" . PHP_EOL .
|
||||
"curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
|
||||
"php composer.phar install" . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
|
||||
exit($cli->runHighlight());
|
||||
30
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/lint-query
vendored
Executable file
30
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/lint-query
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$files = array(
|
||||
__DIR__ . "/../vendor/autoload.php",
|
||||
__DIR__ . "/../../vendor/autoload.php",
|
||||
__DIR__ . "/../../../autoload.php",
|
||||
"vendor/autoload.php"
|
||||
);
|
||||
|
||||
$found = false;
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
die(
|
||||
"You need to set up the project dependencies using the following commands:" . PHP_EOL .
|
||||
"curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
|
||||
"php composer.phar install" . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
|
||||
exit($cli->runLint());
|
||||
|
||||
29
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/tokenize-query
vendored
Executable file
29
phpMyAdmin/vendor/phpmyadmin/sql-parser/bin/tokenize-query
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$files = array(
|
||||
__DIR__ . "/../vendor/autoload.php",
|
||||
__DIR__ . "/../../vendor/autoload.php",
|
||||
__DIR__ . "/../../../autoload.php",
|
||||
"vendor/autoload.php"
|
||||
);
|
||||
|
||||
$found = false;
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
die(
|
||||
"You need to set up the project dependencies using the following commands:" . PHP_EOL .
|
||||
"curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
|
||||
"php composer.phar install" . PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
|
||||
exit($cli->runTokenize());
|
||||
48
phpMyAdmin/vendor/phpmyadmin/sql-parser/composer.json
vendored
Executable file
48
phpMyAdmin/vendor/phpmyadmin/sql-parser/composer.json
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "phpmyadmin/sql-parser",
|
||||
"description": "A validating SQL lexer and parser with a focus on MySQL dialect.",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"keywords": ["sql", "lexer", "parser", "analysis"],
|
||||
"homepage": "https://github.com/phpmyadmin/sql-parser",
|
||||
"authors": [
|
||||
{
|
||||
"name": "The phpMyAdmin Team",
|
||||
"email": "developers@phpmyadmin.net",
|
||||
"homepage": "https://www.phpmyadmin.net/team/"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpmyadmin/sql-parser/issues",
|
||||
"source": "https://github.com/phpmyadmin/sql-parser"
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.3.0 || ^7.0",
|
||||
"symfony/polyfill-mbstring": "^1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.8 || ~5.7 || ~6.5 || ^7.0",
|
||||
"squizlabs/php_codesniffer": "~2.9 || ~3.4"
|
||||
},
|
||||
"conflict": {
|
||||
"phpmyadmin/motranslator": "<3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance",
|
||||
"phpmyadmin/motranslator": "Translate messages to your favorite locale"
|
||||
},
|
||||
"bin": [
|
||||
"bin/highlight-query",
|
||||
"bin/lint-query",
|
||||
"bin/tokenize-query"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\SqlParser\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\SqlParser\\Tests\\": "tests"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/af/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/af/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ar/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ar/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ast/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ast/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/az/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/az/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/be/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/be/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/be@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/be@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bg/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bg/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/br/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/br/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/brx/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/brx/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bs/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/bs/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ca/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ca/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ckb/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ckb/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/cs/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/cs/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/cy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/cy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/da/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/da/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/de/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/de/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/el/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/el/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/en_GB/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/en_GB/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/eo/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/eo/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/es/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/es/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/et/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/et/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/eu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/eu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fa/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fa/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/fy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/gl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/gl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/gu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/gu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/he/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/he/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hu/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/hy/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ia/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ia/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/id/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/id/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/it/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/it/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ja/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ja/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ka/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ka/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/kk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/kk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/km/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/km/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/kn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/kn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ko/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ko/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ksh/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ksh/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ky/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ky/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/li/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/li/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/lt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/lt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/lv/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/lv/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/mk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/mk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ml/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ml/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/mn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/mn/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ms/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ms/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/nb/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/nb/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ne/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ne/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/nl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/nl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pa/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pa/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pt_BR/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/pt_BR/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ro/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ro/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ru/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ru/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/si/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/si/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sl/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sq/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sq/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
217
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sqlparser.pot
vendored
Executable file
217
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sqlparser.pot
vendored
Executable file
@@ -0,0 +1,217 @@
|
||||
# phpMyAdmin SQL parser translation.
|
||||
# Copyright (C) 2015 - 2017 phpMyAdmin devel team
|
||||
# This file is distributed under the same license as the SQL parser package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: SQL parser 0\n"
|
||||
"Report-Msgid-Bugs-To: translators@phpmyadmin.net\n"
|
||||
"POT-Creation-Date: 2017-08-21 12:54+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: src/Component.php:43 src/Component.php:63
|
||||
msgid "Not implemented yet."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/AlterOperation.php:241 src/Statement.php:334
|
||||
msgid ""
|
||||
"A new statement was found, but no delimiter between it and the previous one."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/AlterOperation.php:253
|
||||
msgid "Unrecognized alter operation."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Array2d.php:88
|
||||
#, php-format
|
||||
msgid "%1$d values were expected, but found %2$d."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Array2d.php:111
|
||||
msgid "An opening bracket followed by a set of values was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/ArrayObj.php:114 src/Components/CreateDefinition.php:201
|
||||
msgid "An opening bracket was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CaseExpression.php:135 src/Components/CaseExpression.php:164
|
||||
#: src/Components/CaseExpression.php:176 src/Components/CaseExpression.php:190
|
||||
#: src/Statements/DeleteStatement.php:227
|
||||
#: src/Statements/DeleteStatement.php:244
|
||||
#: src/Statements/DeleteStatement.php:292
|
||||
#: src/Statements/DeleteStatement.php:303
|
||||
#: src/Statements/DeleteStatement.php:333
|
||||
#: src/Statements/DeleteStatement.php:344
|
||||
#: src/Statements/InsertStatement.php:189
|
||||
#: src/Statements/InsertStatement.php:217 src/Statements/LoadStatement.php:258
|
||||
#: src/Statements/ReplaceStatement.php:155
|
||||
#: src/Statements/ReplaceStatement.php:182
|
||||
msgid "Unexpected keyword."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CaseExpression.php:199
|
||||
msgid "Unexpected end of CASE expression"
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CreateDefinition.php:223
|
||||
msgid ""
|
||||
"A symbol name was expected! A reserved keyword can not be used as a column "
|
||||
"name without backquotes."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CreateDefinition.php:237
|
||||
msgid "A symbol name was expected!"
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CreateDefinition.php:270
|
||||
msgid "A comma or a closing bracket was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/CreateDefinition.php:286
|
||||
msgid "A closing bracket was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/DataType.php:123
|
||||
msgid "Unrecognized data type."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Expression.php:244 src/Components/Expression.php:394
|
||||
msgid "An alias was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Expression.php:332 src/Components/Expression.php:351
|
||||
#: src/Components/Expression.php:383
|
||||
msgid "An alias was previously found."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Expression.php:364
|
||||
msgid "Unexpected dot."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/ExpressionArray.php:102
|
||||
msgid "An expression was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/Limit.php:86 src/Components/Limit.php:108
|
||||
msgid "An offset was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/OptionsArray.php:143
|
||||
#, php-format
|
||||
msgid "This option conflicts with \"%1$s\"."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/RenameOperation.php:109
|
||||
msgid "The old name of the table was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/RenameOperation.php:119
|
||||
msgid "Keyword \"TO\" was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/RenameOperation.php:135
|
||||
msgid "The new name of the table was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/RenameOperation.php:153
|
||||
msgid "A rename operation was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Components/SetOperation.php:117
|
||||
msgid "Missing expression."
|
||||
msgstr ""
|
||||
|
||||
#: src/Lexer.php:237
|
||||
msgid "Unexpected character."
|
||||
msgstr ""
|
||||
|
||||
#: src/Lexer.php:278
|
||||
msgid "Expected whitespace(s) before delimiter."
|
||||
msgstr ""
|
||||
|
||||
#: src/Lexer.php:296 src/Lexer.php:314
|
||||
msgid "Expected delimiter."
|
||||
msgstr ""
|
||||
|
||||
#: src/Lexer.php:843
|
||||
#, php-format
|
||||
msgid "Ending quote %1$s was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Lexer.php:884
|
||||
msgid "Variable name was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Parser.php:423
|
||||
msgid "Unexpected beginning of statement."
|
||||
msgstr ""
|
||||
|
||||
#: src/Parser.php:442
|
||||
msgid "Unrecognized statement type."
|
||||
msgstr ""
|
||||
|
||||
#: src/Parser.php:527
|
||||
msgid "No transaction was previously started."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statement.php:242 src/Statements/DeleteStatement.php:254
|
||||
#: src/Statements/DeleteStatement.php:306
|
||||
#: src/Statements/InsertStatement.php:226
|
||||
#: src/Statements/InsertStatement.php:246 src/Statements/LoadStatement.php:261
|
||||
#: src/Statements/LoadStatement.php:291 src/Statements/LoadStatement.php:310
|
||||
#: src/Statements/ReplaceStatement.php:190
|
||||
msgid "Unexpected token."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statement.php:306
|
||||
msgid "This type of clause was previously parsed."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statement.php:366
|
||||
msgid "Unrecognized keyword."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statement.php:377
|
||||
msgid "Keyword at end of statement."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statement.php:503
|
||||
msgid "Unexpected ordering of clauses."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statements/CreateStatement.php:375
|
||||
msgid "The name of the entity was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statements/CreateStatement.php:430
|
||||
msgid "A table name was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statements/CreateStatement.php:438
|
||||
msgid "At least one column definition was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statements/CreateStatement.php:550
|
||||
msgid "A \"RETURNS\" keyword was expected."
|
||||
msgstr ""
|
||||
|
||||
#: src/Statements/DeleteStatement.php:314
|
||||
msgid "This type of clause is not valid in Multi-table queries."
|
||||
msgstr ""
|
||||
|
||||
#: tests/Lexer/LexerTest.php:19 tests/Parser/ParserTest.php:58
|
||||
msgid "error #1"
|
||||
msgstr ""
|
||||
|
||||
#: tests/Lexer/LexerTest.php:46 tests/Parser/ParserTest.php:80
|
||||
msgid "strict error"
|
||||
msgstr ""
|
||||
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sr@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sr@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sv/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/sv/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ta/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ta/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/te/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/te/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/th/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/th/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tr/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/tt/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ug/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ug/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uk/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ur/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/ur/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uz/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uz/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uz@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/uz@latin/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/vi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/vi/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/vls/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/vls/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/zh_CN/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/zh_CN/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/zh_TW/LC_MESSAGES/sqlparser.mo
vendored
Executable file
BIN
phpMyAdmin/vendor/phpmyadmin/sql-parser/locale/zh_TW/LC_MESSAGES/sqlparser.mo
vendored
Executable file
Binary file not shown.
46
phpMyAdmin/vendor/phpmyadmin/sql-parser/phpunit.xml.dist
vendored
Executable file
46
phpMyAdmin/vendor/phpmyadmin/sql-parser/phpunit.xml.dist
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
colors="true"
|
||||
verbose="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<logging>
|
||||
<log type="coverage-clover" target="build/logs/clover.xml" />
|
||||
</logging>
|
||||
<testsuites>
|
||||
<testsuite name="Builder">
|
||||
<directory suffix=".php">./tests/Builder</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Components">
|
||||
<directory suffix=".php">./tests/Components</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Lexer">
|
||||
<directory suffix=".php">./tests/Lexer</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Misc">
|
||||
<directory suffix=".php">./tests/Misc</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Parser">
|
||||
<directory suffix=".php">./tests/Parser</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Utils">
|
||||
<directory suffix=".php">./tests/Utils</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<ini name="display_errors" value="On" />
|
||||
<ini name="display_startup_errors" value="On" />
|
||||
<ini name="error_reporting" value="E_ALL" />
|
||||
</php>
|
||||
</phpunit>
|
||||
77
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Component.php
vendored
Executable file
77
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Component.php
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Defines a component that is later extended to parse specialized components or
|
||||
* keywords.
|
||||
*
|
||||
* There is a small difference between *Component and *Keyword classes: usually,
|
||||
* *Component parsers can be reused in multiple situations and *Keyword parsers
|
||||
* count on the *Component classes to do their job.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
/**
|
||||
* A component (of a statement) is a part of a statement that is common to
|
||||
* multiple query types.
|
||||
*
|
||||
* @category Components
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
abstract class Component
|
||||
{
|
||||
/**
|
||||
* Parses the tokens contained in the given list in the context of the given
|
||||
* parser.
|
||||
*
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @throws \Exception not implemented yet
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function parse(
|
||||
Parser $parser,
|
||||
TokensList $list,
|
||||
array $options = array()
|
||||
) {
|
||||
// This method should be abstract, but it can't be both static and
|
||||
// abstract.
|
||||
throw new \Exception(Translator::gettext('Not implemented yet.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the string representation of a component of this type.
|
||||
*
|
||||
* In other words, this function represents the inverse function of
|
||||
* `static::parse`.
|
||||
*
|
||||
* @param mixed $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @throws \Exception not implemented yet
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
// This method should be abstract, but it can't be both static and
|
||||
// abstract.
|
||||
throw new \Exception(Translator::gettext('Not implemented yet.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the string representation of a component of this type.
|
||||
*
|
||||
* @see static::build
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return static::build($this);
|
||||
}
|
||||
}
|
||||
428
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/AlterOperation.php
vendored
Executable file
428
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/AlterOperation.php
vendored
Executable file
@@ -0,0 +1,428 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Parses an alter operation.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* Parses an alter operation.
|
||||
*
|
||||
* @category Components
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
class AlterOperation extends Component
|
||||
{
|
||||
/**
|
||||
* All database options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $DB_OPTIONS = array(
|
||||
'CHARACTER SET' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'CHARSET' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'DEFAULT CHARACTER SET' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'DEFAULT CHARSET' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'UPGRADE' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'COLLATE' => array(
|
||||
2,
|
||||
'var'
|
||||
),
|
||||
'DEFAULT COLLATE' => array(
|
||||
2,
|
||||
'var'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* All table options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $TABLE_OPTIONS = array(
|
||||
'ENGINE' => array(
|
||||
1,
|
||||
'var='
|
||||
),
|
||||
'AUTO_INCREMENT' => array(
|
||||
1,
|
||||
'var='
|
||||
),
|
||||
'AVG_ROW_LENGTH' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'MAX_ROWS' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'ROW_FORMAT' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'COMMENT' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'ADD' => 1,
|
||||
'ALTER' => 1,
|
||||
'ANALYZE' => 1,
|
||||
'CHANGE' => 1,
|
||||
'CHARSET' => 1,
|
||||
'CHECK' => 1,
|
||||
'COALESCE' => 1,
|
||||
'CONVERT' => 1,
|
||||
'DEFAULT CHARSET' => 1,
|
||||
'DISABLE' => 1,
|
||||
'DISCARD' => 1,
|
||||
'DROP' => 1,
|
||||
'ENABLE' => 1,
|
||||
'IMPORT' => 1,
|
||||
'MODIFY' => 1,
|
||||
'OPTIMIZE' => 1,
|
||||
'ORDER' => 1,
|
||||
'PARTITION' => 1,
|
||||
'REBUILD' => 1,
|
||||
'REMOVE' => 1,
|
||||
'RENAME' => 1,
|
||||
'REORGANIZE' => 1,
|
||||
'REPAIR' => 1,
|
||||
'UPGRADE' => 1,
|
||||
|
||||
'COLUMN' => 2,
|
||||
'CONSTRAINT' => 2,
|
||||
'DEFAULT' => 2,
|
||||
'TO' => 2,
|
||||
'BY' => 2,
|
||||
'FOREIGN' => 2,
|
||||
'FULLTEXT' => 2,
|
||||
'KEY' => 2,
|
||||
'KEYS' => 2,
|
||||
'PARTITIONING' => 2,
|
||||
'PRIMARY KEY' => 2,
|
||||
'SPATIAL' => 2,
|
||||
'TABLESPACE' => 2,
|
||||
'INDEX' => 2,
|
||||
|
||||
'CHARACTER SET' => 3,
|
||||
);
|
||||
|
||||
/**
|
||||
* All user options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $USER_OPTIONS = array(
|
||||
'ATTRIBUTE' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'COMMENT' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'REQUIRE' => array(
|
||||
1,
|
||||
'var'
|
||||
),
|
||||
'BY' => array(
|
||||
2,
|
||||
'expr'
|
||||
),
|
||||
'PASSWORD' => array(
|
||||
2,
|
||||
'var'
|
||||
),
|
||||
'WITH' => array(
|
||||
2,
|
||||
'var'
|
||||
),
|
||||
|
||||
'ACCOUNT' => 1,
|
||||
'DEFAULT' => 1,
|
||||
|
||||
'LOCK' => 2,
|
||||
'UNLOCK' => 2,
|
||||
|
||||
'IDENTIFIED' => 3,
|
||||
);
|
||||
|
||||
/**
|
||||
* All view options.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $VIEW_OPTIONS = array(
|
||||
'AS' => 1,
|
||||
);
|
||||
|
||||
/**
|
||||
* Options of this operation.
|
||||
*
|
||||
* @var OptionsArray
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* The altered field.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $field;
|
||||
|
||||
/**
|
||||
* Unparsed tokens.
|
||||
*
|
||||
* @var Token[]|string
|
||||
*/
|
||||
public $unknown = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param OptionsArray $options options of alter operation
|
||||
* @param Expression $field altered field
|
||||
* @param array $unknown unparsed tokens found at the end of operation
|
||||
*/
|
||||
public function __construct(
|
||||
$options = null,
|
||||
$field = null,
|
||||
$unknown = array()
|
||||
) {
|
||||
$this->options = $options;
|
||||
$this->field = $field;
|
||||
$this->unknown = $unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @return AlterOperation
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = array())
|
||||
{
|
||||
$ret = new self();
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ options ]---------------------> 1
|
||||
*
|
||||
* 1 ----------------------[ field ]----------------------> 2
|
||||
*
|
||||
* 2 -------------------------[ , ]-----------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping comments.
|
||||
if ($token->type === Token::TYPE_COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skipping whitespaces.
|
||||
if ($token->type === Token::TYPE_WHITESPACE) {
|
||||
if ($state === 2) {
|
||||
// When parsing the unknown part, the whitespaces are
|
||||
// included to not break anything.
|
||||
$ret->unknown[] = $token;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->options = OptionsArray::parse($parser, $list, $options);
|
||||
|
||||
if ($ret->options->has('AS')) {
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
if ($list->tokens[$list->idx]->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
$ret->unknown[] = $list->tokens[$list->idx];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
$ret->field = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
array(
|
||||
'breakOnAlias' => true,
|
||||
'parseField' => 'column'
|
||||
)
|
||||
);
|
||||
if ($ret->field === null) {
|
||||
// No field was read. We go back one token so the next
|
||||
// iteration will parse the same token, but in state 2.
|
||||
--$list->idx;
|
||||
}
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
$array_key = '';
|
||||
if (is_string($token->value) || is_numeric($token->value)) {
|
||||
$array_key = $token->value;
|
||||
} else {
|
||||
$array_key = $token->token;
|
||||
}
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if ($token->value === '(') {
|
||||
++$brackets;
|
||||
} elseif ($token->value === ')') {
|
||||
--$brackets;
|
||||
} elseif (($token->value === ',') && ($brackets === 0)) {
|
||||
break;
|
||||
}
|
||||
} elseif (! self::checkIfTokenQuotedSymbol($token)) {
|
||||
if (! empty(Parser::$STATEMENT_PARSERS[$token->value])) {
|
||||
// We want to get the next non-comment and non-space token after $token
|
||||
// therefore, the first getNext call will start with the current $idx which's $token,
|
||||
// will return it and increase $idx by 1, which's not guaranteed to be non-comment
|
||||
// and non-space, that's why we're calling getNext again.
|
||||
|
||||
$list->getNext();
|
||||
$nextToken = $list->getNext();
|
||||
|
||||
if ($token->value === 'SET' && $nextToken !== null && $nextToken->value === '(') {
|
||||
// To avoid adding the tokens between the SET() parentheses to the unknown tokens
|
||||
$list->getNextOfTypeAndValue(Token::TYPE_OPERATOR, ')');
|
||||
} elseif ($token->value === 'SET' && $nextToken !== null && $nextToken->value === 'DEFAULT') {
|
||||
// to avoid adding the `DEFAULT` token to the unknown tokens.
|
||||
++$list->idx;
|
||||
} else {
|
||||
// We have reached the end of ALTER operation and suddenly found
|
||||
// a start to new statement, but have not find a delimiter between them
|
||||
$parser->error(
|
||||
'A new statement was found, but no delimiter between it and the previous one.',
|
||||
$token
|
||||
);
|
||||
break;
|
||||
}
|
||||
} elseif ((array_key_exists($array_key, self::$DB_OPTIONS)
|
||||
|| array_key_exists($array_key, self::$TABLE_OPTIONS))
|
||||
&& ! self::checkIfColumnDefinitionKeyword($array_key)
|
||||
) {
|
||||
// This alter operation has finished, which means a comma was missing before start of new alter operation
|
||||
$parser->error(
|
||||
'Missing comma before start of a new alter operation.',
|
||||
$token
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$ret->unknown[] = $token;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ret->options->isEmpty()) {
|
||||
$parser->error(
|
||||
'Unrecognized alter operation.',
|
||||
$list->tokens[$list->idx]
|
||||
);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AlterOperation $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
$ret = $component->options . ' ';
|
||||
if ((isset($component->field)) && ($component->field !== '')) {
|
||||
$ret .= $component->field . ' ';
|
||||
}
|
||||
$ret .= TokensList::build($component->unknown);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if token's value is one of the common keywords
|
||||
* between column and table alteration
|
||||
*
|
||||
* @param string $tokenValue Value of current token
|
||||
* @return bool
|
||||
*/
|
||||
private static function checkIfColumnDefinitionKeyword($tokenValue)
|
||||
{
|
||||
$common_options = array(
|
||||
'AUTO_INCREMENT',
|
||||
'COMMENT',
|
||||
'DEFAULT',
|
||||
'CHARACTER SET',
|
||||
'COLLATE',
|
||||
'PRIMARY',
|
||||
'UNIQUE',
|
||||
'PRIMARY KEY',
|
||||
'UNIQUE KEY'
|
||||
);
|
||||
// Since these options can be used for
|
||||
// both table as well as a specific column in the table
|
||||
return in_array($tokenValue, $common_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if token is symbol and quoted with backtick
|
||||
*
|
||||
* @param Token $token token to check
|
||||
* @return bool
|
||||
*/
|
||||
private static function checkIfTokenQuotedSymbol($token) {
|
||||
return $token->type === Token::TYPE_SYMBOL && $token->flags === Token::FLAG_SYMBOL_BACKTICK;
|
||||
}
|
||||
}
|
||||
131
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/Array2d.php
vendored
Executable file
131
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/Array2d.php
vendored
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* `VALUES` keyword parser.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
use PhpMyAdmin\SqlParser\Translator;
|
||||
|
||||
/**
|
||||
* `VALUES` keyword parser.
|
||||
*
|
||||
* @category Keywords
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
class Array2d extends Component
|
||||
{
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @return ArrayObj[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = array())
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
/**
|
||||
* The number of values in each set.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$count = -1;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ----------------------[ array ]----------------------> 1
|
||||
*
|
||||
* 1 ------------------------[ , ]------------------------> 0
|
||||
* 1 -----------------------[ else ]----------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// No keyword is expected.
|
||||
if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->value === '(') {
|
||||
$arr = ArrayObj::parse($parser, $list, $options);
|
||||
$arrCount = count($arr->values);
|
||||
if ($count === -1) {
|
||||
$count = $arrCount;
|
||||
} elseif ($arrCount !== $count) {
|
||||
$parser->error(
|
||||
sprintf(
|
||||
Translator::gettext('%1$d values were expected, but found %2$d.'),
|
||||
$count,
|
||||
$arrCount
|
||||
),
|
||||
$token
|
||||
);
|
||||
}
|
||||
$ret[] = $arr;
|
||||
$state = 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
if ($token->value === ',') {
|
||||
$state = 0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$parser->error(
|
||||
'An opening bracket followed by a set of values was expected.',
|
||||
$list->tokens[$list->idx]
|
||||
);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ArrayObj[] $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
return ArrayObj::build($component);
|
||||
}
|
||||
}
|
||||
189
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/ArrayObj.php
vendored
Executable file
189
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/ArrayObj.php
vendored
Executable file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Parses an array.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* Parses an array.
|
||||
*
|
||||
* @category Components
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
class ArrayObj extends Component
|
||||
{
|
||||
/**
|
||||
* The array that contains the unprocessed value of each token.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $raw = array();
|
||||
|
||||
/**
|
||||
* The array that contains the processed value of each token.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $values = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $raw the unprocessed values
|
||||
* @param array $values the processed values
|
||||
*/
|
||||
public function __construct(array $raw = array(), array $values = array())
|
||||
{
|
||||
$this->raw = $raw;
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @return ArrayObj|Component[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = array())
|
||||
{
|
||||
$ret = empty($options['type']) ? new self() : array();
|
||||
|
||||
/**
|
||||
* The last raw expression.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$lastRaw = '';
|
||||
|
||||
/**
|
||||
* The last value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$lastValue = '';
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* Last separator (bracket or comma).
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$isCommaLast = false;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if (($token->type === Token::TYPE_WHITESPACE)
|
||||
|| ($token->type === Token::TYPE_COMMENT)
|
||||
) {
|
||||
$lastRaw .= $token->token;
|
||||
$lastValue = trim($lastValue) . ' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($brackets === 0)
|
||||
&& (($token->type !== Token::TYPE_OPERATOR)
|
||||
|| ($token->value !== '('))
|
||||
) {
|
||||
$parser->error('An opening bracket was expected.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if ($token->value === '(') {
|
||||
if (++$brackets === 1) { // 1 is the base level.
|
||||
continue;
|
||||
}
|
||||
} elseif ($token->value === ')') {
|
||||
if (--$brackets === 0) { // Array ended.
|
||||
break;
|
||||
}
|
||||
} elseif ($token->value === ',') {
|
||||
if ($brackets === 1) {
|
||||
$isCommaLast = true;
|
||||
if (empty($options['type'])) {
|
||||
$ret->raw[] = trim($lastRaw);
|
||||
$ret->values[] = trim($lastValue);
|
||||
$lastRaw = $lastValue = '';
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($options['type'])) {
|
||||
$lastRaw .= $token->token;
|
||||
$lastValue .= $token->value;
|
||||
} else {
|
||||
$ret[] = $options['type']::parse(
|
||||
$parser,
|
||||
$list,
|
||||
empty($options['typeOptions']) ? array() : $options['typeOptions']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handling last element.
|
||||
//
|
||||
// This is treated differently to treat the following cases:
|
||||
//
|
||||
// => array()
|
||||
// (,) => array('', '')
|
||||
// () => array()
|
||||
// (a,) => array('a', '')
|
||||
// (a) => array('a')
|
||||
//
|
||||
$lastRaw = trim($lastRaw);
|
||||
if ((empty($options['type']))
|
||||
&& ((strlen($lastRaw) > 0) || ($isCommaLast))
|
||||
) {
|
||||
$ret->raw[] = $lastRaw;
|
||||
$ret->values[] = trim($lastValue);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ArrayObj|ArrayObj[] $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
} elseif (! empty($component->raw)) {
|
||||
return '(' . implode(', ', $component->raw) . ')';
|
||||
}
|
||||
|
||||
return '(' . implode(', ', $component->values) . ')';
|
||||
}
|
||||
}
|
||||
314
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php
vendored
Executable file
314
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php
vendored
Executable file
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Parses a reference to a CASE expression.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* Parses a reference to a CASE expression.
|
||||
*
|
||||
* @category Components
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
class CaseExpression extends Component
|
||||
{
|
||||
/**
|
||||
* The value to be compared.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* The conditions in WHEN clauses.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $conditions = array();
|
||||
|
||||
/**
|
||||
* The results matching with the WHEN clauses.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $results = array();
|
||||
|
||||
/**
|
||||
* The values to be compared against.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $compare_values = array();
|
||||
|
||||
/**
|
||||
* The result in ELSE section of expr.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $else_result;
|
||||
|
||||
/**
|
||||
* The alias of this CASE statement.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $alias;
|
||||
|
||||
/**
|
||||
* The sub-expression.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $expr = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @return CaseExpression
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = array())
|
||||
{
|
||||
$ret = new self();
|
||||
|
||||
/**
|
||||
* State of parser.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* Syntax type (type 0 or type 1).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$type = 0;
|
||||
|
||||
++$list->idx; // Skip 'CASE'
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if (($token->type === Token::TYPE_WHITESPACE)
|
||||
|| ($token->type === Token::TYPE_COMMENT)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
switch ($token->keyword) {
|
||||
case 'WHEN':
|
||||
++$list->idx; // Skip 'WHEN'
|
||||
$new_condition = Condition::parse($parser, $list);
|
||||
$type = 1;
|
||||
$state = 1;
|
||||
$ret->conditions[] = $new_condition;
|
||||
break;
|
||||
case 'ELSE':
|
||||
++$list->idx; // Skip 'ELSE'
|
||||
$ret->else_result = Expression::parse($parser, $list);
|
||||
$state = 0; // last clause of CASE expression
|
||||
break;
|
||||
case 'END':
|
||||
$state = 3; // end of CASE expression
|
||||
++$list->idx;
|
||||
break 2;
|
||||
default:
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break 2;
|
||||
}
|
||||
} else {
|
||||
$ret->value = Expression::parse($parser, $list);
|
||||
$type = 0;
|
||||
$state = 1;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
if ($type === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
switch ($token->keyword) {
|
||||
case 'WHEN':
|
||||
++$list->idx; // Skip 'WHEN'
|
||||
$new_value = Expression::parse($parser, $list);
|
||||
$state = 2;
|
||||
$ret->compare_values[] = $new_value;
|
||||
break;
|
||||
case 'ELSE':
|
||||
++$list->idx; // Skip 'ELSE'
|
||||
$ret->else_result = Expression::parse($parser, $list);
|
||||
$state = 0; // last clause of CASE expression
|
||||
break;
|
||||
case 'END':
|
||||
$state = 3; // end of CASE expression
|
||||
++$list->idx;
|
||||
break 2;
|
||||
default:
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($token->type === Token::TYPE_KEYWORD
|
||||
&& $token->keyword === 'THEN'
|
||||
) {
|
||||
++$list->idx; // Skip 'THEN'
|
||||
$new_result = Expression::parse($parser, $list);
|
||||
$state = 0;
|
||||
$ret->results[] = $new_result;
|
||||
} elseif ($token->type === Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ($state === 2) {
|
||||
if ($type === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD
|
||||
&& $token->keyword === 'THEN'
|
||||
) {
|
||||
++$list->idx; // Skip 'THEN'
|
||||
$new_result = Expression::parse($parser, $list);
|
||||
$ret->results[] = $new_result;
|
||||
$state = 1;
|
||||
} elseif ($token->type === Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($state !== 3) {
|
||||
$parser->error(
|
||||
'Unexpected end of CASE expression',
|
||||
$list->tokens[$list->idx - 1]
|
||||
);
|
||||
} else {
|
||||
// Parse for alias of CASE expression
|
||||
$asFound = false;
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if (($token->type === Token::TYPE_WHITESPACE)
|
||||
|| ($token->type === Token::TYPE_COMMENT)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle optional AS keyword before alias
|
||||
if ($token->type === Token::TYPE_KEYWORD
|
||||
&& $token->keyword === 'AS') {
|
||||
if ($asFound || ! empty($ret->alias)) {
|
||||
$parser->error('Potential duplicate alias of CASE expression.', $token);
|
||||
break;
|
||||
}
|
||||
$asFound = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($asFound
|
||||
&& $token->type === Token::TYPE_KEYWORD
|
||||
&& ($token->flags & Token::FLAG_KEYWORD_RESERVED || $token->flags & Token::FLAG_KEYWORD_FUNCTION)) {
|
||||
$parser->error('An alias expected after AS but got ' . $token->value, $token);
|
||||
$asFound = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($asFound
|
||||
|| $token->type === Token::TYPE_STRING
|
||||
|| ($token->type === Token::TYPE_SYMBOL && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE)
|
||||
|| $token->type === Token::TYPE_NONE
|
||||
) {
|
||||
// An alias is expected (the keyword `AS` was previously found).
|
||||
if (! empty($ret->alias)) {
|
||||
$parser->error('An alias was previously found.', $token);
|
||||
break;
|
||||
}
|
||||
$ret->alias = $token->value;
|
||||
$asFound = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if ($asFound) {
|
||||
$parser->error('An alias was expected after AS.', $list->tokens[$list->idx - 1]);
|
||||
}
|
||||
|
||||
$ret->expr = self::build($ret);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CaseExpression $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
$ret = 'CASE ';
|
||||
if (isset($component->value)) {
|
||||
// Syntax type 0
|
||||
$ret .= $component->value . ' ';
|
||||
$val_cnt = count($component->compare_values);
|
||||
$res_cnt = count($component->results);
|
||||
for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) {
|
||||
$ret .= 'WHEN ' . $component->compare_values[$i] . ' ';
|
||||
$ret .= 'THEN ' . $component->results[$i] . ' ';
|
||||
}
|
||||
} else {
|
||||
// Syntax type 1
|
||||
$val_cnt = count($component->conditions);
|
||||
$res_cnt = count($component->results);
|
||||
for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) {
|
||||
$ret .= 'WHEN ' . Condition::build($component->conditions[$i]) . ' ';
|
||||
$ret .= 'THEN ' . $component->results[$i] . ' ';
|
||||
}
|
||||
}
|
||||
if (isset($component->else_result)) {
|
||||
$ret .= 'ELSE ' . $component->else_result . ' ';
|
||||
}
|
||||
$ret .= 'END';
|
||||
|
||||
if ($component->alias) {
|
||||
$ret .= ' AS ' . Context::escape($component->alias);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
233
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/Condition.php
vendored
Executable file
233
phpMyAdmin/vendor/phpmyadmin/sql-parser/src/Components/Condition.php
vendored
Executable file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* `WHERE` keyword parser.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* `WHERE` keyword parser.
|
||||
*
|
||||
* @category Keywords
|
||||
*
|
||||
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
|
||||
*/
|
||||
class Condition extends Component
|
||||
{
|
||||
/**
|
||||
* Logical operators that can be used to delimit expressions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $DELIMITERS = array(
|
||||
'&&',
|
||||
'||',
|
||||
'AND',
|
||||
'OR',
|
||||
'XOR'
|
||||
);
|
||||
|
||||
/**
|
||||
* List of allowed reserved keywords in conditions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $ALLOWED_KEYWORDS = array(
|
||||
'ALL' => 1,
|
||||
'AND' => 1,
|
||||
'BETWEEN' => 1,
|
||||
'EXISTS' => 1,
|
||||
'IF' => 1,
|
||||
'IN' => 1,
|
||||
'INTERVAL' => 1,
|
||||
'IS' => 1,
|
||||
'LIKE' => 1,
|
||||
'MATCH' => 1,
|
||||
'NOT IN' => 1,
|
||||
'NOT NULL' => 1,
|
||||
'NOT' => 1,
|
||||
'NULL' => 1,
|
||||
'OR' => 1,
|
||||
'REGEXP' => 1,
|
||||
'RLIKE' => 1,
|
||||
'XOR' => 1
|
||||
);
|
||||
|
||||
/**
|
||||
* Identifiers recognized.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $identifiers = array();
|
||||
|
||||
/**
|
||||
* Whether this component is an operator.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isOperator = false;
|
||||
|
||||
/**
|
||||
* The condition.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $expr the condition or the operator
|
||||
*/
|
||||
public function __construct($expr = null)
|
||||
{
|
||||
$this->expr = trim($expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array $options parameters for parsing
|
||||
*
|
||||
* @return Condition[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = array())
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
$expr = new self();
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* Whether there was a `BETWEEN` keyword before or not.
|
||||
*
|
||||
* It is required to keep track of them because their structure contains
|
||||
* the keyword `AND`, which is also an operator that delimits
|
||||
* expressions.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$betweenBefore = false;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if ($token->type === Token::TYPE_COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Replacing all whitespaces (new lines, tabs, etc.) with a single
|
||||
// space character.
|
||||
if ($token->type === Token::TYPE_WHITESPACE) {
|
||||
$expr->expr .= ' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Conditions are delimited by logical operators.
|
||||
if (in_array($token->value, static::$DELIMITERS, true)) {
|
||||
if ($betweenBefore && ($token->value === 'AND')) {
|
||||
// The syntax of keyword `BETWEEN` is hard-coded.
|
||||
$betweenBefore = false;
|
||||
} else {
|
||||
// The expression ended.
|
||||
$expr->expr = trim($expr->expr);
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
// Adding the operator.
|
||||
$expr = new self($token->value);
|
||||
$expr->isOperator = true;
|
||||
$ret[] = $expr;
|
||||
|
||||
// Preparing to parse another condition.
|
||||
$expr = new self();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (($token->type === Token::TYPE_KEYWORD)
|
||||
&& ($token->flags & Token::FLAG_KEYWORD_RESERVED)
|
||||
&& ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
|
||||
) {
|
||||
if ($token->value === 'BETWEEN') {
|
||||
$betweenBefore = true;
|
||||
}
|
||||
if (($brackets === 0) && empty(static::$ALLOWED_KEYWORDS[$token->value])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if ($token->value === '(') {
|
||||
++$brackets;
|
||||
} elseif ($token->value === ')') {
|
||||
if ($brackets === 0) {
|
||||
break;
|
||||
}
|
||||
--$brackets;
|
||||
}
|
||||
}
|
||||
|
||||
$expr->expr .= $token->token;
|
||||
if (($token->type === Token::TYPE_NONE)
|
||||
|| (($token->type === Token::TYPE_KEYWORD)
|
||||
&& (! ($token->flags & Token::FLAG_KEYWORD_RESERVED)))
|
||||
|| ($token->type === Token::TYPE_STRING)
|
||||
|| ($token->type === Token::TYPE_SYMBOL)
|
||||
) {
|
||||
if (! in_array($token->value, $expr->identifiers)) {
|
||||
$expr->identifiers[] = $token->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last iteration was not processed.
|
||||
$expr->expr = trim($expr->expr);
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Condition[] $component the component to be built
|
||||
* @param array $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = array())
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(' ', $component);
|
||||
}
|
||||
|
||||
return $component->expr;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user