first commit
This commit is contained in:
100
pma/vendor/phpmyadmin/motranslator/CHANGELOG.md
vendored
Normal file
100
pma/vendor/phpmyadmin/motranslator/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# Change Log
|
||||
|
||||
## [5.3.0] - 2022-04-26
|
||||
|
||||
* Add support for Symfony 6
|
||||
* Split out `.mo` parsing to separate `MoParser` class
|
||||
* Added `CacheInterface` so alternate cache implementations are pluggable
|
||||
* Added `ApcuCache` implementation to leverage shared in-memory translation cache
|
||||
|
||||
## [5.2.0] - 2021-02-05
|
||||
|
||||
* Fix "Translator::selectString() must be of the type integer, boolean returned" (#37)
|
||||
* Fix "TypeError: StringReader::readintarray() ($count) must be of type int, float given" failing tests on ARM (#36)
|
||||
* Add support for getting and setting all translations (#30)
|
||||
|
||||
## [5.1.0] - 2020-11-15
|
||||
|
||||
* Allow PHPUnit 9 (#35)
|
||||
* Fix some typos
|
||||
* Sync config files
|
||||
* Allow PHP 8.0
|
||||
|
||||
## [5.0.0] - 2020-02-28
|
||||
|
||||
* Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
|
||||
* Enabled strict mode on PHP files
|
||||
* Add support for Symfony 5 (#34)
|
||||
* Add support for phpunit 8
|
||||
* Rename CHANGES.md to CHANGELOG.md and follow a standard format
|
||||
|
||||
## [4.0] - 2018-02-12
|
||||
|
||||
* The library no longer changes system locales.
|
||||
|
||||
## [3.4] - 2017-12-15
|
||||
|
||||
* Added Translator::setTranslation method.
|
||||
|
||||
## [3.3] - 2017-06-01
|
||||
|
||||
* Add support for switching locales for Loader instance.
|
||||
|
||||
## [3.2] - 2017-05-23
|
||||
|
||||
* Various fixes when handling corrupted mo files.
|
||||
|
||||
## [3.1] - 2017-05-15
|
||||
|
||||
* Documentation improvements.
|
||||
|
||||
## [3.0] - 2017-01-23
|
||||
|
||||
* All classes moved to the PhpMyAdmin namespace.
|
||||
|
||||
## [2.2] - 2017-01-07
|
||||
|
||||
* Coding style cleanup.
|
||||
* Avoid installing tests using composer.
|
||||
|
||||
## [2.1] - 2016-12-21
|
||||
|
||||
* Various code cleanups.
|
||||
* Added support for PHP 5.3.
|
||||
|
||||
## [2.0] - 2016-10-13
|
||||
|
||||
* Consistently use camelCase in API.
|
||||
* No more relies on using eval().
|
||||
* Depends on symfony/expression-language for calculations.
|
||||
|
||||
## [1.2] - 2016-09-22
|
||||
|
||||
* Stricter validation of plural expression.
|
||||
|
||||
## [1.1] - 2016-08-29
|
||||
|
||||
* Improved handling of corrupted mo files.
|
||||
* Minor performance improvements.
|
||||
* Stricter validation of plural expression.
|
||||
|
||||
## [1.0] - 2016-04-27
|
||||
|
||||
* Documentation improvements.
|
||||
* Testsuite improvements.
|
||||
|
||||
## [0.4] - 2016-03-02
|
||||
|
||||
* Fixed test failures with hhvm due to broken putenv.
|
||||
|
||||
## [0.3] - 2016-03-01
|
||||
|
||||
* Added Loader::detectlocale method.
|
||||
|
||||
## [0.2] - 2016-02-24
|
||||
|
||||
* Marked PHP 5.4 and 5.5 as supported.
|
||||
|
||||
## [0.1] - 2016-02-23
|
||||
|
||||
* Initial release.
|
||||
339
pma/vendor/phpmyadmin/motranslator/LICENSE
vendored
Normal file
339
pma/vendor/phpmyadmin/motranslator/LICENSE
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
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.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
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.
|
||||
242
pma/vendor/phpmyadmin/motranslator/README.md
vendored
Normal file
242
pma/vendor/phpmyadmin/motranslator/README.md
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
# motranslator
|
||||
|
||||
Translation API for PHP using Gettext MO files.
|
||||
|
||||

|
||||
[](https://codecov.io/github/phpmyadmin/motranslator?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/phpmyadmin/motranslator/?branch=master)
|
||||
[](https://packagist.org/packages/phpmyadmin/motranslator)
|
||||
|
||||
## Features
|
||||
|
||||
* All strings are stored in memory for fast lookup
|
||||
* Fast loading of MO files
|
||||
* Low level API for reading MO files
|
||||
* Emulation of Gettext API
|
||||
* No use of `eval()` for plural equation
|
||||
|
||||
## Limitations
|
||||
|
||||
* Default `InMemoryCache` not suitable for huge MO files which you don't want to store in memory
|
||||
* Input and output encoding has to match (preferably UTF-8)
|
||||
|
||||
## Installation
|
||||
|
||||
Please use [Composer][1] to install:
|
||||
|
||||
```sh
|
||||
composer require phpmyadmin/motranslator
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The API documentation is available at <https://develdocs.phpmyadmin.net/motranslator/>.
|
||||
|
||||
## Object API usage
|
||||
|
||||
```php
|
||||
// Create loader object
|
||||
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||
|
||||
// Set locale
|
||||
$loader->setlocale('cs');
|
||||
|
||||
// Set default text domain
|
||||
$loader->textdomain('domain');
|
||||
|
||||
// Set path where to look for a domain
|
||||
$loader->bindtextdomain('domain', __DIR__ . '/data/locale/');
|
||||
|
||||
// Get translator
|
||||
$translator = $loader->getTranslator();
|
||||
|
||||
// Now you can use Translator API (see below)
|
||||
```
|
||||
|
||||
## Low level API usage
|
||||
|
||||
```php
|
||||
// Directly load the mo file
|
||||
// You can use null to not load a file and the use a setter to set the translations
|
||||
$cache = new PhpMyAdmin\MoTranslator\Cache\InMemoryCache(new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'));
|
||||
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||
|
||||
// Now you can use Translator API (see below)
|
||||
```
|
||||
|
||||
## Translator API usage
|
||||
|
||||
```php
|
||||
// Translate string
|
||||
echo $translator->gettext('String');
|
||||
|
||||
// Translate plural string
|
||||
echo $translator->ngettext('String', 'Plural string', $count);
|
||||
|
||||
// Translate string with context
|
||||
echo $translator->pgettext('Context', 'String');
|
||||
|
||||
// Translate plural string with context
|
||||
echo $translator->npgettext('Context', 'String', 'Plural string', $count);
|
||||
|
||||
// Get the translations
|
||||
echo $translator->getTranslations();
|
||||
|
||||
// All getters and setters below are more to be used if you are using a manual loading mode
|
||||
// Example: $translator = new PhpMyAdmin\MoTranslator\Translator(null);
|
||||
|
||||
// Set a translation
|
||||
echo $translator->setTranslation('Test', 'Translation for "Test" key');
|
||||
|
||||
// Set translations
|
||||
echo $translator->setTranslations([
|
||||
'Test' => 'Translation for "Test" key',
|
||||
'Test 2' => 'Translation for "Test 2" key',
|
||||
]);
|
||||
|
||||
// Use the translation
|
||||
echo $translator->gettext('Test 2'); // -> Translation for "Test 2" key
|
||||
```
|
||||
|
||||
## Gettext compatibility usage
|
||||
|
||||
```php
|
||||
// Load compatibility layer
|
||||
PhpMyAdmin\MoTranslator\Loader::loadFunctions();
|
||||
|
||||
// Configure
|
||||
_setlocale(LC_MESSAGES, 'cs');
|
||||
_textdomain('phpmyadmin');
|
||||
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
|
||||
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
|
||||
|
||||
// Use functions
|
||||
echo _gettext('Type');
|
||||
echo __('Type');
|
||||
|
||||
// It also support other Gettext functions
|
||||
_dnpgettext($domain, $msgctxt, $msgid, $msgidPlural, $number);
|
||||
_dngettext($domain, $msgid, $msgidPlural, $number);
|
||||
_npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||
_ngettext($msgid, $msgidPlural, $number);
|
||||
_dpgettext($domain, $msgctxt, $msgid);
|
||||
_dgettext($domain, $msgid);
|
||||
_pgettext($msgctxt, $msgid);
|
||||
```
|
||||
|
||||
## Using APCu-backed cache
|
||||
|
||||
If you have the [APCu][5] extension installed you can use it for storing the translation cache. The `.mo` file
|
||||
will then only be loaded once and all processes will share the same cache, reducing memory usage and resulting in
|
||||
performance comparable to the native `gettext` extension.
|
||||
|
||||
If you are using `Loader`, pass it an `ApcuCacheFactory` _before_ getting the translator instance:
|
||||
|
||||
```php
|
||||
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
|
||||
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory()
|
||||
);
|
||||
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||
|
||||
// Proceed as before
|
||||
```
|
||||
|
||||
If you are using the low level API, instantiate the `ApcuCache` directly:
|
||||
|
||||
```php
|
||||
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
|
||||
'de_DE', // the locale
|
||||
'phpmyadmin' // the domain
|
||||
);
|
||||
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||
|
||||
// Proceed as before
|
||||
```
|
||||
|
||||
By default, APCu will cache the translations until next server restart and prefix the cache entries with `mo_` to
|
||||
avoid clashes with other cache entries. You can control this behaviour by passing `$ttl` and `$prefix` arguments, either
|
||||
to the `ApcuCacheFactory` or when instantiating `ApcuCache`:
|
||||
|
||||
```php
|
||||
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
|
||||
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory(
|
||||
3600, // cache for 1 hour
|
||||
true, // reload on cache miss
|
||||
'custom_' // custom prefix for cache entries
|
||||
)
|
||||
);
|
||||
$loader = new PhpMyAdmin\MoTranslator\Loader();
|
||||
|
||||
// or...
|
||||
|
||||
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
|
||||
'de_DE',
|
||||
'phpmyadmin',
|
||||
3600, // cache for 1 hour
|
||||
true, // reload on cache miss
|
||||
'custom_' // custom prefix for cache entries
|
||||
);
|
||||
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
|
||||
```
|
||||
|
||||
If you receive updated translation files you can load them without restarting the server using the low-level API:
|
||||
|
||||
```php
|
||||
$parser = new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo');
|
||||
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache($parser, 'de_DE', 'phpmyadmin');
|
||||
$parser->parseIntoCache($cache);
|
||||
```
|
||||
|
||||
You should ensure APCu has enough memory to store all your translations, along with any other entries you use it
|
||||
for. If an entry is evicted from cache, the `.mo` file will be re-parsed, impacting performance. See the
|
||||
`apc.shm_size` and `apc.shm_segments` [documentation][6] and monitor cache usage when first rolling out.
|
||||
|
||||
If your `.mo` files are missing lots of translations, the first time a missing entry is requested the `.mo` file
|
||||
will be re-parsed. Again, this will impact performance until all the missing entries are hit once. You can turn off this
|
||||
behaviour by setting the `$reloadOnMiss` argument to `false`. If you do this it is _critical_ that APCu has enough
|
||||
memory, or users will see untranslated text when entries are evicted.
|
||||
|
||||
## History
|
||||
|
||||
This library is based on [php-gettext][2]. It adds some performance
|
||||
improvements and ability to install using [Composer][1].
|
||||
|
||||
## Motivation
|
||||
|
||||
Motivation for this library includes:
|
||||
|
||||
* The [php-gettext][2] library is not maintained anymore
|
||||
* It doesn't work with recent PHP version (phpMyAdmin has patched version)
|
||||
* It relies on `eval()` function for plural equations what can have severe security implications, see [CVE-2016-6175][4]
|
||||
* It's not possible to install it using [Composer][1]
|
||||
* There was place for performance improvements in the library
|
||||
|
||||
### Why not to use native gettext in PHP?
|
||||
|
||||
We've tried that, but it's not a viable solution:
|
||||
|
||||
* You can not use locales not known to system, what is something you can not
|
||||
control from web application. This gets even more tricky with minimalist
|
||||
virtualisation containers.
|
||||
* Changing the MO file usually leads to PHP segmentation fault. It (or rather
|
||||
Gettext library) caches headers of MO file and if it's content is changed
|
||||
(for example new version is uploaded to server) it tries to access new data
|
||||
with old references. This is bug known for ages:
|
||||
https://bugs.php.net/bug.php?id=45943
|
||||
|
||||
### Why use Gettext and not JSON, YAML or whatever?
|
||||
|
||||
We want translators to be able to use their favorite tools and we want us to be
|
||||
able to use wide range of tools available with Gettext as well such as
|
||||
[web based translation using Weblate][3]. Using custom format usually adds
|
||||
another barrier for translators and we want to make it easy for them to
|
||||
contribute.
|
||||
|
||||
[1]:https://getcomposer.org/
|
||||
[2]:https://launchpad.net/php-gettext
|
||||
[3]:https://weblate.org/
|
||||
[4]: https://www.cve.org/CVERecord?id=CVE-2016-6175
|
||||
[5]:https://www.php.net/manual/en/book.apcu.php
|
||||
[6]:https://www.php.net/manual/en/apcu.configuration.php
|
||||
29
pma/vendor/phpmyadmin/motranslator/benchmark-apcu.php
vendored
Normal file
29
pma/vendor/phpmyadmin/motranslator/benchmark-apcu.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require './vendor/autoload.php';
|
||||
|
||||
$files = [
|
||||
'big' => './tests/data/big.mo',
|
||||
'little' => './tests/data/little.mo',
|
||||
];
|
||||
|
||||
$start = microtime(true);
|
||||
|
||||
for ($i = 0; $i < 2000; ++$i) {
|
||||
foreach ($files as $domain => $filename) {
|
||||
$translator = new PhpMyAdmin\MoTranslator\Translator(
|
||||
new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
|
||||
new PhpMyAdmin\MoTranslator\MoParser($filename), 'foo', $domain
|
||||
)
|
||||
);
|
||||
$translator->gettext('Column');
|
||||
}
|
||||
}
|
||||
|
||||
$end = microtime(true);
|
||||
|
||||
$diff = $end - $start;
|
||||
|
||||
echo 'Execution took ' . $diff . ' seconds' . "\n";
|
||||
56
pma/vendor/phpmyadmin/motranslator/composer.json
vendored
Normal file
56
pma/vendor/phpmyadmin/motranslator/composer.json
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "phpmyadmin/motranslator",
|
||||
"description": "Translation API for PHP using Gettext MO files",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"keywords": ["gettext", "mo", "translator", "i18n"],
|
||||
"homepage": "https://github.com/phpmyadmin/motranslator",
|
||||
"authors": [
|
||||
{
|
||||
"name": "The phpMyAdmin Team",
|
||||
"email": "developers@phpmyadmin.net",
|
||||
"homepage": "https://www.phpmyadmin.net/team/"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpmyadmin/motranslator/issues",
|
||||
"source": "https://github.com/phpmyadmin/motranslator"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcbf": "@php phpcbf",
|
||||
"phpcs": "@php phpcs",
|
||||
"phpstan": "@php phpstan",
|
||||
"phpunit": "@php phpunit",
|
||||
"test": [
|
||||
"@phpcs",
|
||||
"@phpstan",
|
||||
"@phpunit"
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.4 || ^8 || ^9",
|
||||
"phpmyadmin/coding-standard": "^3.0.0",
|
||||
"phpstan/phpstan": "^1.4.6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\MoTranslator\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\MoTranslator\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"ext-apcu": "Needed for ACPu-backed translation cache"
|
||||
}
|
||||
}
|
||||
136
pma/vendor/phpmyadmin/motranslator/src/Cache/ApcuCache.php
vendored
Normal file
136
pma/vendor/phpmyadmin/motranslator/src/Cache/ApcuCache.php
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\CacheException;
|
||||
use PhpMyAdmin\MoTranslator\MoParser;
|
||||
|
||||
use function apcu_enabled;
|
||||
use function apcu_entry;
|
||||
use function apcu_exists;
|
||||
use function apcu_fetch;
|
||||
use function apcu_store;
|
||||
use function array_combine;
|
||||
use function array_keys;
|
||||
use function array_map;
|
||||
use function assert;
|
||||
use function function_exists;
|
||||
use function is_array;
|
||||
use function is_string;
|
||||
|
||||
final class ApcuCache implements CacheInterface
|
||||
{
|
||||
public const LOADED_KEY = '__TRANSLATIONS_LOADED__';
|
||||
|
||||
/** @var MoParser */
|
||||
private $parser;
|
||||
/** @var string */
|
||||
private $locale;
|
||||
/** @var string */
|
||||
private $domain;
|
||||
/** @var int */
|
||||
private $ttl;
|
||||
/** @var bool */
|
||||
private $reloadOnMiss;
|
||||
/** @var string */
|
||||
private $prefix;
|
||||
|
||||
public function __construct(
|
||||
MoParser $parser,
|
||||
string $locale,
|
||||
string $domain,
|
||||
int $ttl = 0,
|
||||
bool $reloadOnMiss = true,
|
||||
string $prefix = 'mo_'
|
||||
) {
|
||||
if (! (function_exists('apcu_enabled') && apcu_enabled())) {
|
||||
throw new CacheException('ACPu extension must be installed and enabled');
|
||||
}
|
||||
|
||||
$this->parser = $parser;
|
||||
$this->locale = $locale;
|
||||
$this->domain = $domain;
|
||||
$this->ttl = $ttl;
|
||||
$this->reloadOnMiss = $reloadOnMiss;
|
||||
$this->prefix = $prefix;
|
||||
|
||||
$this->ensureTranslationsLoaded();
|
||||
}
|
||||
|
||||
public function get(string $msgid): string
|
||||
{
|
||||
$msgstr = apcu_fetch($this->getKey($msgid), $success);
|
||||
if ($success && is_string($msgstr)) {
|
||||
return $msgstr;
|
||||
}
|
||||
|
||||
if (! $this->reloadOnMiss) {
|
||||
return $msgid;
|
||||
}
|
||||
|
||||
return $this->reloadOnMiss($msgid);
|
||||
}
|
||||
|
||||
private function reloadOnMiss(string $msgid): string
|
||||
{
|
||||
// store original if translation is not present
|
||||
$cached = apcu_entry($this->getKey($msgid), static function () use ($msgid) {
|
||||
return $msgid;
|
||||
}, $this->ttl);
|
||||
// if another process has updated cache, return early
|
||||
if ($cached !== $msgid && is_string($cached)) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
// reload .mo file, in case entry has been evicted
|
||||
$this->parser->parseIntoCache($this);
|
||||
|
||||
$msgstr = apcu_fetch($this->getKey($msgid), $success);
|
||||
|
||||
return $success && is_string($msgstr) ? $msgstr : $msgid;
|
||||
}
|
||||
|
||||
public function set(string $msgid, string $msgstr): void
|
||||
{
|
||||
apcu_store($this->getKey($msgid), $msgstr, $this->ttl);
|
||||
}
|
||||
|
||||
public function has(string $msgid): bool
|
||||
{
|
||||
return apcu_exists($this->getKey($msgid));
|
||||
}
|
||||
|
||||
public function setAll(array $translations): void
|
||||
{
|
||||
$keys = array_map(function (string $msgid): string {
|
||||
return $this->getKey($msgid);
|
||||
}, array_keys($translations));
|
||||
$translations = array_combine($keys, $translations);
|
||||
assert(is_array($translations));
|
||||
|
||||
apcu_store($translations, null, $this->ttl);
|
||||
}
|
||||
|
||||
private function getKey(string $msgid): string
|
||||
{
|
||||
return $this->prefix . $this->locale . '.' . $this->domain . '.' . $msgid;
|
||||
}
|
||||
|
||||
private function ensureTranslationsLoaded(): void
|
||||
{
|
||||
// Try to prevent cache slam if multiple processes are trying to load translations. There is still a race
|
||||
// between the exists check and creating the entry, but at least it's small
|
||||
$key = $this->getKey(self::LOADED_KEY);
|
||||
$loaded = apcu_exists($key) || apcu_entry($key, static function (): int {
|
||||
return 0;
|
||||
}, $this->ttl);
|
||||
if ($loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->parser->parseIntoCache($this);
|
||||
apcu_store($this->getKey(self::LOADED_KEY), 1, $this->ttl);
|
||||
}
|
||||
}
|
||||
29
pma/vendor/phpmyadmin/motranslator/src/Cache/ApcuCacheFactory.php
vendored
Normal file
29
pma/vendor/phpmyadmin/motranslator/src/Cache/ApcuCacheFactory.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\MoParser;
|
||||
|
||||
final class ApcuCacheFactory implements CacheFactoryInterface
|
||||
{
|
||||
/** @var int */
|
||||
private $ttl;
|
||||
/** @var bool */
|
||||
private $reloadOnMiss;
|
||||
/** @var string */
|
||||
private $prefix;
|
||||
|
||||
public function __construct(int $ttl = 0, bool $reloadOnMiss = true, string $prefix = 'mo_')
|
||||
{
|
||||
$this->ttl = $ttl;
|
||||
$this->reloadOnMiss = $reloadOnMiss;
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface
|
||||
{
|
||||
return new ApcuCache($parser, $locale, $domain, $this->ttl, $this->reloadOnMiss, $this->prefix);
|
||||
}
|
||||
}
|
||||
12
pma/vendor/phpmyadmin/motranslator/src/Cache/CacheFactoryInterface.php
vendored
Normal file
12
pma/vendor/phpmyadmin/motranslator/src/Cache/CacheFactoryInterface.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\MoParser;
|
||||
|
||||
interface CacheFactoryInterface
|
||||
{
|
||||
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface;
|
||||
}
|
||||
33
pma/vendor/phpmyadmin/motranslator/src/Cache/CacheInterface.php
vendored
Normal file
33
pma/vendor/phpmyadmin/motranslator/src/Cache/CacheInterface.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
interface CacheInterface
|
||||
{
|
||||
/**
|
||||
* Returns cached `msgstr` if it is in cache, otherwise `$msgid`
|
||||
*/
|
||||
public function get(string $msgid): string;
|
||||
|
||||
/**
|
||||
* Caches `$msgstr` value for key `$mesid`
|
||||
*/
|
||||
public function set(string $msgid, string $msgstr): void;
|
||||
|
||||
/**
|
||||
* Returns true if cache has entry for `$msgid`
|
||||
*/
|
||||
public function has(string $msgid): bool;
|
||||
|
||||
/**
|
||||
* Populates cache with array of `$msgid => $msgstr` entries
|
||||
*
|
||||
* This will overwrite existing values for `$msgid`, but is not guaranteed to clear cache of existing entries
|
||||
* not present in `$translations`.
|
||||
*
|
||||
* @param array<string, string> $translations
|
||||
*/
|
||||
public function setAll(array $translations): void;
|
||||
}
|
||||
13
pma/vendor/phpmyadmin/motranslator/src/Cache/GetAllInterface.php
vendored
Normal file
13
pma/vendor/phpmyadmin/motranslator/src/Cache/GetAllInterface.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
interface GetAllInterface
|
||||
{
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getAll(): array;
|
||||
}
|
||||
49
pma/vendor/phpmyadmin/motranslator/src/Cache/InMemoryCache.php
vendored
Normal file
49
pma/vendor/phpmyadmin/motranslator/src/Cache/InMemoryCache.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator\Cache;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\MoParser;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
final class InMemoryCache implements CacheInterface, GetAllInterface
|
||||
{
|
||||
/** @var array<string, string> */
|
||||
private $cache;
|
||||
|
||||
public function __construct(MoParser $parser)
|
||||
{
|
||||
$this->cache = [];
|
||||
$parser->parseIntoCache($this);
|
||||
}
|
||||
|
||||
public function get(string $msgid): string
|
||||
{
|
||||
return array_key_exists($msgid, $this->cache) ? $this->cache[$msgid] : $msgid;
|
||||
}
|
||||
|
||||
public function set(string $msgid, string $msgstr): void
|
||||
{
|
||||
$this->cache[$msgid] = $msgstr;
|
||||
}
|
||||
|
||||
public function has(string $msgid): bool
|
||||
{
|
||||
return array_key_exists($msgid, $this->cache);
|
||||
}
|
||||
|
||||
public function setAll(array $translations): void
|
||||
{
|
||||
$this->cache = $translations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
return $this->cache;
|
||||
}
|
||||
}
|
||||
11
pma/vendor/phpmyadmin/motranslator/src/CacheException.php
vendored
Normal file
11
pma/vendor/phpmyadmin/motranslator/src/CacheException.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use DomainException;
|
||||
|
||||
final class CacheException extends DomainException
|
||||
{
|
||||
}
|
||||
318
pma/vendor/phpmyadmin/motranslator/src/Loader.php
vendored
Normal file
318
pma/vendor/phpmyadmin/motranslator/src/Loader.php
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
|
||||
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
|
||||
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||
|
||||
This file is part of MoTranslator.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
|
||||
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||
|
||||
use function array_push;
|
||||
use function file_exists;
|
||||
use function getenv;
|
||||
use function in_array;
|
||||
use function preg_match;
|
||||
use function sprintf;
|
||||
|
||||
class Loader
|
||||
{
|
||||
/**
|
||||
* Loader instance.
|
||||
*
|
||||
* @static
|
||||
* @var Loader
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Factory to return a factory responsible for returning a `CacheInterface`
|
||||
*
|
||||
* @static
|
||||
* @var CacheFactoryInterface|null
|
||||
*/
|
||||
private static $cacheFactory = null;
|
||||
|
||||
/**
|
||||
* Default gettext domain to use.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $defaultDomain = '';
|
||||
|
||||
/**
|
||||
* Configured locale.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $locale = '';
|
||||
|
||||
/**
|
||||
* Loaded domains.
|
||||
*
|
||||
* @var array<string,array<string,Translator>>
|
||||
*/
|
||||
private $domains = [];
|
||||
|
||||
/**
|
||||
* Bound paths for domains.
|
||||
*
|
||||
* @var array<string,string>
|
||||
*/
|
||||
private $paths = ['' => './'];
|
||||
|
||||
/**
|
||||
* Returns the singleton Loader object.
|
||||
*
|
||||
* @return Loader object
|
||||
*/
|
||||
public static function getInstance(): Loader
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads global localization functions.
|
||||
*/
|
||||
public static function loadFunctions(): void
|
||||
{
|
||||
require_once __DIR__ . '/functions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out all possible locale names and start with the most
|
||||
* specific ones. I.e. for sr_CS.UTF-8@latin, look through all of
|
||||
* sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.
|
||||
*
|
||||
* @param string $locale Locale code
|
||||
*
|
||||
* @return string[] list of locales to try for any POSIX-style locale specification
|
||||
*/
|
||||
public static function listLocales(string $locale): array
|
||||
{
|
||||
$localeNames = [];
|
||||
|
||||
if ($locale) {
|
||||
if (
|
||||
preg_match(
|
||||
'/^(?P<lang>[a-z]{2,3})' // language code
|
||||
. '(?:_(?P<country>[A-Z]{2}))?' // country code
|
||||
. '(?:\\.(?P<charset>[-A-Za-z0-9_]+))?' // charset
|
||||
. '(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/', // @ modifier
|
||||
$locale,
|
||||
$matches
|
||||
)
|
||||
) {
|
||||
$lang = $matches['lang'] ?? null;
|
||||
$country = $matches['country'] ?? null;
|
||||
$charset = $matches['charset'] ?? null;
|
||||
$modifier = $matches['modifier'] ?? null;
|
||||
|
||||
if ($modifier) {
|
||||
if ($country) {
|
||||
if ($charset) {
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s_%s.%s@%s', $lang, $country, $charset, $modifier)
|
||||
);
|
||||
}
|
||||
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s_%s@%s', $lang, $country, $modifier)
|
||||
);
|
||||
} elseif ($charset) {
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s.%s@%s', $lang, $charset, $modifier)
|
||||
);
|
||||
}
|
||||
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s@%s', $lang, $modifier)
|
||||
);
|
||||
}
|
||||
|
||||
if ($country) {
|
||||
if ($charset) {
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s_%s.%s', $lang, $country, $charset)
|
||||
);
|
||||
}
|
||||
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s_%s', $lang, $country)
|
||||
);
|
||||
} elseif ($charset) {
|
||||
array_push(
|
||||
$localeNames,
|
||||
sprintf('%s.%s', $lang, $charset)
|
||||
);
|
||||
}
|
||||
|
||||
array_push($localeNames, $lang);
|
||||
}
|
||||
|
||||
// If the locale name doesn't match POSIX style, just include it as-is.
|
||||
if (! in_array($locale, $localeNames)) {
|
||||
array_push($localeNames, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
return $localeNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets factory responsible for composing a `CacheInterface`
|
||||
*/
|
||||
public static function setCacheFactory(?CacheFactoryInterface $cacheFactory): void
|
||||
{
|
||||
self::$cacheFactory = $cacheFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Translator object for domain or for default domain.
|
||||
*
|
||||
* @param string $domain Translation domain
|
||||
*/
|
||||
public function getTranslator(string $domain = ''): Translator
|
||||
{
|
||||
if (empty($domain)) {
|
||||
$domain = $this->defaultDomain;
|
||||
}
|
||||
|
||||
if (! isset($this->domains[$this->locale])) {
|
||||
$this->domains[$this->locale] = [];
|
||||
}
|
||||
|
||||
if (! isset($this->domains[$this->locale][$domain])) {
|
||||
if (isset($this->paths[$domain])) {
|
||||
$base = $this->paths[$domain];
|
||||
} else {
|
||||
$base = './';
|
||||
}
|
||||
|
||||
$localeNames = $this->listLocales($this->locale);
|
||||
|
||||
$filename = '';
|
||||
foreach ($localeNames as $locale) {
|
||||
$filename = $base . '/' . $locale . '/LC_MESSAGES/' . $domain . '.mo';
|
||||
if (file_exists($filename)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't care about invalid path, we will get fallback
|
||||
// translator here
|
||||
$moParser = new MoParser($filename);
|
||||
if (self::$cacheFactory instanceof CacheFactoryInterface) {
|
||||
$cache = self::$cacheFactory->getInstance($moParser, $this->locale, $domain);
|
||||
} else {
|
||||
$cache = new InMemoryCache($moParser);
|
||||
}
|
||||
|
||||
$this->domains[$this->locale][$domain] = new Translator($cache);
|
||||
}
|
||||
|
||||
return $this->domains[$this->locale][$domain];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the path for a domain.
|
||||
*
|
||||
* @param string $domain Domain name
|
||||
* @param string $path Path where to find locales
|
||||
*/
|
||||
public function bindtextdomain(string $domain, string $path): void
|
||||
{
|
||||
$this->paths[$domain] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default domain.
|
||||
*
|
||||
* @param string $domain Domain name
|
||||
*/
|
||||
public function textdomain(string $domain): void
|
||||
{
|
||||
$this->defaultDomain = $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a requested locale.
|
||||
*
|
||||
* @param string $locale Locale name
|
||||
*
|
||||
* @return string Set or current locale
|
||||
*/
|
||||
public function setlocale(string $locale): string
|
||||
{
|
||||
if (! empty($locale)) {
|
||||
$this->locale = $locale;
|
||||
}
|
||||
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects currently configured locale.
|
||||
*
|
||||
* It checks:
|
||||
*
|
||||
* - global lang variable
|
||||
* - environment for LC_ALL, LC_MESSAGES and LANG
|
||||
*
|
||||
* @return string with locale name
|
||||
*/
|
||||
public function detectlocale(): string
|
||||
{
|
||||
if (isset($GLOBALS['lang'])) {
|
||||
return $GLOBALS['lang'];
|
||||
}
|
||||
|
||||
$locale = getenv('LC_ALL');
|
||||
if ($locale !== false) {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
$locale = getenv('LC_MESSAGES');
|
||||
if ($locale !== false) {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
$locale = getenv('LANG');
|
||||
if ($locale !== false) {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
return 'en';
|
||||
}
|
||||
}
|
||||
109
pma/vendor/phpmyadmin/motranslator/src/MoParser.php
vendored
Normal file
109
pma/vendor/phpmyadmin/motranslator/src/MoParser.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||
|
||||
use function is_readable;
|
||||
use function strcmp;
|
||||
|
||||
final class MoParser
|
||||
{
|
||||
/**
|
||||
* None error.
|
||||
*/
|
||||
public const ERROR_NONE = 0;
|
||||
/**
|
||||
* File does not exist.
|
||||
*/
|
||||
public const ERROR_DOES_NOT_EXIST = 1;
|
||||
/**
|
||||
* File has bad magic number.
|
||||
*/
|
||||
public const ERROR_BAD_MAGIC = 2;
|
||||
/**
|
||||
* Error while reading file, probably too short.
|
||||
*/
|
||||
public const ERROR_READING = 3;
|
||||
|
||||
/**
|
||||
* Big endian mo file magic bytes.
|
||||
*/
|
||||
public const MAGIC_BE = "\x95\x04\x12\xde";
|
||||
/**
|
||||
* Little endian mo file magic bytes.
|
||||
*/
|
||||
public const MAGIC_LE = "\xde\x12\x04\x95";
|
||||
|
||||
/**
|
||||
* Parse error code (0 if no error).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $error = self::ERROR_NONE;
|
||||
|
||||
/** @var string|null */
|
||||
private $filename;
|
||||
|
||||
public function __construct(?string $filename)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses .mo file and stores results to `$cache`
|
||||
*/
|
||||
public function parseIntoCache(CacheInterface $cache): void
|
||||
{
|
||||
if ($this->filename === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! is_readable($this->filename)) {
|
||||
$this->error = self::ERROR_DOES_NOT_EXIST;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$stream = new StringReader($this->filename);
|
||||
|
||||
try {
|
||||
$magic = $stream->read(0, 4);
|
||||
if (strcmp($magic, self::MAGIC_LE) === 0) {
|
||||
$unpack = 'V';
|
||||
} elseif (strcmp($magic, self::MAGIC_BE) === 0) {
|
||||
$unpack = 'N';
|
||||
} else {
|
||||
$this->error = self::ERROR_BAD_MAGIC;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse header */
|
||||
$total = $stream->readint($unpack, 8);
|
||||
$originals = $stream->readint($unpack, 12);
|
||||
$translations = $stream->readint($unpack, 16);
|
||||
|
||||
/* get original and translations tables */
|
||||
$totalTimesTwo = (int) ($total * 2);// Fix for issue #36 on ARM
|
||||
$tableOriginals = $stream->readintarray($unpack, $originals, $totalTimesTwo);
|
||||
$tableTranslations = $stream->readintarray($unpack, $translations, $totalTimesTwo);
|
||||
|
||||
/* read all strings to the cache */
|
||||
for ($i = 0; $i < $total; ++$i) {
|
||||
$iTimesTwo = $i * 2;
|
||||
$iPlusOne = $iTimesTwo + 1;
|
||||
$iPlusTwo = $iTimesTwo + 2;
|
||||
$original = $stream->read($tableOriginals[$iPlusTwo], $tableOriginals[$iPlusOne]);
|
||||
$translation = $stream->read($tableTranslations[$iPlusTwo], $tableTranslations[$iPlusOne]);
|
||||
$cache->set($original, $translation);
|
||||
}
|
||||
} catch (ReaderException $e) {
|
||||
$this->error = self::ERROR_READING;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
pma/vendor/phpmyadmin/motranslator/src/ReaderException.php
vendored
Normal file
35
pma/vendor/phpmyadmin/motranslator/src/ReaderException.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||
|
||||
This file is part of MoTranslator.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when file can not be read.
|
||||
*/
|
||||
class ReaderException extends Exception
|
||||
{
|
||||
}
|
||||
116
pma/vendor/phpmyadmin/motranslator/src/StringReader.php
vendored
Normal file
116
pma/vendor/phpmyadmin/motranslator/src/StringReader.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||
|
||||
This file is part of MoTranslator.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use function file_get_contents;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use function unpack;
|
||||
|
||||
use const PHP_INT_MAX;
|
||||
|
||||
/**
|
||||
* Simple wrapper around string buffer for
|
||||
* random access and values parsing.
|
||||
*/
|
||||
class StringReader
|
||||
{
|
||||
/** @var string */
|
||||
private $string;
|
||||
/** @var int */
|
||||
private $length;
|
||||
|
||||
/**
|
||||
* @param string $filename Name of file to load
|
||||
*/
|
||||
public function __construct(string $filename)
|
||||
{
|
||||
$this->string = (string) file_get_contents($filename);
|
||||
$this->length = strlen($this->string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read number of bytes from given offset.
|
||||
*
|
||||
* @param int $pos Offset
|
||||
* @param int $bytes Number of bytes to read
|
||||
*/
|
||||
public function read(int $pos, int $bytes): string
|
||||
{
|
||||
if ($pos + $bytes > $this->length) {
|
||||
throw new ReaderException('Not enough bytes!');
|
||||
}
|
||||
|
||||
$data = substr($this->string, $pos, $bytes);
|
||||
|
||||
return $data === false ? '' : $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a 32bit integer from the stream.
|
||||
*
|
||||
* @param string $unpack Unpack string
|
||||
* @param int $pos Position
|
||||
*
|
||||
* @return int Integer from the stream
|
||||
*/
|
||||
public function readint(string $unpack, int $pos): int
|
||||
{
|
||||
$data = unpack($unpack, $this->read($pos, 4));
|
||||
if ($data === false) {
|
||||
return PHP_INT_MAX;
|
||||
}
|
||||
|
||||
$result = $data[1];
|
||||
|
||||
/* We're reading unsigned int, but PHP will happily
|
||||
* give us negative number on 32-bit platforms.
|
||||
*
|
||||
* See also documentation:
|
||||
* https://secure.php.net/manual/en/function.unpack.php#refsect1-function.unpack-notes
|
||||
*/
|
||||
return $result < 0 ? PHP_INT_MAX : $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an array of integers from the stream.
|
||||
*
|
||||
* @param string $unpack Unpack string
|
||||
* @param int $pos Position
|
||||
* @param int $count How many elements should be read
|
||||
*
|
||||
* @return int[] Array of Integers
|
||||
*/
|
||||
public function readintarray(string $unpack, int $pos, int $count): array
|
||||
{
|
||||
$data = unpack($unpack . $count, $this->read($pos, 4 * $count));
|
||||
if ($data === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
388
pma/vendor/phpmyadmin/motranslator/src/Translator.php
vendored
Normal file
388
pma/vendor/phpmyadmin/motranslator/src/Translator.php
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
|
||||
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
||||
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||
|
||||
This file is part of MoTranslator.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\MoTranslator;
|
||||
|
||||
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
|
||||
use PhpMyAdmin\MoTranslator\Cache\GetAllInterface;
|
||||
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||
use Throwable;
|
||||
|
||||
use function chr;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function get_class;
|
||||
use function implode;
|
||||
use function intval;
|
||||
use function ltrim;
|
||||
use function preg_replace;
|
||||
use function rtrim;
|
||||
use function sprintf;
|
||||
use function stripos;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
use function substr;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Provides a simple gettext replacement that works independently from
|
||||
* the system's gettext abilities.
|
||||
* It can read MO files and use them for translating strings.
|
||||
*
|
||||
* It caches ll strings and translations to speed up the string lookup.
|
||||
*/
|
||||
class Translator
|
||||
{
|
||||
/**
|
||||
* None error.
|
||||
*/
|
||||
public const ERROR_NONE = 0;
|
||||
/**
|
||||
* File does not exist.
|
||||
*/
|
||||
public const ERROR_DOES_NOT_EXIST = 1;
|
||||
/**
|
||||
* File has bad magic number.
|
||||
*/
|
||||
public const ERROR_BAD_MAGIC = 2;
|
||||
/**
|
||||
* Error while reading file, probably too short.
|
||||
*/
|
||||
public const ERROR_READING = 3;
|
||||
|
||||
/**
|
||||
* Big endian mo file magic bytes.
|
||||
*/
|
||||
public const MAGIC_BE = "\x95\x04\x12\xde";
|
||||
/**
|
||||
* Little endian mo file magic bytes.
|
||||
*/
|
||||
public const MAGIC_LE = "\xde\x12\x04\x95";
|
||||
|
||||
/**
|
||||
* Parse error code (0 if no error).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $error = self::ERROR_NONE;
|
||||
|
||||
/**
|
||||
* Cache header field for plural forms.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $pluralEquation = null;
|
||||
|
||||
/** @var ExpressionLanguage|null Evaluator for plurals */
|
||||
private $pluralExpression = null;
|
||||
|
||||
/** @var int|null number of plurals */
|
||||
private $pluralCount = null;
|
||||
|
||||
/** @var CacheInterface */
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation
|
||||
*/
|
||||
public function __construct($cache)
|
||||
{
|
||||
if (! $cache instanceof CacheInterface) {
|
||||
$cache = new InMemoryCache(new MoParser($cache));
|
||||
}
|
||||
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a string.
|
||||
*
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
public function gettext(string $msgid): string
|
||||
{
|
||||
return $this->cache->get($msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is translated.
|
||||
*
|
||||
* @param string $msgid String to be checked
|
||||
*/
|
||||
public function exists(string $msgid): bool
|
||||
{
|
||||
return $this->cache->has($msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize plural form expression for use in ExpressionLanguage.
|
||||
*
|
||||
* @param string $expr Expression to sanitize
|
||||
*
|
||||
* @return string sanitized plural form expression
|
||||
*/
|
||||
public static function sanitizePluralExpression(string $expr): string
|
||||
{
|
||||
// Parse equation
|
||||
$expr = explode(';', $expr);
|
||||
if (count($expr) >= 2) {
|
||||
$expr = $expr[1];
|
||||
} else {
|
||||
$expr = $expr[0];
|
||||
}
|
||||
|
||||
$expr = trim(strtolower($expr));
|
||||
// Strip plural prefix
|
||||
if (substr($expr, 0, 6) === 'plural') {
|
||||
$expr = ltrim(substr($expr, 6));
|
||||
}
|
||||
|
||||
// Strip equals
|
||||
if (substr($expr, 0, 1) === '=') {
|
||||
$expr = ltrim(substr($expr, 1));
|
||||
}
|
||||
|
||||
// Cleanup from unwanted chars
|
||||
$expr = preg_replace('@[^n0-9:\(\)\?=!<>/%&| ]@', '', $expr);
|
||||
|
||||
return (string) $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts number of plurals from plurals form expression.
|
||||
*
|
||||
* @param string $expr Expression to process
|
||||
*
|
||||
* @return int Total number of plurals
|
||||
*/
|
||||
public static function extractPluralCount(string $expr): int
|
||||
{
|
||||
$parts = explode(';', $expr, 2);
|
||||
$nplurals = explode('=', trim($parts[0]), 2);
|
||||
if (strtolower(rtrim($nplurals[0])) !== 'nplurals') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (count($nplurals) === 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return intval($nplurals[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse full PO header and extract only plural forms line.
|
||||
*
|
||||
* @param string $header Gettext header
|
||||
*
|
||||
* @return string verbatim plural form header field
|
||||
*/
|
||||
public static function extractPluralsForms(string $header): string
|
||||
{
|
||||
$headers = explode("\n", $header);
|
||||
$expr = 'nplurals=2; plural=n == 1 ? 0 : 1;';
|
||||
foreach ($headers as $header) {
|
||||
if (stripos($header, 'Plural-Forms:') !== 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$expr = substr($header, 13);
|
||||
}
|
||||
|
||||
return $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible plural forms from MO header.
|
||||
*
|
||||
* @return string plural form header
|
||||
*/
|
||||
private function getPluralForms(): string
|
||||
{
|
||||
// lets assume message number 0 is header
|
||||
// this is true, right?
|
||||
|
||||
// cache header field for plural forms
|
||||
if ($this->pluralEquation === null) {
|
||||
$header = $this->cache->get('');
|
||||
|
||||
$expr = $this->extractPluralsForms($header);
|
||||
$this->pluralEquation = $this->sanitizePluralExpression($expr);
|
||||
$this->pluralCount = $this->extractPluralCount($expr);
|
||||
}
|
||||
|
||||
return $this->pluralEquation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects which plural form to take.
|
||||
*
|
||||
* @param int $n count of objects
|
||||
*
|
||||
* @return int array index of the right plural form
|
||||
*/
|
||||
private function selectString(int $n): int
|
||||
{
|
||||
if ($this->pluralExpression === null) {
|
||||
$this->pluralExpression = new ExpressionLanguage();
|
||||
}
|
||||
|
||||
try {
|
||||
$plural = (int) $this->pluralExpression->evaluate(
|
||||
$this->getPluralForms(),
|
||||
['n' => $n]
|
||||
);
|
||||
} catch (Throwable $e) {
|
||||
$plural = 0;
|
||||
}
|
||||
|
||||
if ($plural >= $this->pluralCount) {
|
||||
$plural = $this->pluralCount - 1;
|
||||
}
|
||||
|
||||
return $plural;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of gettext.
|
||||
*
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
public function ngettext(string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
// this should contains all strings separated by NULLs
|
||||
$key = implode(chr(0), [$msgid, $msgidPlural]);
|
||||
if (! $this->cache->has($key)) {
|
||||
return $number !== 1 ? $msgidPlural : $msgid;
|
||||
}
|
||||
|
||||
$result = $this->cache->get($key);
|
||||
|
||||
// find out the appropriate form
|
||||
$select = $this->selectString($number);
|
||||
|
||||
$list = explode(chr(0), $result);
|
||||
// @codeCoverageIgnoreStart
|
||||
if ($list === false) {
|
||||
// This was added in 3ff2c63bcf85f81b3a205ce7222de11b33e2bf56 for phpstan
|
||||
// But according to the php manual it should never happen
|
||||
return '';
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
if (! isset($list[$select])) {
|
||||
return $list[0];
|
||||
}
|
||||
|
||||
return $list[$select];
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate with context.
|
||||
*
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
public function pgettext(string $msgctxt, string $msgid): string
|
||||
{
|
||||
$key = implode(chr(4), [$msgctxt, $msgid]);
|
||||
$ret = $this->gettext($key);
|
||||
if (strpos($ret, chr(4)) !== false) {
|
||||
return $msgid;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of pgettext.
|
||||
*
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
public function npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
$key = implode(chr(4), [$msgctxt, $msgid]);
|
||||
$ret = $this->ngettext($key, $msgidPlural, $number);
|
||||
if (strpos($ret, chr(4)) !== false) {
|
||||
return $msgid;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set translation in place
|
||||
*
|
||||
* @param string $msgid String to be set
|
||||
* @param string $msgstr Translation
|
||||
*/
|
||||
public function setTranslation(string $msgid, string $msgstr): void
|
||||
{
|
||||
$this->cache->set($msgid, $msgstr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the translations
|
||||
*
|
||||
* @param array<string,string> $translations The translations "key => value" array
|
||||
*/
|
||||
public function setTranslations(array $translations): void
|
||||
{
|
||||
$this->cache->setAll($translations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the translations
|
||||
*
|
||||
* @return array<string,string> The translations "key => value" array
|
||||
*/
|
||||
public function getTranslations(): array
|
||||
{
|
||||
if ($this->cache instanceof GetAllInterface) {
|
||||
return $this->cache->getAll();
|
||||
}
|
||||
|
||||
throw new CacheException(sprintf(
|
||||
"Cache '%s' does not support getting translations",
|
||||
get_class($this->cache)
|
||||
));
|
||||
}
|
||||
}
|
||||
200
pma/vendor/phpmyadmin/motranslator/src/functions.php
vendored
Normal file
200
pma/vendor/phpmyadmin/motranslator/src/functions.php
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
|
||||
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
|
||||
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
|
||||
|
||||
This file is part of MoTranslator.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
use PhpMyAdmin\MoTranslator\Loader;
|
||||
|
||||
/**
|
||||
* Sets a requested locale.
|
||||
*
|
||||
* @param int $category Locale category, ignored
|
||||
* @param string $locale Locale name
|
||||
*
|
||||
* @return string Set or current locale
|
||||
*/
|
||||
function _setlocale(int $category, string $locale): string
|
||||
{
|
||||
return Loader::getInstance()->setlocale($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the path for a domain.
|
||||
*
|
||||
* @param string $domain Domain name
|
||||
* @param string $path Path where to find locales
|
||||
*/
|
||||
function _bindtextdomain(string $domain, string $path): void
|
||||
{
|
||||
Loader::getInstance()->bindtextdomain($domain, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy compatibility function, MoTranslator assumes
|
||||
* everything is using same character set on input and
|
||||
* output.
|
||||
*
|
||||
* Generally it is wise to output in UTF-8 and have
|
||||
* mo files in UTF-8.
|
||||
*
|
||||
* @param string $domain Domain where to set character set
|
||||
* @param string $codeset Character set to set
|
||||
*/
|
||||
function _bind_textdomain_codeset($domain, $codeset): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default domain.
|
||||
*
|
||||
* @param string $domain Domain name
|
||||
*/
|
||||
function _textdomain(string $domain): void
|
||||
{
|
||||
Loader::getInstance()->textdomain($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a string.
|
||||
*
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
function _gettext(string $msgid): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator()->gettext($msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a string, alias for _gettext.
|
||||
*
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
function __(string $msgid): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator()->gettext($msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of gettext.
|
||||
*
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _ngettext(string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator()->ngettext($msgid, $msgidPlural, $number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate with context.
|
||||
*
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _pgettext(string $msgctxt, string $msgid): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator()->pgettext($msgctxt, $msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of pgettext.
|
||||
*
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator()->npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates a string.
|
||||
*
|
||||
* @param string $domain Domain to use
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated string (or original, if not found)
|
||||
*/
|
||||
function _dgettext(string $domain, string $msgid): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator($domain)->gettext($msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of gettext.
|
||||
*
|
||||
* @param string $domain Domain to use
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _dngettext(string $domain, string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator($domain)->ngettext($msgid, $msgidPlural, $number);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate with context.
|
||||
*
|
||||
* @param string $domain Domain to use
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid String to be translated
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _dpgettext(string $domain, string $msgctxt, string $msgid): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator($domain)->pgettext($msgctxt, $msgid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of pgettext.
|
||||
*
|
||||
* @param string $domain Domain to use
|
||||
* @param string $msgctxt Context
|
||||
* @param string $msgid Single form
|
||||
* @param string $msgidPlural Plural form
|
||||
* @param int $number Number of objects
|
||||
*
|
||||
* @return string translated plural form
|
||||
*/
|
||||
function _dnpgettext(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number): string
|
||||
{
|
||||
return Loader::getInstance()->getTranslator($domain)->npgettext($msgctxt, $msgid, $msgidPlural, $number);
|
||||
}
|
||||
131
pma/vendor/phpmyadmin/shapefile/CHANGELOG.md
vendored
Normal file
131
pma/vendor/phpmyadmin/shapefile/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [3.0.1] - 2021-02-05
|
||||
### Fixed
|
||||
- Fix method signature of ShapeFile::getDBFHeader()
|
||||
|
||||
## [3.0.0] - 2021-02-05
|
||||
### Added
|
||||
- Support for PHPUnit 8 and 9
|
||||
- Support PHP 8
|
||||
|
||||
### Changed
|
||||
- Enable strict mode on PHP files
|
||||
- Rename ShapeFile::$FileName property to ShapeFile::$fileName
|
||||
- Rename ShapeRecord::$SHPData property to ShapeRecord::$shpData
|
||||
- Rename ShapeRecord::$DBFData property to ShapeRecord::$dbfData
|
||||
- ShapeRecord::getContentLength returns `null` when the shape type is not supported instead of `false`.
|
||||
|
||||
### Removed
|
||||
- Drop support for PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
|
||||
|
||||
## [2.1] - 2017-05-15
|
||||
### Changed
|
||||
- Documentation improvements.
|
||||
|
||||
## [2.0] - 2017-01-23
|
||||
### Changed
|
||||
- Switched to PhpMyAdmin vendor namespace to follow PSR-4.
|
||||
|
||||
## [1.2] - 2017-01-07
|
||||
### Added
|
||||
- PHP 7.2 support.
|
||||
|
||||
### Changed
|
||||
- Coding style cleanup.
|
||||
- Avoid installing tests and test data using composer.
|
||||
|
||||
## [1.1] - 2016-11-21
|
||||
### Fixed
|
||||
- Fixed adjusting of record bounding box
|
||||
|
||||
## [1.0] - 2016-11-21
|
||||
### Changed
|
||||
- Documentation improvements
|
||||
- Code cleanups
|
||||
|
||||
## [0.13] - 2016-11-21
|
||||
### Changed
|
||||
- Code cleanups
|
||||
- Improved test coverage
|
||||
|
||||
## [0.12] - 2016-11-17
|
||||
### Changed
|
||||
- Improved test coverage
|
||||
|
||||
### Fixed
|
||||
- Fixed DBF search
|
||||
|
||||
## [0.11] - 2016-11-16
|
||||
### Changed
|
||||
- Code cleanups
|
||||
|
||||
### Fixed
|
||||
- Fixed behavior without configured DBF header
|
||||
- Fixed saving Polygon/Polyline creation with multiple parts
|
||||
- Fixed saving Multipont records
|
||||
|
||||
## [0.10] - 2016-09-05
|
||||
### Changed
|
||||
- Improved error handling on loading
|
||||
|
||||
## [0.9] - 2016-08-04
|
||||
### Changed
|
||||
- Code cleanups
|
||||
|
||||
## [0.8] - 2016-06-24
|
||||
### Changed
|
||||
- Code cleanups
|
||||
|
||||
### Fixed
|
||||
- Fixed loading of records with optional data
|
||||
|
||||
## [0.7] - 2016-06-24
|
||||
### Fixed
|
||||
- Properly fail on loading corrupted files
|
||||
|
||||
## [0.6] - 2016-06-24
|
||||
### Fixed
|
||||
- Fixed detection of end of file when loading
|
||||
|
||||
## [0.5] - 2016-06-24
|
||||
### Added
|
||||
- Added getShapeName method to ShapeFile
|
||||
|
||||
## [0.4] - 2016-06-24
|
||||
### Changed
|
||||
- Make API work even without real file open
|
||||
|
||||
## [0.3] - 2016-06-24
|
||||
### Added
|
||||
- Better support for subclassing
|
||||
|
||||
## [0.2] - 2016-06-24
|
||||
### Changed
|
||||
- Make the dbase extension optional dependency
|
||||
|
||||
## 0.1 - 2016-06-14
|
||||
### Added
|
||||
- Inital release based on bfShapeFiles
|
||||
|
||||
[Unreleased]: https://github.com/phpmyadmin/shapefile/compare/2.1...HEAD
|
||||
[2.1]: https://github.com/phpmyadmin/shapefile/compare/2.0...2.1
|
||||
[2.0]: https://github.com/phpmyadmin/shapefile/compare/1.2...2.0
|
||||
[1.2]: https://github.com/phpmyadmin/shapefile/compare/1.1...1.2
|
||||
[1.1]: https://github.com/phpmyadmin/shapefile/compare/1.0...1.1
|
||||
[1.0]: https://github.com/phpmyadmin/shapefile/compare/0.13...1.0
|
||||
[0.13]: https://github.com/phpmyadmin/shapefile/compare/0.12...0.13
|
||||
[0.12]: https://github.com/phpmyadmin/shapefile/compare/0.11...0.12
|
||||
[0.11]: https://github.com/phpmyadmin/shapefile/compare/0.10...0.11
|
||||
[0.10]: https://github.com/phpmyadmin/shapefile/compare/0.9...0.10
|
||||
[0.9]: https://github.com/phpmyadmin/shapefile/compare/0.8...0.9
|
||||
[0.8]: https://github.com/phpmyadmin/shapefile/compare/0.7...0.8
|
||||
[0.7]: https://github.com/phpmyadmin/shapefile/compare/0.6...0.7
|
||||
[0.6]: https://github.com/phpmyadmin/shapefile/compare/0.5...0.6
|
||||
[0.5]: https://github.com/phpmyadmin/shapefile/compare/0.4...0.5
|
||||
[0.4]: https://github.com/phpmyadmin/shapefile/compare/0.3...0.4
|
||||
[0.3]: https://github.com/phpmyadmin/shapefile/compare/0.2...0.3
|
||||
[0.2]: https://github.com/phpmyadmin/shapefile/compare/0.1...0.2
|
||||
339
pma/vendor/phpmyadmin/shapefile/LICENSE
vendored
Normal file
339
pma/vendor/phpmyadmin/shapefile/LICENSE
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
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.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
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.
|
||||
57
pma/vendor/phpmyadmin/shapefile/README.md
vendored
Normal file
57
pma/vendor/phpmyadmin/shapefile/README.md
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# shapefile
|
||||
ShapeFile library for PHP
|
||||
|
||||

|
||||
[](https://codecov.io/github/phpmyadmin/shapefile?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/phpmyadmin/shapefile/?branch=master)
|
||||
[](https://packagist.org/packages/phpmyadmin/shapefile)
|
||||
|
||||
## Features
|
||||
|
||||
Currently the 2D and 3D variants except MultiPatch of the ShapeFile format as
|
||||
defined in https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf. The
|
||||
library currently supports reading and editing of ShapeFiles and the Associated
|
||||
information (DBF file). There are a lot of things that can be improved in the
|
||||
code, if you are interested in developing, helping with the documentation,
|
||||
making translations or offering new ideas please contact us.
|
||||
|
||||
## Installation
|
||||
|
||||
Please use [Composer][1] to install:
|
||||
|
||||
```sh
|
||||
composer require phpmyadmin/shapefile
|
||||
```
|
||||
|
||||
To be able to read and write the associated DBF file, you need ``dbase``
|
||||
extension:
|
||||
|
||||
```sh
|
||||
pecl install dbase
|
||||
echo "extension=dbase.so" > /etc/php7/conf.d/dbase.ini
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The API documentation is available at
|
||||
<https://develdocs.phpmyadmin.net/shapefile/>.
|
||||
|
||||
## Usage
|
||||
|
||||
To read shape file:
|
||||
|
||||
```php
|
||||
$shp = new \PhpMyAdmin\ShapeFile\ShapeFile(0);
|
||||
$shp->loadFromFile('path/file.*');
|
||||
```
|
||||
|
||||
## History
|
||||
|
||||
This library is based on BytesFall ShapeFiles library written by Ovidio (ovidio
|
||||
AT users.sourceforge.net). The library has been embedded in phpMyAdmin for
|
||||
years and slowly developed there. At one point people started to use our
|
||||
version rather than the original library and that was the point we decided to
|
||||
make it separate package.
|
||||
|
||||
[1]:https://getcomposer.org/
|
||||
|
||||
49
pma/vendor/phpmyadmin/shapefile/composer.json
vendored
Normal file
49
pma/vendor/phpmyadmin/shapefile/composer.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "phpmyadmin/shapefile",
|
||||
"description": "ESRI ShapeFile library for PHP",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"keywords": ["shapefile", "shp", "geo", "geospatial", "dbf", "ESRI", "shape"],
|
||||
"homepage": "https://github.com/phpmyadmin/shapefile",
|
||||
"authors": [
|
||||
{
|
||||
"name": "The phpMyAdmin Team",
|
||||
"email": "developers@phpmyadmin.net",
|
||||
"homepage": "https://www.phpmyadmin.net/team/"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpmyadmin/shapefile/issues",
|
||||
"source": "https://github.com/phpmyadmin/shapefile"
|
||||
},
|
||||
"scripts": {
|
||||
"phpcbf": "phpcbf",
|
||||
"phpcs": "phpcs",
|
||||
"phpstan": "phpstan analyse",
|
||||
"phpunit": "phpunit --color=always",
|
||||
"test": [
|
||||
"@phpcs",
|
||||
"@phpstan",
|
||||
"@phpunit"
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dbase": "For dbf files parsing"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.12.37",
|
||||
"phpmyadmin/coding-standard": "^2.1.1",
|
||||
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||
"phpunit/phpunit": "^7.4 || ^8 || ^9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMyAdmin\\ShapeFile\\": "src"
|
||||
}
|
||||
},
|
||||
"config":{
|
||||
"sort-packages": true
|
||||
}
|
||||
}
|
||||
696
pma/vendor/phpmyadmin/shapefile/src/ShapeFile.php
vendored
Normal file
696
pma/vendor/phpmyadmin/shapefile/src/ShapeFile.php
vendored
Normal file
@@ -0,0 +1,696 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* phpMyAdmin ShapeFile library
|
||||
* <https://github.com/phpmyadmin/shapefile/>.
|
||||
*
|
||||
* Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net>
|
||||
* Copyright 2016 - 2017 Michal Čihař <michal@cihar.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, you can download one from
|
||||
* https://www.gnu.org/copyleft/gpl.html.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\ShapeFile;
|
||||
|
||||
use function array_push;
|
||||
use function chr;
|
||||
use function count;
|
||||
use function extension_loaded;
|
||||
use function fclose;
|
||||
use function feof;
|
||||
use function file_exists;
|
||||
use function fopen;
|
||||
use function fread;
|
||||
use function fwrite;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function is_readable;
|
||||
use function ord;
|
||||
use function pack;
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
use function strpos;
|
||||
use function strtoupper;
|
||||
use function substr;
|
||||
use function trim;
|
||||
use function unlink;
|
||||
|
||||
/**
|
||||
* ShapeFile class.
|
||||
*/
|
||||
class ShapeFile
|
||||
{
|
||||
public const MAGIC = 0x270a;
|
||||
|
||||
/** @var string|null */
|
||||
public $fileName;
|
||||
|
||||
/** @var resource|null */
|
||||
private $shpFile = null;
|
||||
/** @var resource|null */
|
||||
private $shxFile = null;
|
||||
/** @var resource|null */
|
||||
private $dbfFile = null;
|
||||
|
||||
/** @var array|null */
|
||||
private $dbfHeader;
|
||||
|
||||
/** @var string */
|
||||
public $lastError = '';
|
||||
|
||||
/** @var array */
|
||||
public $boundingBox = [
|
||||
'xmin' => 0.0,
|
||||
'ymin' => 0.0,
|
||||
'xmax' => 0.0,
|
||||
'ymax' => 0.0,
|
||||
];
|
||||
/** @var int */
|
||||
private $fileLength = 0;
|
||||
|
||||
/** @var int|false */
|
||||
public $shapeType = 0;
|
||||
|
||||
/** @var array */
|
||||
public $records = [];
|
||||
|
||||
/**
|
||||
* Checks whether dbase manipulations are supported.
|
||||
*/
|
||||
public static function supportsDbase(): bool
|
||||
{
|
||||
return extension_loaded('dbase');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $shapeType File shape type, should be same as all records
|
||||
* @param array $boundingBox File bounding box
|
||||
* @param string|null $fileName File name
|
||||
*/
|
||||
public function __construct(
|
||||
int $shapeType,
|
||||
array $boundingBox = [
|
||||
'xmin' => 0.0,
|
||||
'ymin' => 0.0,
|
||||
'xmax' => 0.0,
|
||||
'ymax' => 0.0,
|
||||
],
|
||||
?string $fileName = null
|
||||
) {
|
||||
$this->shapeType = $shapeType;
|
||||
$this->boundingBox = $boundingBox;
|
||||
$this->fileName = $fileName;
|
||||
|
||||
/**
|
||||
* The value for file length is the total length of the file in 16-bit words
|
||||
* (including the fifty 16-bit words that make up the header).
|
||||
*/
|
||||
$this->fileLength = 50;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads shapefile and dbase (if supported).
|
||||
*
|
||||
* @param string $fileName File mask to load (eg. example.*)
|
||||
*/
|
||||
public function loadFromFile(string $fileName): bool
|
||||
{
|
||||
if (! empty($fileName)) {
|
||||
$this->fileName = $fileName;
|
||||
$result = $this->openSHPFile();
|
||||
} else {
|
||||
/* We operate on buffer emulated by readSHP / eofSHP */
|
||||
$result = true;
|
||||
}
|
||||
|
||||
if ($result && ($this->openDBFFile())) {
|
||||
if (! $this->loadHeaders()) {
|
||||
$this->closeSHPFile();
|
||||
$this->closeDBFFile();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->loadRecords()) {
|
||||
$this->closeSHPFile();
|
||||
$this->closeDBFFile();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->closeSHPFile();
|
||||
$this->closeDBFFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves shapefile.
|
||||
*
|
||||
* @param string|null $fileName Name of file, otherwise existing is used
|
||||
*/
|
||||
public function saveToFile(?string $fileName = null): bool
|
||||
{
|
||||
if ($fileName !== null) {
|
||||
$this->fileName = $fileName;
|
||||
}
|
||||
|
||||
if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->saveHeaders();
|
||||
$this->saveRecords();
|
||||
$this->closeSHPFile();
|
||||
$this->closeSHXFile();
|
||||
$this->closeDBFFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates filename with given extension.
|
||||
*
|
||||
* @param string $extension Extension to use (including dot)
|
||||
*/
|
||||
private function getFilename(string $extension): string
|
||||
{
|
||||
return str_replace('.*', $extension, (string) $this->fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates bounding box based on shpData.
|
||||
*
|
||||
* @param string $type Type of box
|
||||
* @param array $data ShapeRecord shpData
|
||||
*/
|
||||
private function updateBBox(string $type, array $data): void
|
||||
{
|
||||
$min = $type . 'min';
|
||||
$max = $type . 'max';
|
||||
|
||||
if (! isset($this->boundingBox[$min])
|
||||
|| $this->boundingBox[$min] == 0.0
|
||||
|| ($this->boundingBox[$min] > $data[$min])
|
||||
) {
|
||||
$this->boundingBox[$min] = $data[$min];
|
||||
}
|
||||
|
||||
if (isset($this->boundingBox[$max])
|
||||
&& $this->boundingBox[$max] != 0.0
|
||||
&& ($this->boundingBox[$max] >= $data[$max])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->boundingBox[$max] = $data[$max];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds record to shape file.
|
||||
*
|
||||
* @return int Number of added record
|
||||
*/
|
||||
public function addRecord(ShapeRecord $record): int
|
||||
{
|
||||
if (isset($this->dbfHeader) && (is_array($this->dbfHeader))) {
|
||||
$record->updateDBFInfo($this->dbfHeader);
|
||||
}
|
||||
|
||||
$this->fileLength += $record->getContentLength() + 4;
|
||||
$this->records[] = $record;
|
||||
$this->records[count($this->records) - 1]->recordNumber = count($this->records);
|
||||
|
||||
$this->updateBBox('x', $record->shpData);
|
||||
$this->updateBBox('y', $record->shpData);
|
||||
|
||||
if (in_array($this->shapeType, [11, 13, 15, 18, 21, 23, 25, 28])) {
|
||||
$this->updateBBox('m', $record->shpData);
|
||||
}
|
||||
|
||||
if (in_array($this->shapeType, [11, 13, 15, 18])) {
|
||||
$this->updateBBox('z', $record->shpData);
|
||||
}
|
||||
|
||||
return count($this->records) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes record from shapefile.
|
||||
*/
|
||||
public function deleteRecord(int $index): void
|
||||
{
|
||||
if (! isset($this->records[$index])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fileLength -= $this->records[$index]->getContentLength() + 4;
|
||||
$count = count($this->records) - 1;
|
||||
for ($i = $index; $i < $count; ++$i) {
|
||||
$this->records[$i] = $this->records[$i + 1];
|
||||
}
|
||||
|
||||
unset($this->records[count($this->records) - 1]);
|
||||
$this->deleteRecordFromDBF($index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array defining fields in DBF file.
|
||||
*
|
||||
* @return array|null see setDBFHeader for more information
|
||||
*/
|
||||
public function getDBFHeader(): ?array
|
||||
{
|
||||
return $this->dbfHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes array defining fields in DBF file, used in dbase_create call.
|
||||
*
|
||||
* @param array $header An array of arrays, each array describing the
|
||||
* format of one field of the database. Each
|
||||
* field consists of a name, a character indicating
|
||||
* the field type, and optionally, a length,
|
||||
* a precision and a nullable flag.
|
||||
*/
|
||||
public function setDBFHeader(array $header): void
|
||||
{
|
||||
$this->dbfHeader = $header;
|
||||
|
||||
$count = count($this->records);
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$this->records[$i]->updateDBFInfo($header);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookups value in the DBF file and returns index.
|
||||
*
|
||||
* @param string $field Field to match
|
||||
* @param mixed $value Value to match
|
||||
*/
|
||||
public function getIndexFromDBFData(string $field, $value): int
|
||||
{
|
||||
foreach ($this->records as $index => $record) {
|
||||
if (isset($record->dbfData[$field]) &&
|
||||
(trim(strtoupper($record->dbfData[$field])) === strtoupper($value))
|
||||
) {
|
||||
return $index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads DBF metadata.
|
||||
*/
|
||||
private function loadDBFHeader(): array
|
||||
{
|
||||
$DBFFile = fopen($this->getFilename('.dbf'), 'r');
|
||||
|
||||
$result = [];
|
||||
$i = 1;
|
||||
$inHeader = true;
|
||||
|
||||
while ($inHeader) {
|
||||
if (! feof($DBFFile)) {
|
||||
$buff32 = fread($DBFFile, 32);
|
||||
if ($i > 1) {
|
||||
if (substr($buff32, 0, 1) === chr(13)) {
|
||||
$inHeader = false;
|
||||
} else {
|
||||
$pos = strpos(substr($buff32, 0, 10), chr(0));
|
||||
$pos = ($pos === false ? 10 : $pos);
|
||||
|
||||
$fieldName = substr($buff32, 0, $pos);
|
||||
$fieldType = substr($buff32, 11, 1);
|
||||
$fieldLen = ord(substr($buff32, 16, 1));
|
||||
$fieldDec = ord(substr($buff32, 17, 1));
|
||||
|
||||
array_push($result, [$fieldName, $fieldType, $fieldLen, $fieldDec]);
|
||||
}
|
||||
}
|
||||
|
||||
++$i;
|
||||
} else {
|
||||
$inHeader = false;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($DBFFile);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes record from the DBF file.
|
||||
*/
|
||||
private function deleteRecordFromDBF(int $index): void
|
||||
{
|
||||
if ($this->dbfFile === null || ! @dbase_delete_record($this->dbfFile, $index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dbase_pack($this->dbfFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads SHP file metadata.
|
||||
*/
|
||||
private function loadHeaders(): bool
|
||||
{
|
||||
if (Util::loadData('N', $this->readSHP(4)) !== self::MAGIC) {
|
||||
$this->setError('Not a SHP file (file code mismatch)');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Skip 20 unused bytes */
|
||||
$this->readSHP(20);
|
||||
|
||||
$this->fileLength = Util::loadData('N', $this->readSHP(4));
|
||||
|
||||
/* We currently ignore version */
|
||||
$this->readSHP(4);
|
||||
|
||||
$this->shapeType = Util::loadData('V', $this->readSHP(4));
|
||||
|
||||
$this->boundingBox = [];
|
||||
$this->boundingBox['xmin'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['ymin'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['xmax'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['ymax'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['zmin'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['zmax'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['mmin'] = Util::loadData('d', $this->readSHP(8));
|
||||
$this->boundingBox['mmax'] = Util::loadData('d', $this->readSHP(8));
|
||||
|
||||
if (self::supportsDbase()) {
|
||||
$this->dbfHeader = $this->loadDBFHeader();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves bounding box record, possibly using 0 instead of not set values.
|
||||
*
|
||||
* @param resource $file File object
|
||||
* @param string $type Bounding box dimension (eg. xmax, mmin...)
|
||||
*/
|
||||
private function saveBBoxRecord($file, string $type): void
|
||||
{
|
||||
fwrite($file, Util::packDouble(
|
||||
$this->boundingBox[$type] ?? 0
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves bounding box to a file.
|
||||
*
|
||||
* @param resource $file File object
|
||||
*/
|
||||
private function saveBBox($file): void
|
||||
{
|
||||
$this->saveBBoxRecord($file, 'xmin');
|
||||
$this->saveBBoxRecord($file, 'ymin');
|
||||
$this->saveBBoxRecord($file, 'xmax');
|
||||
$this->saveBBoxRecord($file, 'ymax');
|
||||
$this->saveBBoxRecord($file, 'zmin');
|
||||
$this->saveBBoxRecord($file, 'zmax');
|
||||
$this->saveBBoxRecord($file, 'mmin');
|
||||
$this->saveBBoxRecord($file, 'mmax');
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves SHP and SHX file metadata.
|
||||
*/
|
||||
private function saveHeaders(): void
|
||||
{
|
||||
fwrite($this->shpFile, pack('NNNNNN', self::MAGIC, 0, 0, 0, 0, 0));
|
||||
fwrite($this->shpFile, pack('N', $this->fileLength));
|
||||
fwrite($this->shpFile, pack('V', 1000));
|
||||
fwrite($this->shpFile, pack('V', $this->shapeType));
|
||||
$this->saveBBox($this->shpFile);
|
||||
|
||||
fwrite($this->shxFile, pack('NNNNNN', self::MAGIC, 0, 0, 0, 0, 0));
|
||||
fwrite($this->shxFile, pack('N', 50 + 4 * count($this->records)));
|
||||
fwrite($this->shxFile, pack('V', 1000));
|
||||
fwrite($this->shxFile, pack('V', $this->shapeType));
|
||||
$this->saveBBox($this->shxFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads records from SHP file (and DBF).
|
||||
*/
|
||||
private function loadRecords(): bool
|
||||
{
|
||||
/* Need to start at offset 100 */
|
||||
while (! $this->eofSHP()) {
|
||||
$record = new ShapeRecord(-1);
|
||||
$record->loadFromFile($this, $this->shpFile, $this->dbfFile);
|
||||
if ($record->lastError !== '') {
|
||||
$this->setError($record->lastError);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($record->shapeType === false || $record->shapeType === '') && $this->eofSHP()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->records[] = $record;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves records to SHP and SHX files.
|
||||
*/
|
||||
private function saveRecords(): void
|
||||
{
|
||||
$offset = 50;
|
||||
if (! is_array($this->records) || (count($this->records) <= 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->records as $index => $record) {
|
||||
//Save the record to the .shp file
|
||||
$record->saveToFile($this->shpFile, $this->dbfFile, $index + 1);
|
||||
|
||||
//Save the record to the .shx file
|
||||
fwrite($this->shxFile, pack('N', $offset));
|
||||
fwrite($this->shxFile, pack('N', $record->getContentLength()));
|
||||
$offset += 4 + $record->getContentLength();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic interface to open files.
|
||||
*
|
||||
* @param bool $toWrite Whether file should be opened for writing
|
||||
* @param string $extension File extension
|
||||
* @param string $name Verbose file name to report errors
|
||||
*
|
||||
* @return resource|false File handle
|
||||
*/
|
||||
private function openFile(bool $toWrite, string $extension, string $name)
|
||||
{
|
||||
$shpName = $this->getFilename($extension);
|
||||
$result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
|
||||
if (! $result) {
|
||||
$this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens SHP file.
|
||||
*
|
||||
* @param bool $toWrite Whether file should be opened for writing
|
||||
*/
|
||||
private function openSHPFile(bool $toWrite = false): bool
|
||||
{
|
||||
$this->shpFile = $this->openFile($toWrite, '.shp', 'Shape');
|
||||
|
||||
return (bool) $this->shpFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes SHP file.
|
||||
*/
|
||||
private function closeSHPFile(): void
|
||||
{
|
||||
if (! $this->shpFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
fclose($this->shpFile);
|
||||
$this->shpFile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens SHX file.
|
||||
*
|
||||
* @param bool $toWrite Whether file should be opened for writing
|
||||
*/
|
||||
private function openSHXFile(bool $toWrite = false): bool
|
||||
{
|
||||
$this->shxFile = $this->openFile($toWrite, '.shx', 'Index');
|
||||
|
||||
return (bool) $this->shxFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes SHX file.
|
||||
*/
|
||||
private function closeSHXFile(): void
|
||||
{
|
||||
if (! $this->shxFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
fclose($this->shxFile);
|
||||
$this->shxFile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates DBF file.
|
||||
*/
|
||||
private function createDBFFile(): bool
|
||||
{
|
||||
if (! self::supportsDbase() || ! is_array($this->dbfHeader) || count($this->dbfHeader) === 0) {
|
||||
$this->dbfFile = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$dbfName = $this->getFilename('.dbf');
|
||||
|
||||
/* Unlink existing file */
|
||||
if (file_exists($dbfName)) {
|
||||
unlink($dbfName);
|
||||
}
|
||||
|
||||
/* Create new file */
|
||||
$this->dbfFile = @dbase_create($dbfName, $this->dbfHeader);
|
||||
if ($this->dbfFile === false) {
|
||||
$this->setError(sprintf('It wasn\'t possible to create the DBase file "%s"', $dbfName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads DBF file if supported.
|
||||
*/
|
||||
private function openDBFFile(): bool
|
||||
{
|
||||
if (! self::supportsDbase()) {
|
||||
$this->dbfFile = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$dbfName = $this->getFilename('.dbf');
|
||||
if (! is_readable($dbfName)) {
|
||||
$this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->dbfFile = @dbase_open($dbfName, 0);
|
||||
if (! $this->dbfFile) {
|
||||
$this->setError(sprintf('It wasn\'t possible to open the DBase file "%s"', $dbfName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes DBF file.
|
||||
*/
|
||||
private function closeDBFFile(): void
|
||||
{
|
||||
if (! $this->dbfFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
dbase_close($this->dbfFile);
|
||||
$this->dbfFile = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets error message.
|
||||
*/
|
||||
public function setError(string $error): void
|
||||
{
|
||||
$this->lastError = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads given number of bytes from SHP file.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function readSHP(int $bytes)
|
||||
{
|
||||
if ($this->shpFile === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return fread($this->shpFile, $bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether file is at EOF.
|
||||
*/
|
||||
public function eofSHP(): bool
|
||||
{
|
||||
return feof($this->shpFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns shape name.
|
||||
*/
|
||||
public function getShapeName(): string
|
||||
{
|
||||
return Util::nameShape($this->shapeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether file contains measure data.
|
||||
*
|
||||
* For some reason this is distinguished by zero bounding box in the
|
||||
* specification.
|
||||
*/
|
||||
public function hasMeasure(): bool
|
||||
{
|
||||
return $this->boundingBox['mmin'] != 0 || $this->boundingBox['mmax'] != 0;
|
||||
}
|
||||
}
|
||||
900
pma/vendor/phpmyadmin/shapefile/src/ShapeRecord.php
vendored
Normal file
900
pma/vendor/phpmyadmin/shapefile/src/ShapeRecord.php
vendored
Normal file
@@ -0,0 +1,900 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* phpMyAdmin ShapeFile library
|
||||
* <https://github.com/phpmyadmin/shapefile/>.
|
||||
*
|
||||
* Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net>
|
||||
* Copyright 2016 - 2017 Michal Čihař <michal@cihar.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, you can download one from
|
||||
* https://www.gnu.org/copyleft/gpl.html.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\ShapeFile;
|
||||
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function fwrite;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function pack;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
|
||||
/**
|
||||
* ShapeFile record class.
|
||||
*/
|
||||
class ShapeRecord
|
||||
{
|
||||
/** @var resource */
|
||||
private $shpFile = null;
|
||||
/** @var resource */
|
||||
private $dbfFile = null;
|
||||
/** @var ShapeFile */
|
||||
private $shapeFile = null;
|
||||
|
||||
/** @var int */
|
||||
private $size = 0;
|
||||
/** @var int */
|
||||
private $read = 0;
|
||||
|
||||
/** @var int|null */
|
||||
public $recordNumber = null;
|
||||
|
||||
/** @var int */
|
||||
public $shapeType = null;
|
||||
|
||||
/** @var string */
|
||||
public $lastError = '';
|
||||
|
||||
/** @var array */
|
||||
public $shpData = [];
|
||||
/** @var array */
|
||||
public $dbfData = [];
|
||||
|
||||
public function __construct(int $shapeType)
|
||||
{
|
||||
$this->shapeType = $shapeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads record from files.
|
||||
*
|
||||
* @param ShapeFile $shapeFile The ShapeFile object
|
||||
* @param resource $shpFile Opened SHP file (by reference)
|
||||
* @param resource $dbfFile Opened DBF file (by reference)
|
||||
*/
|
||||
public function loadFromFile(ShapeFile &$shapeFile, &$shpFile, &$dbfFile): void
|
||||
{
|
||||
$this->shapeFile = $shapeFile;
|
||||
$this->shpFile = $shpFile;
|
||||
$this->dbfFile = $dbfFile;
|
||||
$this->loadHeaders();
|
||||
|
||||
/* No header read */
|
||||
if ($this->read === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($this->shapeType) {
|
||||
case 0:
|
||||
$this->loadNullRecord();
|
||||
break;
|
||||
case 1:
|
||||
$this->loadPointRecord();
|
||||
break;
|
||||
case 21:
|
||||
$this->loadPointMRecord();
|
||||
break;
|
||||
case 11:
|
||||
$this->loadPointZRecord();
|
||||
break;
|
||||
case 3:
|
||||
$this->loadPolyLineRecord();
|
||||
break;
|
||||
case 23:
|
||||
$this->loadPolyLineMRecord();
|
||||
break;
|
||||
case 13:
|
||||
$this->loadPolyLineZRecord();
|
||||
break;
|
||||
case 5:
|
||||
$this->loadPolygonRecord();
|
||||
break;
|
||||
case 25:
|
||||
$this->loadPolygonMRecord();
|
||||
break;
|
||||
case 15:
|
||||
$this->loadPolygonZRecord();
|
||||
break;
|
||||
case 8:
|
||||
$this->loadMultiPointRecord();
|
||||
break;
|
||||
case 28:
|
||||
$this->loadMultiPointMRecord();
|
||||
break;
|
||||
case 18:
|
||||
$this->loadMultiPointZRecord();
|
||||
break;
|
||||
default:
|
||||
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
|
||||
break;
|
||||
}
|
||||
|
||||
/* We need to skip rest of the record */
|
||||
while ($this->read < $this->size) {
|
||||
$this->loadData('V', 4);
|
||||
}
|
||||
|
||||
/* Check if we didn't read too much */
|
||||
if ($this->read !== $this->size) {
|
||||
$this->setError(sprintf('Failed to parse record, read=%d, size=%d', $this->read, $this->size));
|
||||
}
|
||||
|
||||
if (! ShapeFile::supportsDbase() || ! isset($this->dbfFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->loadDBFData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves record to files.
|
||||
*
|
||||
* @param resource $shpFile Opened SHP file
|
||||
* @param resource $dbfFile Opened DBF file
|
||||
* @param int $recordNumber Record number
|
||||
*/
|
||||
public function saveToFile(&$shpFile, &$dbfFile, int $recordNumber): void
|
||||
{
|
||||
$this->shpFile = $shpFile;
|
||||
$this->dbfFile = $dbfFile;
|
||||
$this->recordNumber = $recordNumber;
|
||||
$this->saveHeaders();
|
||||
|
||||
switch ($this->shapeType) {
|
||||
case 0:
|
||||
// Nothing to save
|
||||
break;
|
||||
case 1:
|
||||
$this->savePointRecord();
|
||||
break;
|
||||
case 21:
|
||||
$this->savePointMRecord();
|
||||
break;
|
||||
case 11:
|
||||
$this->savePointZRecord();
|
||||
break;
|
||||
case 3:
|
||||
$this->savePolyLineRecord();
|
||||
break;
|
||||
case 23:
|
||||
$this->savePolyLineMRecord();
|
||||
break;
|
||||
case 13:
|
||||
$this->savePolyLineZRecord();
|
||||
break;
|
||||
case 5:
|
||||
$this->savePolygonRecord();
|
||||
break;
|
||||
case 25:
|
||||
$this->savePolygonMRecord();
|
||||
break;
|
||||
case 15:
|
||||
$this->savePolygonZRecord();
|
||||
break;
|
||||
case 8:
|
||||
$this->saveMultiPointRecord();
|
||||
break;
|
||||
case 28:
|
||||
$this->saveMultiPointMRecord();
|
||||
break;
|
||||
case 18:
|
||||
$this->saveMultiPointZRecord();
|
||||
break;
|
||||
default:
|
||||
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
|
||||
break;
|
||||
}
|
||||
|
||||
if (! ShapeFile::supportsDbase() || $this->dbfFile === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->saveDBFData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates DBF data to match header.
|
||||
*
|
||||
* @param array $header DBF structure header
|
||||
*/
|
||||
public function updateDBFInfo(array $header): void
|
||||
{
|
||||
$tmp = $this->dbfData;
|
||||
unset($this->dbfData);
|
||||
$this->dbfData = [];
|
||||
foreach ($header as $value) {
|
||||
$this->dbfData[$value[0]] = $tmp[$value[0]] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads data.
|
||||
*
|
||||
* @param string $type type for unpack()
|
||||
* @param int $count number of bytes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function loadData(string $type, int $count)
|
||||
{
|
||||
$data = $this->shapeFile->readSHP($count);
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->read += strlen($data);
|
||||
|
||||
return Util::loadData($type, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads metadata header from a file.
|
||||
*/
|
||||
private function loadHeaders(): void
|
||||
{
|
||||
$this->shapeType = false;
|
||||
$this->recordNumber = $this->loadData('N', 4);
|
||||
if ($this->recordNumber === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We read the length of the record
|
||||
$this->size = $this->loadData('N', 4);
|
||||
if ($this->size === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->size = ($this->size * 2) + 8;
|
||||
$this->shapeType = $this->loadData('V', 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves metadata header to a file.
|
||||
*/
|
||||
private function saveHeaders(): void
|
||||
{
|
||||
fwrite($this->shpFile, pack('N', $this->recordNumber));
|
||||
fwrite($this->shpFile, pack('N', $this->getContentLength()));
|
||||
fwrite($this->shpFile, pack('V', $this->shapeType));
|
||||
}
|
||||
|
||||
private function loadPoint(): array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$data['x'] = $this->loadData('d', 8);
|
||||
$data['y'] = $this->loadData('d', 8);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function loadPointM(): array
|
||||
{
|
||||
$data = $this->loadPoint();
|
||||
|
||||
$data['m'] = $this->loadData('d', 8);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function loadPointZ(): array
|
||||
{
|
||||
$data = $this->loadPoint();
|
||||
|
||||
$data['z'] = $this->loadData('d', 8);
|
||||
$data['m'] = $this->loadData('d', 8);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function savePoint(array $data): void
|
||||
{
|
||||
fwrite($this->shpFile, Util::packDouble($data['x']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['y']));
|
||||
}
|
||||
|
||||
private function savePointM(array $data): void
|
||||
{
|
||||
fwrite($this->shpFile, Util::packDouble($data['x']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['y']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['m']));
|
||||
}
|
||||
|
||||
private function savePointZ(array $data): void
|
||||
{
|
||||
fwrite($this->shpFile, Util::packDouble($data['x']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['y']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['z']));
|
||||
fwrite($this->shpFile, Util::packDouble($data['m']));
|
||||
}
|
||||
|
||||
private function loadNullRecord(): void
|
||||
{
|
||||
$this->shpData = [];
|
||||
}
|
||||
|
||||
private function loadPointRecord(): void
|
||||
{
|
||||
$this->shpData = $this->loadPoint();
|
||||
}
|
||||
|
||||
private function loadPointMRecord(): void
|
||||
{
|
||||
$this->shpData = $this->loadPointM();
|
||||
}
|
||||
|
||||
private function loadPointZRecord(): void
|
||||
{
|
||||
$this->shpData = $this->loadPointZ();
|
||||
}
|
||||
|
||||
private function savePointRecord(): void
|
||||
{
|
||||
$this->savePoint($this->shpData);
|
||||
}
|
||||
|
||||
private function savePointMRecord(): void
|
||||
{
|
||||
$this->savePointM($this->shpData);
|
||||
}
|
||||
|
||||
private function savePointZRecord(): void
|
||||
{
|
||||
$this->savePointZ($this->shpData);
|
||||
}
|
||||
|
||||
private function loadBBox(): void
|
||||
{
|
||||
$this->shpData['xmin'] = $this->loadData('d', 8);
|
||||
$this->shpData['ymin'] = $this->loadData('d', 8);
|
||||
$this->shpData['xmax'] = $this->loadData('d', 8);
|
||||
$this->shpData['ymax'] = $this->loadData('d', 8);
|
||||
}
|
||||
|
||||
private function loadMultiPointRecord(): void
|
||||
{
|
||||
$this->shpData = [];
|
||||
$this->loadBBox();
|
||||
|
||||
$this->shpData['numpoints'] = $this->loadData('V', 4);
|
||||
|
||||
for ($i = 0; $i < $this->shpData['numpoints']; ++$i) {
|
||||
$this->shpData['points'][] = $this->loadPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private function loadMultiPointMZRecord(string $type): void
|
||||
{
|
||||
/* The m dimension is optional, depends on bounding box data */
|
||||
if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->shpData[$type . 'min'] = $this->loadData('d', 8);
|
||||
$this->shpData[$type . 'max'] = $this->loadData('d', 8);
|
||||
|
||||
for ($i = 0; $i < $this->shpData['numpoints']; ++$i) {
|
||||
$this->shpData['points'][$i][$type] = $this->loadData('d', 8);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadMultiPointMRecord(): void
|
||||
{
|
||||
$this->loadMultiPointRecord();
|
||||
|
||||
$this->loadMultiPointMZRecord('m');
|
||||
}
|
||||
|
||||
private function loadMultiPointZRecord(): void
|
||||
{
|
||||
$this->loadMultiPointRecord();
|
||||
|
||||
$this->loadMultiPointMZRecord('z');
|
||||
$this->loadMultiPointMZRecord('m');
|
||||
}
|
||||
|
||||
private function saveMultiPointRecord(): void
|
||||
{
|
||||
fwrite($this->shpFile, pack(
|
||||
'dddd',
|
||||
$this->shpData['xmin'],
|
||||
$this->shpData['ymin'],
|
||||
$this->shpData['xmax'],
|
||||
$this->shpData['ymax']
|
||||
));
|
||||
|
||||
fwrite($this->shpFile, pack('V', $this->shpData['numpoints']));
|
||||
|
||||
for ($i = 0; $i < $this->shpData['numpoints']; ++$i) {
|
||||
$this->savePoint($this->shpData['points'][$i]);
|
||||
}
|
||||
}
|
||||
|
||||
private function saveMultiPointMZRecord(string $type): void
|
||||
{
|
||||
fwrite($this->shpFile, pack('dd', $this->shpData[$type . 'min'], $this->shpData[$type . 'max']));
|
||||
|
||||
for ($i = 0; $i < $this->shpData['numpoints']; ++$i) {
|
||||
fwrite($this->shpFile, Util::packDouble($this->shpData['points'][$i][$type]));
|
||||
}
|
||||
}
|
||||
|
||||
private function saveMultiPointMRecord(): void
|
||||
{
|
||||
$this->saveMultiPointRecord();
|
||||
|
||||
$this->saveMultiPointMZRecord('m');
|
||||
}
|
||||
|
||||
private function saveMultiPointZRecord(): void
|
||||
{
|
||||
$this->saveMultiPointRecord();
|
||||
|
||||
$this->saveMultiPointMZRecord('z');
|
||||
$this->saveMultiPointMZRecord('m');
|
||||
}
|
||||
|
||||
private function loadPolyLineRecord(): void
|
||||
{
|
||||
$this->shpData = [];
|
||||
$this->loadBBox();
|
||||
|
||||
$this->shpData['numparts'] = $this->loadData('V', 4);
|
||||
$this->shpData['numpoints'] = $this->loadData('V', 4);
|
||||
|
||||
$numparts = $this->shpData['numparts'];
|
||||
$numpoints = $this->shpData['numpoints'];
|
||||
|
||||
for ($i = 0; $i < $numparts; ++$i) {
|
||||
$this->shpData['parts'][$i] = $this->loadData('V', 4);
|
||||
}
|
||||
|
||||
$part = 0;
|
||||
for ($i = 0; $i < $numpoints; ++$i) {
|
||||
if ($part + 1 < $numparts && $i === $this->shpData['parts'][$part + 1]) {
|
||||
++$part;
|
||||
}
|
||||
|
||||
if (! isset($this->shpData['parts'][$part]['points'])
|
||||
|| ! is_array($this->shpData['parts'][$part]['points'])
|
||||
) {
|
||||
$this->shpData['parts'][$part] = ['points' => []];
|
||||
}
|
||||
|
||||
$this->shpData['parts'][$part]['points'][] = $this->loadPoint();
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPolyLineMZRecord(string $type): void
|
||||
{
|
||||
/* The m dimension is optional, depends on bounding box data */
|
||||
if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->shpData[$type . 'min'] = $this->loadData('d', 8);
|
||||
$this->shpData[$type . 'max'] = $this->loadData('d', 8);
|
||||
|
||||
$numparts = $this->shpData['numparts'];
|
||||
$numpoints = $this->shpData['numpoints'];
|
||||
|
||||
$part = 0;
|
||||
for ($i = 0; $i < $numpoints; ++$i) {
|
||||
if ($part + 1 < $numparts && $i === $this->shpData['parts'][$part + 1]) {
|
||||
++$part;
|
||||
}
|
||||
|
||||
$this->shpData['parts'][$part]['points'][$i][$type] = $this->loadData('d', 8);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPolyLineMRecord(): void
|
||||
{
|
||||
$this->loadPolyLineRecord();
|
||||
|
||||
$this->loadPolyLineMZRecord('m');
|
||||
}
|
||||
|
||||
private function loadPolyLineZRecord(): void
|
||||
{
|
||||
$this->loadPolyLineRecord();
|
||||
|
||||
$this->loadPolyLineMZRecord('z');
|
||||
$this->loadPolyLineMZRecord('m');
|
||||
}
|
||||
|
||||
private function savePolyLineRecord(): void
|
||||
{
|
||||
fwrite($this->shpFile, pack(
|
||||
'dddd',
|
||||
$this->shpData['xmin'],
|
||||
$this->shpData['ymin'],
|
||||
$this->shpData['xmax'],
|
||||
$this->shpData['ymax']
|
||||
));
|
||||
|
||||
fwrite($this->shpFile, pack('VV', $this->shpData['numparts'], $this->shpData['numpoints']));
|
||||
|
||||
$partIndex = 0;
|
||||
for ($i = 0; $i < $this->shpData['numparts']; ++$i) {
|
||||
fwrite($this->shpFile, pack('V', $partIndex));
|
||||
$partIndex += count($this->shpData['parts'][$i]['points']);
|
||||
}
|
||||
|
||||
foreach ($this->shpData['parts'] as $partData) {
|
||||
foreach ($partData['points'] as $pointData) {
|
||||
$this->savePoint($pointData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function savePolyLineMZRecord(string $type): void
|
||||
{
|
||||
fwrite($this->shpFile, pack('dd', $this->shpData[$type . 'min'], $this->shpData[$type . 'max']));
|
||||
|
||||
foreach ($this->shpData['parts'] as $partData) {
|
||||
foreach ($partData['points'] as $pointData) {
|
||||
fwrite($this->shpFile, Util::packDouble($pointData[$type]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function savePolyLineMRecord(): void
|
||||
{
|
||||
$this->savePolyLineRecord();
|
||||
|
||||
$this->savePolyLineMZRecord('m');
|
||||
}
|
||||
|
||||
private function savePolyLineZRecord(): void
|
||||
{
|
||||
$this->savePolyLineRecord();
|
||||
|
||||
$this->savePolyLineMZRecord('z');
|
||||
$this->savePolyLineMZRecord('m');
|
||||
}
|
||||
|
||||
private function loadPolygonRecord(): void
|
||||
{
|
||||
$this->loadPolyLineRecord();
|
||||
}
|
||||
|
||||
private function loadPolygonMRecord(): void
|
||||
{
|
||||
$this->loadPolyLineMRecord();
|
||||
}
|
||||
|
||||
private function loadPolygonZRecord(): void
|
||||
{
|
||||
$this->loadPolyLineZRecord();
|
||||
}
|
||||
|
||||
private function savePolygonRecord(): void
|
||||
{
|
||||
$this->savePolyLineRecord();
|
||||
}
|
||||
|
||||
private function savePolygonMRecord(): void
|
||||
{
|
||||
$this->savePolyLineMRecord();
|
||||
}
|
||||
|
||||
private function savePolygonZRecord(): void
|
||||
{
|
||||
$this->savePolyLineZRecord();
|
||||
}
|
||||
|
||||
private function adjustBBox(array $point): void
|
||||
{
|
||||
// Adjusts bounding box based on point
|
||||
$directions = [
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
'm',
|
||||
];
|
||||
foreach ($directions as $direction) {
|
||||
if (! isset($point[$direction])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$min = $direction . 'min';
|
||||
$max = $direction . 'max';
|
||||
if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
|
||||
$this->shpData[$min] = $point[$direction];
|
||||
}
|
||||
|
||||
if (isset($this->shpData[$max]) && ($this->shpData[$max] >= $point[$direction])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->shpData[$max] = $point[$direction];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets dimension to 0 if not set.
|
||||
*
|
||||
* @param array $point Point to check
|
||||
* @param string $dimension Dimension to check
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function fixPoint(array $point, string $dimension): array
|
||||
{
|
||||
if (! isset($point[$dimension])) {
|
||||
$point[$dimension] = 0.0; // no_value
|
||||
}
|
||||
|
||||
return $point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust point and bounding box when adding point.
|
||||
*
|
||||
* @param array $point Point data
|
||||
*
|
||||
* @return array Fixed point data
|
||||
*/
|
||||
private function adjustPoint(array $point): array
|
||||
{
|
||||
$type = $this->shapeType / 10;
|
||||
if ($type >= 2) {
|
||||
$point = $this->fixPoint($point, 'm');
|
||||
} elseif ($type >= 1) {
|
||||
$point = $this->fixPoint($point, 'z');
|
||||
$point = $this->fixPoint($point, 'm');
|
||||
}
|
||||
|
||||
return $point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds point to a record.
|
||||
*
|
||||
* @param array $point Point data
|
||||
* @param int $partIndex Part index
|
||||
*/
|
||||
public function addPoint(array $point, int $partIndex = 0): void
|
||||
{
|
||||
$point = $this->adjustPoint($point);
|
||||
switch ($this->shapeType) {
|
||||
case 0:
|
||||
//Don't add anything
|
||||
return;
|
||||
case 1:
|
||||
case 11:
|
||||
case 21:
|
||||
//Substitutes the value of the current point
|
||||
$this->shpData = $point;
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
case 13:
|
||||
case 15:
|
||||
case 23:
|
||||
case 25:
|
||||
//Adds a new point to the selected part
|
||||
$this->shpData['parts'][$partIndex]['points'][] = $point;
|
||||
$this->shpData['numparts'] = count($this->shpData['parts']);
|
||||
$this->shpData['numpoints'] = 1 + ($this->shpData['numpoints'] ?? 0);
|
||||
break;
|
||||
case 8:
|
||||
case 18:
|
||||
case 28:
|
||||
//Adds a new point
|
||||
$this->shpData['points'][] = $point;
|
||||
$this->shpData['numpoints'] = 1 + ($this->shpData['numpoints'] ?? 0);
|
||||
break;
|
||||
default:
|
||||
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->adjustBBox($point);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes point from a record.
|
||||
*
|
||||
* @param int $pointIndex Point index
|
||||
* @param int $partIndex Part index
|
||||
*/
|
||||
public function deletePoint(int $pointIndex = 0, int $partIndex = 0): void
|
||||
{
|
||||
switch ($this->shapeType) {
|
||||
case 0:
|
||||
//Don't delete anything
|
||||
break;
|
||||
case 1:
|
||||
case 11:
|
||||
case 21:
|
||||
//Sets the value of the point to zero
|
||||
$this->shpData['x'] = 0.0;
|
||||
$this->shpData['y'] = 0.0;
|
||||
if (in_array($this->shapeType, [11, 21])) {
|
||||
$this->shpData['m'] = 0.0;
|
||||
}
|
||||
|
||||
if (in_array($this->shapeType, [11])) {
|
||||
$this->shpData['z'] = 0.0;
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
case 13:
|
||||
case 15:
|
||||
case 23:
|
||||
case 25:
|
||||
//Deletes the point from the selected part, if exists
|
||||
if (isset($this->shpData['parts'][$partIndex])
|
||||
&& isset($this->shpData['parts'][$partIndex]['points'][$pointIndex])
|
||||
) {
|
||||
$count = count($this->shpData['parts'][$partIndex]['points']) - 1;
|
||||
for ($i = $pointIndex; $i < $count; ++$i) {
|
||||
$point = $this->shpData['parts'][$partIndex]['points'][$i + 1];
|
||||
$this->shpData['parts'][$partIndex]['points'][$i] = $point;
|
||||
}
|
||||
|
||||
$count = count($this->shpData['parts'][$partIndex]['points']) - 1;
|
||||
unset($this->shpData['parts'][$partIndex]['points'][$count]);
|
||||
|
||||
$this->shpData['numparts'] = count($this->shpData['parts']);
|
||||
--$this->shpData['numpoints'];
|
||||
}
|
||||
|
||||
break;
|
||||
case 8:
|
||||
case 18:
|
||||
case 28:
|
||||
//Deletes the point, if exists
|
||||
if (isset($this->shpData['points'][$pointIndex])) {
|
||||
$count = count($this->shpData['points']) - 1;
|
||||
for ($i = $pointIndex; $i < $count; ++$i) {
|
||||
$this->shpData['points'][$i] = $this->shpData['points'][$i + 1];
|
||||
}
|
||||
|
||||
unset($this->shpData['points'][count($this->shpData['points']) - 1]);
|
||||
|
||||
--$this->shpData['numpoints'];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns length of content.
|
||||
*/
|
||||
public function getContentLength(): ?int
|
||||
{
|
||||
// The content length for a record is the length of the record contents section measured in 16-bit words.
|
||||
// one coordinate makes 4 16-bit words (64 bit double)
|
||||
switch ($this->shapeType) {
|
||||
case 0:
|
||||
$result = 0;
|
||||
break;
|
||||
case 1:
|
||||
$result = 10;
|
||||
break;
|
||||
case 21:
|
||||
$result = 10 + 4;
|
||||
break;
|
||||
case 11:
|
||||
$result = 10 + 8;
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
$count = count($this->shpData['parts']);
|
||||
$result = 22 + 2 * $count;
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$result += 8 * count($this->shpData['parts'][$i]['points']);
|
||||
}
|
||||
|
||||
break;
|
||||
case 23:
|
||||
case 25:
|
||||
$count = count($this->shpData['parts']);
|
||||
$result = 22 + (2 * 4) + 2 * $count;
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$result += (8 + 4) * count($this->shpData['parts'][$i]['points']);
|
||||
}
|
||||
|
||||
break;
|
||||
case 13:
|
||||
case 15:
|
||||
$count = count($this->shpData['parts']);
|
||||
$result = 22 + (4 * 4) + 2 * $count;
|
||||
for ($i = 0; $i < $count; ++$i) {
|
||||
$result += (8 + 8) * count($this->shpData['parts'][$i]['points']);
|
||||
}
|
||||
|
||||
break;
|
||||
case 8:
|
||||
$result = 20 + 8 * count($this->shpData['points']);
|
||||
break;
|
||||
case 28:
|
||||
$result = 20 + (2 * 4) + (8 + 4) * count($this->shpData['points']);
|
||||
break;
|
||||
case 18:
|
||||
$result = 20 + (4 * 4) + (8 + 8) * count($this->shpData['points']);
|
||||
break;
|
||||
default:
|
||||
$result = null;
|
||||
$this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function loadDBFData(): void
|
||||
{
|
||||
$this->dbfData = @dbase_get_record_with_names($this->dbfFile, $this->recordNumber);
|
||||
unset($this->dbfData['deleted']);
|
||||
}
|
||||
|
||||
private function saveDBFData(): void
|
||||
{
|
||||
if (count($this->dbfData) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
unset($this->dbfData['deleted']);
|
||||
if ($this->recordNumber <= dbase_numrecords($this->dbfFile)) {
|
||||
if (! dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
|
||||
$this->setError('I wasn\'t possible to update the information in the DBF file.');
|
||||
}
|
||||
} else {
|
||||
if (! dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
|
||||
$this->setError('I wasn\'t possible to add the information to the DBF file.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets error message.
|
||||
*/
|
||||
public function setError(string $error): void
|
||||
{
|
||||
$this->lastError = $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns shape name.
|
||||
*/
|
||||
public function getShapeName(): string
|
||||
{
|
||||
return Util::nameShape($this->shapeType);
|
||||
}
|
||||
}
|
||||
126
pma/vendor/phpmyadmin/shapefile/src/Util.php
vendored
Normal file
126
pma/vendor/phpmyadmin/shapefile/src/Util.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* phpMyAdmin ShapeFile library
|
||||
* <https://github.com/phpmyadmin/shapefile/>.
|
||||
*
|
||||
* Copyright 2006-2007 Ovidio <ovidio AT users.sourceforge.net>
|
||||
* Copyright 2016 - 2017 Michal Čihař <michal@cihar.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, you can download one from
|
||||
* https://www.gnu.org/copyleft/gpl.html.
|
||||
*/
|
||||
|
||||
namespace PhpMyAdmin\ShapeFile;
|
||||
|
||||
use function current;
|
||||
use function pack;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function unpack;
|
||||
|
||||
class Util
|
||||
{
|
||||
/** @var bool|null */
|
||||
private static $littleEndian = null;
|
||||
|
||||
/** @var array */
|
||||
private static $shapeNames = [
|
||||
0 => 'Null Shape',
|
||||
1 => 'Point',
|
||||
3 => 'PolyLine',
|
||||
5 => 'Polygon',
|
||||
8 => 'MultiPoint',
|
||||
11 => 'PointZ',
|
||||
13 => 'PolyLineZ',
|
||||
15 => 'PolygonZ',
|
||||
18 => 'MultiPointZ',
|
||||
21 => 'PointM',
|
||||
23 => 'PolyLineM',
|
||||
25 => 'PolygonM',
|
||||
28 => 'MultiPointM',
|
||||
31 => 'MultiPatch',
|
||||
];
|
||||
|
||||
/**
|
||||
* Reads data.
|
||||
*
|
||||
* @param string $type type for unpack()
|
||||
* @param string|false $data Data to process
|
||||
*
|
||||
* @return mixed|false
|
||||
*/
|
||||
public static function loadData(string $type, $data)
|
||||
{
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($data) === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmp = unpack($type, $data);
|
||||
|
||||
return $tmp === false ? $tmp : current($tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes endianity.
|
||||
*
|
||||
* @param string $binValue Binary value
|
||||
*/
|
||||
public static function swap(string $binValue): string
|
||||
{
|
||||
$result = $binValue[strlen($binValue) - 1];
|
||||
for ($i = strlen($binValue) - 2; $i >= 0; --$i) {
|
||||
$result .= $binValue[$i];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes double value to correct endianity.
|
||||
*
|
||||
* @param float $value Value to pack
|
||||
*/
|
||||
public static function packDouble(float $value): string
|
||||
{
|
||||
$bin = pack('d', (float) $value);
|
||||
|
||||
if (self::$littleEndian === null) {
|
||||
self::$littleEndian = (pack('L', 1) === pack('V', 1));
|
||||
}
|
||||
|
||||
if (self::$littleEndian) {
|
||||
return $bin;
|
||||
}
|
||||
|
||||
return self::swap($bin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns shape name.
|
||||
*/
|
||||
public static function nameShape(int $type): string
|
||||
{
|
||||
if (isset(self::$shapeNames[$type])) {
|
||||
return self::$shapeNames[$type];
|
||||
}
|
||||
|
||||
return sprintf('Shape %d', $type);
|
||||
}
|
||||
}
|
||||
519
pma/vendor/phpmyadmin/sql-parser/CHANGELOG.md
vendored
Normal file
519
pma/vendor/phpmyadmin/sql-parser/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,519 @@
|
||||
# Change Log
|
||||
|
||||
## [5.7.0] - 2023-01-25
|
||||
|
||||
* Performance improvement to use less the `nextToken()` function (#397)
|
||||
* Lexer - Solving ambiguity on function keywords (#385)
|
||||
* Implement `ALTER EVENT` (#404)
|
||||
* Add `ALTER EVENT` keywords (#404)
|
||||
* Drop PHP 7.1 support
|
||||
* Fix the alter operation table options `RENAME INDEX x TO y` (#405)
|
||||
* Fix `CreateStatement` function's options (#406)
|
||||
* Fix a PHP notice on Linter using `ANALYZE` (#413)
|
||||
|
||||
## [5.6.0] - 2023-01-02
|
||||
|
||||
* Add missing return types annotations
|
||||
* Improve the WITH statements parser (#363)
|
||||
* Add support for passing `Context::SQL_MODE*` constants to `Context::setMode` method
|
||||
* Fix additional body tokens issue with `CREATE VIEW` statements (#371)
|
||||
* Exclude from composer vendor bundle /tests and /phpunit.xml.dist
|
||||
* Support table structure with `COMPRESSED` columns (#351)
|
||||
* Add `#[\AllowDynamicProperties]` on `Statement` and `Expression` classes for PHP 8.2 support
|
||||
* Support `ALTER` queries of `PARTITIONS` (#329)
|
||||
* Fixed differentiating between `ANALYZE` and `EXPLAIN` statements (#386)
|
||||
* Added "NOT" to the select options (#374)
|
||||
* Implement the `EXPLAIN` Parser (#389)
|
||||
* Context: Updated contexts to contain `multipoint` and `multipolygon` data types (#393)
|
||||
* Support more keywords on `Expression` component (#399)
|
||||
* Fix PHP 8.3 failing tests (#400)
|
||||
|
||||
## [5.5.0] - 2021-12-08
|
||||
|
||||
* Add WITH support (#165, #331)
|
||||
* 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 PHP 8.1 fatal errors on classes that "implements ArrayAccess"
|
||||
* Add new contexts for MariaDB 10.4, 10.5, 10.6 (#328)
|
||||
* 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 expressions (#347)
|
||||
* Added support for MySQL 8.0 table structure KEY expressions (#347)
|
||||
* Added support for KEY order (ASC/DESC) (#296)
|
||||
* Added missing KEY options for MySQL and MariaDB (#348)
|
||||
* Added support for ENFORCED and NOT ENFORCED on table create queries (#341)
|
||||
* Performance improvement to use less the "ord()" function (#352)
|
||||
* Added support for OVER() with an alias (AS) (#197)
|
||||
|
||||
## [5.4.2] - 2021-02-05
|
||||
|
||||
* Added check for quoted symbol to avoid parser error in case of keyword (#317)
|
||||
* Allow PHP 8
|
||||
|
||||
## [5.4.1] - 2020-10-15
|
||||
|
||||
* Fix array_key_exists warning when parsing a "DEFAULT FALSE" token (#299)
|
||||
|
||||
## [5.4.0] - 2020-10-08
|
||||
|
||||
* EXISTS is also a function. (#297)
|
||||
* 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)
|
||||
|
||||
## [5.3.1] - 2020-03-20
|
||||
|
||||
* Revert some changes with the understanding of ANSI_QUOTES mode and identifiers
|
||||
* Suggest motranslator 5.0 in README
|
||||
|
||||
## [5.3.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 9
|
||||
* Allow phpmyadmin/motranslator 5.0
|
||||
* 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)
|
||||
|
||||
## [5.2.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)
|
||||
|
||||
## [5.1.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)
|
||||
|
||||
## [5.0.0] - 2019-05-09
|
||||
|
||||
* Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
|
||||
* Enable strict mode on PHP files
|
||||
* 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.7.4] - YYYY-MM-DD
|
||||
|
||||
## [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)
|
||||
* 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
|
||||
|
||||
Backport fixes from 5.0.0 to QA branch:
|
||||
|
||||
* 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.
|
||||
339
pma/vendor/phpmyadmin/sql-parser/LICENSE.txt
vendored
Normal file
339
pma/vendor/phpmyadmin/sql-parser/LICENSE.txt
vendored
Normal 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.
|
||||
137
pma/vendor/phpmyadmin/sql-parser/README.md
vendored
Normal file
137
pma/vendor/phpmyadmin/sql-parser/README.md
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
# 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=master)
|
||||
[](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)
|
||||
[](https://shepherd.dev/github/phpmyadmin/sql-parser)
|
||||
[](https://infection.github.io)
|
||||
|
||||
## 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, ['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(PhpMyAdmin\SqlParser\Context::SQL_MODE_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 `5.0` or newer:
|
||||
|
||||
```sh
|
||||
composer require phpmyadmin/motranslator:^5.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/
|
||||
96
pma/vendor/phpmyadmin/sql-parser/composer.json
vendored
Normal file
96
pma/vendor/phpmyadmin/sql-parser/composer.json
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"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", "sql syntax highlighter", "sql lexer", "sql tokenizer", "sql parser", "sql linter", "query linter"],
|
||||
"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"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "other",
|
||||
"url": "https://www.phpmyadmin.net/donate/"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"symfony/polyfill-mbstring": "^1.3",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbench/phpbench": "^1.1",
|
||||
"phpmyadmin/coding-standard": "^3.0",
|
||||
"phpmyadmin/motranslator": "^4.0 || ^5.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.9.12",
|
||||
"phpstan/phpstan-phpunit": "^1.3.3",
|
||||
"phpunit/php-code-coverage": "*",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
|
||||
"psalm/plugin-phpunit": "^0.16.1",
|
||||
"vimeo/psalm": "^4.11",
|
||||
"zumba/json-serializer": "^3.0"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"phpcbf": "@php phpcbf",
|
||||
"phpcs": "@php phpcs",
|
||||
"phpstan": "@php phpstan analyse",
|
||||
"psalm": "@php psalm --no-diff",
|
||||
"phpunit": "@php phpunit --color=always",
|
||||
"phpbench": "@php phpbench run tests/benchmarks --report=aggregate",
|
||||
"test": [
|
||||
"@phpcs",
|
||||
"@phpstan",
|
||||
"@psalm",
|
||||
"@phpunit"
|
||||
],
|
||||
"update:baselines": [
|
||||
"@php phpstan analyse --generate-baseline",
|
||||
"@php psalm --set-baseline=psalm-baseline.xml"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
"exclude": [
|
||||
"/tests",
|
||||
"/phpunit.xml.dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
73
pma/vendor/phpmyadmin/sql-parser/src/Component.php
vendored
Normal file
73
pma/vendor/phpmyadmin/sql-parser/src/Component.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
use Exception;
|
||||
use Stringable;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* A component (of a statement) is a part of a statement that is common to multiple query types.
|
||||
*/
|
||||
abstract class Component implements Stringable
|
||||
{
|
||||
/**
|
||||
* 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<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws Exception not implemented yet.
|
||||
*/
|
||||
public static function parse(
|
||||
Parser $parser,
|
||||
TokensList $list,
|
||||
array $options = []
|
||||
) {
|
||||
// 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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws Exception not implemented yet.
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
539
pma/vendor/phpmyadmin/sql-parser/src/Components/AlterOperation.php
vendored
Normal file
539
pma/vendor/phpmyadmin/sql-parser/src/Components/AlterOperation.php
vendored
Normal file
@@ -0,0 +1,539 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function array_key_exists;
|
||||
use function in_array;
|
||||
use function is_numeric;
|
||||
use function is_string;
|
||||
|
||||
/**
|
||||
* Parses an alter operation.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class AlterOperation extends Component
|
||||
{
|
||||
/**
|
||||
* All database options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $DB_OPTIONS = [
|
||||
'CHARACTER SET' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'CHARSET' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'DEFAULT CHARACTER SET' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'DEFAULT CHARSET' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'UPGRADE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'COLLATE' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'DEFAULT COLLATE' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* All table options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $TABLE_OPTIONS = [
|
||||
'ENGINE' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'AUTO_INCREMENT' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'AVG_ROW_LENGTH' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'MAX_ROWS' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'ROW_FORMAT' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'COMMENT' => [
|
||||
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,
|
||||
'REBUILD' => 1,
|
||||
'REMOVE' => 1,
|
||||
'RENAME' => 1,
|
||||
'REORGANIZE' => 1,
|
||||
'REPAIR' => 1,
|
||||
'UPGRADE' => 1,
|
||||
|
||||
'COLUMN' => 2,
|
||||
'CONSTRAINT' => 2,
|
||||
'DEFAULT' => 2,
|
||||
'BY' => 2,
|
||||
'FOREIGN' => 2,
|
||||
'FULLTEXT' => 2,
|
||||
'KEY' => 2,
|
||||
'KEYS' => 2,
|
||||
'PARTITION' => 2,
|
||||
'PARTITION BY' => 2,
|
||||
'PARTITIONING' => 2,
|
||||
'PRIMARY KEY' => 2,
|
||||
'SPATIAL' => 2,
|
||||
'TABLESPACE' => 2,
|
||||
'INDEX' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
|
||||
'CHARACTER SET' => 3,
|
||||
'TO' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* All user options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $USER_OPTIONS = [
|
||||
'ATTRIBUTE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'COMMENT' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'REQUIRE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'BY' => [
|
||||
2,
|
||||
'expr',
|
||||
],
|
||||
'PASSWORD' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'WITH' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
|
||||
'ACCOUNT' => 1,
|
||||
'DEFAULT' => 1,
|
||||
|
||||
'LOCK' => 2,
|
||||
'UNLOCK' => 2,
|
||||
|
||||
'IDENTIFIED' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* All view options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $VIEW_OPTIONS = ['AS' => 1];
|
||||
|
||||
/**
|
||||
* All event options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $EVENT_OPTIONS = [
|
||||
'ON SCHEDULE' => 1,
|
||||
'EVERY' => [
|
||||
2,
|
||||
'expr',
|
||||
],
|
||||
'AT' => [
|
||||
2,
|
||||
'expr',
|
||||
],
|
||||
'STARTS' => [
|
||||
3,
|
||||
'expr',
|
||||
],
|
||||
'ENDS' => [
|
||||
4,
|
||||
'expr',
|
||||
],
|
||||
'ON COMPLETION PRESERVE' => 5,
|
||||
'ON COMPLETION NOT PRESERVE' => 5,
|
||||
'RENAME' => 6,
|
||||
'TO' => [
|
||||
7,
|
||||
'var',
|
||||
],
|
||||
'ENABLE' => 8,
|
||||
'DISABLE' => 8,
|
||||
'DISABLE ON SLAVE' => 8,
|
||||
'COMMENT' => [
|
||||
9,
|
||||
'var',
|
||||
],
|
||||
'DO' => 10,
|
||||
];
|
||||
|
||||
/**
|
||||
* Options of this operation.
|
||||
*
|
||||
* @var OptionsArray
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* The altered field.
|
||||
*
|
||||
* @var Expression|string|null
|
||||
*/
|
||||
public $field;
|
||||
|
||||
/**
|
||||
* The partitions.
|
||||
*
|
||||
* @var Component[]|ArrayObj|null
|
||||
*/
|
||||
public $partitions;
|
||||
|
||||
/**
|
||||
* Unparsed tokens.
|
||||
*
|
||||
* @var Token[]|string
|
||||
*/
|
||||
public $unknown = [];
|
||||
|
||||
/**
|
||||
* @param OptionsArray $options options of alter operation
|
||||
* @param Expression|string|null $field altered field
|
||||
* @param Component[]|ArrayObj|null $partitions partitions definition found in the operation
|
||||
* @param Token[] $unknown unparsed tokens found at the end of operation
|
||||
*/
|
||||
public function __construct(
|
||||
$options = null,
|
||||
$field = null,
|
||||
$partitions = null,
|
||||
$unknown = []
|
||||
) {
|
||||
$this->partitions = $partitions;
|
||||
$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<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return AlterOperation
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ options ]---------------------> 1
|
||||
*
|
||||
* 1 ----------------------[ field ]----------------------> 2
|
||||
*
|
||||
* 1 -------------[ PARTITION / PARTITION BY ]------------> 3
|
||||
*
|
||||
* 2 -------------------------[ , ]-----------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* partition state.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$partitionState = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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);
|
||||
|
||||
// Not only when aliasing but also when parsing the body of an event, we just list the tokens of the
|
||||
// body in the unknown tokens list, as they define their own statements.
|
||||
if ($ret->options->has('AS') || $ret->options->has('DO')) {
|
||||
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;
|
||||
if ($ret->options->has('PARTITION') || $token->value === 'PARTITION BY') {
|
||||
$state = 3;
|
||||
$list->getPrevious(); // in order to check whether it's partition or partition by.
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
$ret->field = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'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) {
|
||||
if (is_string($token->value) || is_numeric($token->value)) {
|
||||
$arrayKey = $token->value;
|
||||
} else {
|
||||
$arrayKey = $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])) {
|
||||
$list->idx++; // Ignore the current token
|
||||
$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($arrayKey, self::$DB_OPTIONS)
|
||||
|| array_key_exists($arrayKey, self::$TABLE_OPTIONS))
|
||||
&& ! self::checkIfColumnDefinitionKeyword($arrayKey)
|
||||
) {
|
||||
// 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;
|
||||
} elseif ($state === 3) {
|
||||
if ($partitionState === 0) {
|
||||
$list->idx++; // Ignore the current token
|
||||
$nextToken = $list->getNext();
|
||||
if (
|
||||
($token->type === Token::TYPE_KEYWORD)
|
||||
&& (($token->keyword === 'PARTITION BY')
|
||||
|| ($token->keyword === 'PARTITION' && $nextToken && $nextToken->value !== '('))
|
||||
) {
|
||||
$partitionState = 1;
|
||||
} elseif (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'PARTITION')) {
|
||||
$partitionState = 2;
|
||||
}
|
||||
|
||||
--$list->idx; // to decrease the idx by one, because the last getNext returned and increased it.
|
||||
|
||||
// reverting the effect of the getNext
|
||||
$list->getPrevious();
|
||||
$list->getPrevious();
|
||||
|
||||
++$list->idx; // to index the idx by one, because the last getPrevious returned and decreased it.
|
||||
} elseif ($partitionState === 1) {
|
||||
// Building the expression used for partitioning.
|
||||
if (empty($ret->field)) {
|
||||
$ret->field = '';
|
||||
}
|
||||
|
||||
$ret->field .= $token->type === Token::TYPE_WHITESPACE ? ' ' : $token->token;
|
||||
} elseif ($partitionState === 2) {
|
||||
$ret->partitions = ArrayObj::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['type' => PartitionDefinition::class]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$ret = $component->options . ' ';
|
||||
if (isset($component->field) && ($component->field !== '')) {
|
||||
$ret .= $component->field . ' ';
|
||||
}
|
||||
|
||||
$ret .= TokensList::build($component->unknown);
|
||||
|
||||
if (isset($component->partitions)) {
|
||||
$ret .= PartitionDefinition::build($component->partitions);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
$commonOptions = [
|
||||
'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, $commonOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
126
pma/vendor/phpmyadmin/sql-parser/src/Components/Array2d.php
vendored
Normal file
126
pma/vendor/phpmyadmin/sql-parser/src/Components/Array2d.php
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
use PhpMyAdmin\SqlParser\Translator;
|
||||
|
||||
use function count;
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* `VALUES` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
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<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return ArrayObj[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
$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 !== '(') {
|
||||
break;
|
||||
}
|
||||
|
||||
$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;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->value !== ',') {
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
return ArrayObj::build($component);
|
||||
}
|
||||
}
|
||||
181
pma/vendor/phpmyadmin/sql-parser/src/Components/ArrayObj.php
vendored
Normal file
181
pma/vendor/phpmyadmin/sql-parser/src/Components/ArrayObj.php
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses an array.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ArrayObj extends Component
|
||||
{
|
||||
/**
|
||||
* The array that contains the unprocessed value of each token.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $raw = [];
|
||||
|
||||
/**
|
||||
* The array that contains the processed value of each token.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $values = [];
|
||||
|
||||
/**
|
||||
* @param string[] $raw the unprocessed values
|
||||
* @param string[] $values the processed values
|
||||
*/
|
||||
public function __construct(array $raw = [], array $values = [])
|
||||
{
|
||||
$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<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return ArrayObj|Component[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = empty($options['type']) ? new static() : [];
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
$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']) ? [] : $options['typeOptions']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Handling last element.
|
||||
//
|
||||
// This is treated differently to treat the following cases:
|
||||
//
|
||||
// => []
|
||||
// [,] => ['', '']
|
||||
// [] => []
|
||||
// [a,] => ['a', '']
|
||||
// [a] => ['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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
if (! empty($component->raw)) {
|
||||
return '(' . implode(', ', $component->raw) . ')';
|
||||
}
|
||||
|
||||
return '(' . implode(', ', $component->values) . ')';
|
||||
}
|
||||
}
|
||||
303
pma/vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php
vendored
Normal file
303
pma/vendor/phpmyadmin/sql-parser/src/Components/CaseExpression.php
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Parses a reference to a CASE expression.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class CaseExpression extends Component
|
||||
{
|
||||
/**
|
||||
* The value to be compared.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* The conditions in WHEN clauses.
|
||||
*
|
||||
* @var Condition[][]
|
||||
*/
|
||||
public $conditions = [];
|
||||
|
||||
/**
|
||||
* The results matching with the WHEN clauses.
|
||||
*
|
||||
* @var Expression[]
|
||||
*/
|
||||
public $results = [];
|
||||
|
||||
/**
|
||||
* The values to be compared against.
|
||||
*
|
||||
* @var Expression[]
|
||||
*/
|
||||
public $compare_values = [];
|
||||
|
||||
/**
|
||||
* The result in ELSE section of expr.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $else_result;
|
||||
|
||||
/**
|
||||
* The alias of this CASE statement.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $alias;
|
||||
|
||||
/**
|
||||
* The sub-expression.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $expr = '';
|
||||
|
||||
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<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return CaseExpression
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
$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'
|
||||
$newCondition = Condition::parse($parser, $list);
|
||||
$type = 1;
|
||||
$state = 1;
|
||||
$ret->conditions[] = $newCondition;
|
||||
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'
|
||||
$newValue = Expression::parse($parser, $list);
|
||||
$state = 2;
|
||||
$ret->compare_values[] = $newValue;
|
||||
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'
|
||||
$newResult = Expression::parse($parser, $list);
|
||||
$state = 0;
|
||||
$ret->results[] = $newResult;
|
||||
} 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'
|
||||
$newResult = Expression::parse($parser, $list);
|
||||
$ret->results[] = $newResult;
|
||||
$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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$ret = 'CASE ';
|
||||
if (isset($component->value)) {
|
||||
// Syntax type 0
|
||||
$ret .= $component->value . ' ';
|
||||
$valuesCount = count($component->compare_values);
|
||||
$resultsCount = count($component->results);
|
||||
for ($i = 0; $i < $valuesCount && $i < $resultsCount; ++$i) {
|
||||
$ret .= 'WHEN ' . $component->compare_values[$i] . ' ';
|
||||
$ret .= 'THEN ' . $component->results[$i] . ' ';
|
||||
}
|
||||
} else {
|
||||
// Syntax type 1
|
||||
$valuesCount = count($component->conditions);
|
||||
$resultsCount = count($component->results);
|
||||
for ($i = 0; $i < $valuesCount && $i < $resultsCount; ++$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;
|
||||
}
|
||||
}
|
||||
239
pma/vendor/phpmyadmin/sql-parser/src/Components/Condition.php
vendored
Normal file
239
pma/vendor/phpmyadmin/sql-parser/src/Components/Condition.php
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `WHERE` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Condition extends Component
|
||||
{
|
||||
/**
|
||||
* Logical operators that can be used to delimit expressions.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public static $DELIMITERS = [
|
||||
'&&',
|
||||
'||',
|
||||
'AND',
|
||||
'OR',
|
||||
'XOR',
|
||||
];
|
||||
|
||||
/**
|
||||
* List of allowed reserved keywords in conditions.
|
||||
*
|
||||
* @var array<string, int>
|
||||
*/
|
||||
public static $ALLOWED_KEYWORDS = [
|
||||
'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,
|
||||
'SOUNDS' => 1,
|
||||
'XOR' => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* Identifiers recognized.
|
||||
*
|
||||
* @var array<int, mixed>
|
||||
*/
|
||||
public $identifiers = [];
|
||||
|
||||
/**
|
||||
* Whether this component is an operator.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isOperator = false;
|
||||
|
||||
/**
|
||||
* The condition.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* @param string $expr the condition or the operator
|
||||
*/
|
||||
public function __construct($expr = null)
|
||||
{
|
||||
$this->expr = trim((string) $expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Condition[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
$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 static($token->value);
|
||||
$expr->isOperator = true;
|
||||
$ret[] = $expr;
|
||||
|
||||
// Preparing to parse another condition.
|
||||
$expr = new static();
|
||||
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)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($token->value, $expr->identifiers)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$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<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(' ', $component);
|
||||
}
|
||||
|
||||
return $component->expr;
|
||||
}
|
||||
}
|
||||
362
pma/vendor/phpmyadmin/sql-parser/src/Components/CreateDefinition.php
vendored
Normal file
362
pma/vendor/phpmyadmin/sql-parser/src/Components/CreateDefinition.php
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses the create definition of a column or a key.
|
||||
*
|
||||
* Used for parsing `CREATE TABLE` statement.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class CreateDefinition extends Component
|
||||
{
|
||||
/**
|
||||
* All field options.
|
||||
*
|
||||
* @var array<string, bool|int|array<int, int|string|array<string, bool>>>
|
||||
* @psalm-var array<string, (bool|positive-int|array{
|
||||
* 0: positive-int,
|
||||
* 1: ('var'|'var='|'expr'|'expr='),
|
||||
* 2?: array<string, bool>
|
||||
* })>
|
||||
*/
|
||||
public static $FIELD_OPTIONS = [
|
||||
// Tells the `OptionsArray` to not sort the options.
|
||||
// See the note below.
|
||||
'_UNSORTED' => true,
|
||||
|
||||
'NOT NULL' => 1,
|
||||
'NULL' => 1,
|
||||
'DEFAULT' => [
|
||||
2,
|
||||
'expr',
|
||||
['breakOnAlias' => true],
|
||||
],
|
||||
/* Following are not according to grammar, but MySQL happily accepts
|
||||
* these at any location */
|
||||
'CHARSET' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'COLLATE' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'AUTO_INCREMENT' => 3,
|
||||
'PRIMARY' => 4,
|
||||
'PRIMARY KEY' => 4,
|
||||
'UNIQUE' => 4,
|
||||
'UNIQUE KEY' => 4,
|
||||
'COMMENT' => [
|
||||
5,
|
||||
'var',
|
||||
],
|
||||
'COLUMN_FORMAT' => [
|
||||
6,
|
||||
'var',
|
||||
],
|
||||
'ON UPDATE' => [
|
||||
7,
|
||||
'expr',
|
||||
],
|
||||
|
||||
// Generated columns options.
|
||||
'GENERATED ALWAYS' => 8,
|
||||
'AS' => [
|
||||
9,
|
||||
'expr',
|
||||
['parenthesesDelimited' => true],
|
||||
],
|
||||
'VIRTUAL' => 10,
|
||||
'PERSISTENT' => 11,
|
||||
'STORED' => 11,
|
||||
'CHECK' => [
|
||||
12,
|
||||
'expr',
|
||||
['parenthesesDelimited' => true],
|
||||
],
|
||||
'INVISIBLE' => 13,
|
||||
'ENFORCED' => 14,
|
||||
'NOT' => 15,
|
||||
'COMPRESSED' => 16,
|
||||
// Common entries.
|
||||
//
|
||||
// NOTE: Some of the common options are not in the same order which
|
||||
// causes troubles when checking if the options are in the right order.
|
||||
// I should find a way to define multiple sets of options and make the
|
||||
// parser select the right set.
|
||||
//
|
||||
// 'UNIQUE' => 4,
|
||||
// 'UNIQUE KEY' => 4,
|
||||
// 'COMMENT' => [5, 'var'],
|
||||
// 'NOT NULL' => 1,
|
||||
// 'NULL' => 1,
|
||||
// 'PRIMARY' => 4,
|
||||
// 'PRIMARY KEY' => 4,
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of the new column.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Whether this field is a constraint or not.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $isConstraint;
|
||||
|
||||
/**
|
||||
* The data type of thew new column.
|
||||
*
|
||||
* @var DataType|null
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* The key.
|
||||
*
|
||||
* @var Key|null
|
||||
*/
|
||||
public $key;
|
||||
|
||||
/**
|
||||
* The table that is referenced.
|
||||
*
|
||||
* @var Reference|null
|
||||
*/
|
||||
public $references;
|
||||
|
||||
/**
|
||||
* The options of this field.
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param string|null $name the name of the field
|
||||
* @param OptionsArray|null $options the options of this field
|
||||
* @param DataType|Key|null $type the data type of this field or the key
|
||||
* @param bool $isConstraint whether this field is a constraint or not
|
||||
* @param Reference|null $references references
|
||||
*/
|
||||
public function __construct(
|
||||
$name = null,
|
||||
$options = null,
|
||||
$type = null,
|
||||
$isConstraint = false,
|
||||
$references = null
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->options = $options;
|
||||
if ($type instanceof DataType) {
|
||||
$this->type = $type;
|
||||
} elseif ($type instanceof Key) {
|
||||
$this->key = $type;
|
||||
$this->isConstraint = $isConstraint;
|
||||
$this->references = $references;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return CreateDefinition[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -----------------------[ ( ]------------------------> 1
|
||||
*
|
||||
* 1 --------------------[ CONSTRAINT ]------------------> 1
|
||||
* 1 -----------------------[ key ]----------------------> 2
|
||||
* 1 -------------[ constraint / column name ]-----------> 2
|
||||
*
|
||||
* 2 --------------------[ data type ]-------------------> 3
|
||||
*
|
||||
* 3 ---------------------[ options ]--------------------> 4
|
||||
*
|
||||
* 4 --------------------[ REFERENCES ]------------------> 4
|
||||
*
|
||||
* 5 ------------------------[ , ]-----------------------> 1
|
||||
* 5 ------------------------[ ) ]-----------------------> 6 (-1)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if (($token->type !== Token::TYPE_OPERATOR) || ($token->value !== '(')) {
|
||||
$parser->error('An opening bracket was expected.', $token);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'CONSTRAINT') {
|
||||
$expr->isConstraint = true;
|
||||
} elseif (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_KEY)) {
|
||||
$expr->key = Key::parse($parser, $list);
|
||||
$state = 4;
|
||||
} elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) {
|
||||
$expr->name = $token->value;
|
||||
if (! $expr->isConstraint) {
|
||||
$state = 2;
|
||||
}
|
||||
} elseif ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->flags & Token::FLAG_KEYWORD_RESERVED) {
|
||||
// Reserved keywords can't be used
|
||||
// as field names without backquotes
|
||||
$parser->error(
|
||||
'A symbol name was expected! '
|
||||
. 'A reserved keyword can not be used '
|
||||
. 'as a column name without backquotes.',
|
||||
$token
|
||||
);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// Non-reserved keywords are allowed without backquotes
|
||||
$expr->name = $token->value;
|
||||
$state = 2;
|
||||
} else {
|
||||
$parser->error('A symbol name was expected!', $token);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
} elseif ($state === 2) {
|
||||
$expr->type = DataType::parse($parser, $list);
|
||||
$state = 3;
|
||||
} elseif ($state === 3) {
|
||||
$expr->options = OptionsArray::parse($parser, $list, static::$FIELD_OPTIONS);
|
||||
$state = 4;
|
||||
} elseif ($state === 4) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'REFERENCES') {
|
||||
++$list->idx; // Skipping keyword 'REFERENCES'.
|
||||
$expr->references = Reference::parse($parser, $list);
|
||||
} else {
|
||||
--$list->idx;
|
||||
}
|
||||
|
||||
$state = 5;
|
||||
} elseif ($state === 5) {
|
||||
if (! empty($expr->type) || ! empty($expr->key)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
$expr = new static();
|
||||
if ($token->value === ',') {
|
||||
$state = 1;
|
||||
} elseif ($token->value === ')') {
|
||||
$state = 6;
|
||||
++$list->idx;
|
||||
break;
|
||||
} else {
|
||||
$parser->error('A comma or a closing bracket was expected.', $token);
|
||||
$state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last iteration was not saved.
|
||||
if (! empty($expr->type) || ! empty($expr->key)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
if (($state !== 0) && ($state !== 6)) {
|
||||
$parser->error('A closing bracket was expected.', $list->tokens[$list->idx - 1]);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CreateDefinition|CreateDefinition[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return "(\n " . implode(",\n ", $component) . "\n)";
|
||||
}
|
||||
|
||||
$tmp = '';
|
||||
|
||||
if ($component->isConstraint) {
|
||||
$tmp .= 'CONSTRAINT ';
|
||||
}
|
||||
|
||||
if (isset($component->name) && ($component->name !== '')) {
|
||||
$tmp .= Context::escape($component->name) . ' ';
|
||||
}
|
||||
|
||||
if (! empty($component->type)) {
|
||||
$tmp .= DataType::build(
|
||||
$component->type,
|
||||
['lowercase' => true]
|
||||
) . ' ';
|
||||
}
|
||||
|
||||
if (! empty($component->key)) {
|
||||
$tmp .= $component->key . ' ';
|
||||
}
|
||||
|
||||
if (! empty($component->references)) {
|
||||
$tmp .= 'REFERENCES ' . $component->references . ' ';
|
||||
}
|
||||
|
||||
$tmp .= $component->options;
|
||||
|
||||
return trim($tmp);
|
||||
}
|
||||
}
|
||||
175
pma/vendor/phpmyadmin/sql-parser/src/Components/DataType.php
vendored
Normal file
175
pma/vendor/phpmyadmin/sql-parser/src/Components/DataType.php
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function strtolower;
|
||||
use function strtoupper;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses a data type.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class DataType extends Component
|
||||
{
|
||||
/**
|
||||
* All data type options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $DATA_TYPE_OPTIONS = [
|
||||
'BINARY' => 1,
|
||||
'CHARACTER SET' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'CHARSET' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'COLLATE' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'UNSIGNED' => 4,
|
||||
'ZEROFILL' => 5,
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of the data type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The parameters of this data type.
|
||||
*
|
||||
* Some data types have no parameters.
|
||||
* Numeric types might have parameters for the maximum number of digits,
|
||||
* precision, etc.
|
||||
* String types might have parameters for the maximum length stored.
|
||||
* `ENUM` and `SET` have parameters for possible values.
|
||||
*
|
||||
* For more information, check the MySQL manual.
|
||||
*
|
||||
* @var int[]|string[]
|
||||
*/
|
||||
public $parameters = [];
|
||||
|
||||
/**
|
||||
* The options of this data type.
|
||||
*
|
||||
* @var OptionsArray
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param string $name the name of this data type
|
||||
* @param int[]|string[] $parameters the parameters (size or possible values)
|
||||
* @param OptionsArray $options the options of this data type
|
||||
*/
|
||||
public function __construct(
|
||||
$name = null,
|
||||
array $parameters = [],
|
||||
$options = null
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->parameters = $parameters;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return DataType|null
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -------------------[ data type ]--------------------> 1
|
||||
*
|
||||
* 1 ----------------[ size and options ]----------------> 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->name = strtoupper((string) $token->value);
|
||||
if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
|
||||
$parser->error('Unrecognized data type.', $token);
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$parameters = ArrayObj::parse($parser, $list);
|
||||
++$list->idx;
|
||||
$ret->parameters = ($ret->name === 'ENUM') || ($ret->name === 'SET') ?
|
||||
$parameters->raw : $parameters->values;
|
||||
}
|
||||
|
||||
$ret->options = OptionsArray::parse($parser, $list, static::$DATA_TYPE_OPTIONS);
|
||||
++$list->idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($ret->name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataType $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$name = empty($options['lowercase']) ?
|
||||
$component->name : strtolower($component->name);
|
||||
|
||||
$parameters = '';
|
||||
if (! empty($component->parameters)) {
|
||||
$parameters = '(' . implode(',', $component->parameters) . ')';
|
||||
}
|
||||
|
||||
return trim($name . $parameters . ' ' . $component->options);
|
||||
}
|
||||
}
|
||||
487
pma/vendor/phpmyadmin/sql-parser/src/Components/Expression.php
vendored
Normal file
487
pma/vendor/phpmyadmin/sql-parser/src/Components/Expression.php
vendored
Normal file
@@ -0,0 +1,487 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Exceptions\ParserException;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function rtrim;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses a reference to an expression (column, table or database name, function
|
||||
* call, mathematical expression, etc.).
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
class Expression extends Component
|
||||
{
|
||||
/**
|
||||
* List of allowed reserved keywords in expressions.
|
||||
*
|
||||
* @var array<string, int>
|
||||
*/
|
||||
private static $ALLOWED_KEYWORDS = [
|
||||
'AND' => 1,
|
||||
'AS' => 1,
|
||||
'BETWEEN' => 1,
|
||||
'CASE' => 1,
|
||||
'DUAL' => 1,
|
||||
'DIV' => 1,
|
||||
'IS' => 1,
|
||||
'MOD' => 1,
|
||||
'NOT' => 1,
|
||||
'NOT NULL' => 1,
|
||||
'NULL' => 1,
|
||||
'OR' => 1,
|
||||
'OVER' => 1,
|
||||
'REGEXP' => 1,
|
||||
'RLIKE' => 1,
|
||||
'XOR' => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of this database.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $database;
|
||||
|
||||
/**
|
||||
* The name of this table.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* The name of the column.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $column;
|
||||
|
||||
/**
|
||||
* The sub-expression.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $expr = '';
|
||||
|
||||
/**
|
||||
* The alias of this expression.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $alias;
|
||||
|
||||
/**
|
||||
* The name of the function.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $function;
|
||||
|
||||
/**
|
||||
* The type of subquery.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $subquery;
|
||||
|
||||
/**
|
||||
* Syntax:
|
||||
* new Expression('expr')
|
||||
* new Expression('expr', 'alias')
|
||||
* new Expression('database', 'table', 'column')
|
||||
* new Expression('database', 'table', 'column', 'alias')
|
||||
*
|
||||
* If the database, table or column name is not required, pass an empty
|
||||
* string.
|
||||
*
|
||||
* @param string|null $database The name of the database or the expression.
|
||||
* @param string|null $table The name of the table or the alias of the expression.
|
||||
* @param string|null $column the name of the column
|
||||
* @param string|null $alias the name of the alias
|
||||
*/
|
||||
public function __construct($database = null, $table = null, $column = null, $alias = null)
|
||||
{
|
||||
if (($column === null) && ($alias === null)) {
|
||||
$this->expr = $database; // case 1
|
||||
$this->alias = $table; // case 2
|
||||
} else {
|
||||
$this->database = $database; // case 3
|
||||
$this->table = $table; // case 3
|
||||
$this->column = $column; // case 3
|
||||
$this->alias = $alias; // case 4
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible options:.
|
||||
*
|
||||
* `field`
|
||||
*
|
||||
* First field to be filled.
|
||||
* If this is not specified, it takes the value of `parseField`.
|
||||
*
|
||||
* `parseField`
|
||||
*
|
||||
* Specifies the type of the field parsed. It may be `database`,
|
||||
* `table` or `column`. These expressions may not include
|
||||
* parentheses.
|
||||
*
|
||||
* `breakOnAlias`
|
||||
*
|
||||
* If not empty, breaks when the alias occurs (it is not included).
|
||||
*
|
||||
* `breakOnParentheses`
|
||||
*
|
||||
* If not empty, breaks when the first parentheses occurs.
|
||||
*
|
||||
* `parenthesesDelimited`
|
||||
*
|
||||
* If not empty, breaks after last parentheses occurred.
|
||||
*
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Expression|null
|
||||
*
|
||||
* @throws ParserException
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* Whether current tokens make an expression or a table reference.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$isExpr = false;
|
||||
|
||||
/**
|
||||
* Whether a period was previously found.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$dot = false;
|
||||
|
||||
/**
|
||||
* Whether an alias is expected. Is 2 if `AS` keyword was found.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$alias = false;
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* Keeps track of the last two previous tokens.
|
||||
*
|
||||
* @var Token[]
|
||||
*/
|
||||
$prev = [
|
||||
null,
|
||||
null,
|
||||
];
|
||||
|
||||
// When a field is parsed, no parentheses are expected.
|
||||
if (! empty($options['parseField'])) {
|
||||
$options['breakOnParentheses'] = true;
|
||||
$options['field'] = $options['parseField'];
|
||||
}
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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)) {
|
||||
if ($isExpr) {
|
||||
$ret->expr .= $token->token;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) {
|
||||
// A `(` was previously found and this keyword is the
|
||||
// beginning of a statement, so this is a subquery.
|
||||
$ret->subquery = $token->keyword;
|
||||
} elseif (
|
||||
($token->flags & Token::FLAG_KEYWORD_FUNCTION)
|
||||
&& (empty($options['parseField'])
|
||||
&& ! $alias)
|
||||
) {
|
||||
$isExpr = true;
|
||||
} elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
|
||||
if (empty(self::$ALLOWED_KEYWORDS[$token->keyword])) {
|
||||
// A reserved keyword that is not allowed in the
|
||||
// expression was found so the expression must have
|
||||
// ended and a new clause is starting.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->keyword === 'AS') {
|
||||
if (! empty($options['breakOnAlias'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($alias) {
|
||||
$parser->error('An alias was expected.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$alias = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->keyword === 'CASE') {
|
||||
// For a use of CASE like
|
||||
// 'SELECT a = CASE .... END, b=1, `id`, ... FROM ...'
|
||||
$tempCaseExpr = CaseExpression::parse($parser, $list);
|
||||
$ret->expr .= CaseExpression::build($tempCaseExpr);
|
||||
$isExpr = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
$isExpr = true;
|
||||
} elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
|
||||
/* End of expression */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
($token->type === Token::TYPE_NUMBER)
|
||||
|| ($token->type === Token::TYPE_BOOL)
|
||||
|| (($token->type === Token::TYPE_SYMBOL)
|
||||
&& ($token->flags & Token::FLAG_SYMBOL_VARIABLE))
|
||||
|| (($token->type === Token::TYPE_SYMBOL)
|
||||
&& ($token->flags & Token::FLAG_SYMBOL_PARAMETER))
|
||||
|| (($token->type === Token::TYPE_OPERATOR)
|
||||
&& ($token->value !== '.'))
|
||||
) {
|
||||
if (! empty($options['parseField'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Numbers, booleans and operators (except dot) are usually part
|
||||
// of expressions.
|
||||
$isExpr = true;
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
|
||||
// No brackets were expected.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->value === '(') {
|
||||
++$brackets;
|
||||
if (
|
||||
empty($ret->function) && ($prev[1] !== null)
|
||||
&& (($prev[1]->type === Token::TYPE_NONE)
|
||||
|| ($prev[1]->type === Token::TYPE_SYMBOL)
|
||||
|| (($prev[1]->type === Token::TYPE_KEYWORD)
|
||||
&& ($prev[1]->flags & Token::FLAG_KEYWORD_FUNCTION)))
|
||||
) {
|
||||
$ret->function = $prev[1]->value;
|
||||
}
|
||||
} elseif ($token->value === ')') {
|
||||
if ($brackets === 0) {
|
||||
// Not our bracket
|
||||
break;
|
||||
}
|
||||
|
||||
--$brackets;
|
||||
if ($brackets === 0) {
|
||||
if (! empty($options['parenthesesDelimited'])) {
|
||||
// The current token is the last bracket, the next
|
||||
// one will be outside the expression.
|
||||
$ret->expr .= $token->token;
|
||||
++$list->idx;
|
||||
break;
|
||||
}
|
||||
} elseif ($brackets < 0) {
|
||||
// $parser->error('Unexpected closing bracket.', $token);
|
||||
// $brackets = 0;
|
||||
break;
|
||||
}
|
||||
} elseif ($token->value === ',') {
|
||||
// Expressions are comma-delimited.
|
||||
if ($brackets === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Saving the previous tokens.
|
||||
$prev[0] = $prev[1];
|
||||
$prev[1] = $token;
|
||||
|
||||
if ($alias) {
|
||||
// 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;
|
||||
$alias = false;
|
||||
} elseif ($isExpr) {
|
||||
// Handling aliases.
|
||||
if (
|
||||
$brackets === 0
|
||||
&& ($prev[0] === null
|
||||
|| (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')')
|
||||
&& ($prev[0]->type !== Token::TYPE_KEYWORD
|
||||
|| ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
|
||||
&& (($prev[1]->type === Token::TYPE_STRING)
|
||||
|| ($prev[1]->type === Token::TYPE_SYMBOL
|
||||
&& ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
|
||||
|| ($prev[1]->type === Token::TYPE_NONE))
|
||||
) {
|
||||
if (! empty($ret->alias)) {
|
||||
$parser->error('An alias was previously found.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$ret->alias = $prev[1]->value;
|
||||
} else {
|
||||
$currIdx = $list->idx;
|
||||
--$list->idx;
|
||||
$beforeToken = $list->getPrevious();
|
||||
$list->idx = $currIdx;
|
||||
// columns names tokens are of type NONE, or SYMBOL (`col`), and the columns options
|
||||
// would start with a token of type KEYWORD, in that case, we want to have a space
|
||||
// between the tokens.
|
||||
if (
|
||||
$ret->expr !== null &&
|
||||
$beforeToken &&
|
||||
($beforeToken->type === Token::TYPE_NONE ||
|
||||
$beforeToken->type === Token::TYPE_SYMBOL || $beforeToken->type === Token::TYPE_STRING) &&
|
||||
$token->type === Token::TYPE_KEYWORD
|
||||
) {
|
||||
$ret->expr = rtrim($ret->expr, ' ') . ' ';
|
||||
}
|
||||
|
||||
$ret->expr .= $token->token;
|
||||
}
|
||||
} elseif (! $isExpr) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '.')) {
|
||||
// Found a `.` which means we expect a column name and
|
||||
// the column name we parsed is actually the table name
|
||||
// and the table name is actually a database name.
|
||||
if (! empty($ret->database) || $dot) {
|
||||
$parser->error('Unexpected dot.', $token);
|
||||
}
|
||||
|
||||
$ret->database = $ret->table;
|
||||
$ret->table = $ret->column;
|
||||
$ret->column = null;
|
||||
$dot = true;
|
||||
$ret->expr .= $token->token;
|
||||
} else {
|
||||
$field = empty($options['field']) ? 'column' : $options['field'];
|
||||
if (empty($ret->$field)) {
|
||||
$ret->$field = $token->value;
|
||||
$ret->expr .= $token->token;
|
||||
$dot = false;
|
||||
} else {
|
||||
// No alias is expected.
|
||||
if (! empty($options['breakOnAlias'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (! empty($ret->alias)) {
|
||||
$parser->error('An alias was previously found.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$ret->alias = $token->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($alias) {
|
||||
$parser->error('An alias was expected.', $list->tokens[$list->idx - 1]);
|
||||
}
|
||||
|
||||
// White-spaces might be added at the end.
|
||||
$ret->expr = trim((string) $ret->expr);
|
||||
|
||||
if ($ret->expr === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Expression|Expression[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
if ($component->expr !== '' && $component->expr !== null) {
|
||||
$ret = $component->expr;
|
||||
} else {
|
||||
$fields = [];
|
||||
if (isset($component->database) && ($component->database !== '')) {
|
||||
$fields[] = $component->database;
|
||||
}
|
||||
|
||||
if (isset($component->table) && ($component->table !== '')) {
|
||||
$fields[] = $component->table;
|
||||
}
|
||||
|
||||
if (isset($component->column) && ($component->column !== '')) {
|
||||
$fields[] = $component->column;
|
||||
}
|
||||
|
||||
$ret = implode('.', Context::escape($fields));
|
||||
}
|
||||
|
||||
if (! empty($component->alias)) {
|
||||
$ret .= ' AS ' . Context::escape($component->alias);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
140
pma/vendor/phpmyadmin/sql-parser/src/Components/ExpressionArray.php
vendored
Normal file
140
pma/vendor/phpmyadmin/sql-parser/src/Components/ExpressionArray.php
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Exceptions\ParserException;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function preg_match;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
|
||||
/**
|
||||
* Parses a list of expressions delimited by a comma.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ExpressionArray extends Component
|
||||
{
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Expression[]
|
||||
*
|
||||
* @throws ParserException
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if (
|
||||
($token->type === Token::TYPE_KEYWORD)
|
||||
&& ($token->flags & Token::FLAG_KEYWORD_RESERVED)
|
||||
&& ((~$token->flags & Token::FLAG_KEYWORD_FUNCTION))
|
||||
&& ($token->value !== 'DUAL')
|
||||
&& ($token->value !== 'NULL')
|
||||
&& ($token->value !== 'CASE')
|
||||
&& ($token->value !== 'NOT')
|
||||
) {
|
||||
// No keyword is expected.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->value === 'CASE') {
|
||||
$expr = CaseExpression::parse($parser, $list, $options);
|
||||
} else {
|
||||
$expr = Expression::parse($parser, $list, $options);
|
||||
}
|
||||
|
||||
if ($expr === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
$ret[] = $expr;
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->value !== ',') {
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$parser->error('An expression was expected.', $list->tokens[$list->idx]);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
if (is_array($ret)) {
|
||||
$retIndex = count($ret) - 1;
|
||||
if (isset($ret[$retIndex])) {
|
||||
$expr = $ret[$retIndex]->expr;
|
||||
if (preg_match('/\s*--\s.*$/', $expr, $matches)) {
|
||||
$found = $matches[0];
|
||||
$ret[$retIndex]->expr = substr($expr, 0, strlen($expr) - strlen($found));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Expression[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($component as $frag) {
|
||||
$ret[] = $frag::build($frag);
|
||||
}
|
||||
|
||||
return implode(', ', $ret);
|
||||
}
|
||||
}
|
||||
114
pma/vendor/phpmyadmin/sql-parser/src/Components/FunctionCall.php
vendored
Normal file
114
pma/vendor/phpmyadmin/sql-parser/src/Components/FunctionCall.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Parses a function call.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class FunctionCall extends Component
|
||||
{
|
||||
/**
|
||||
* The name of this function.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The list of parameters.
|
||||
*
|
||||
* @var ArrayObj|null
|
||||
*/
|
||||
public $parameters;
|
||||
|
||||
/**
|
||||
* @param string|null $name the name of the function to be called
|
||||
* @param string[]|ArrayObj|null $parameters the parameters of this function
|
||||
*/
|
||||
public function __construct($name = null, $parameters = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
if (is_array($parameters)) {
|
||||
$this->parameters = new ArrayObj($parameters);
|
||||
} elseif ($parameters instanceof ArrayObj) {
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return FunctionCall
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ----------------------[ name ]-----------------------> 1
|
||||
*
|
||||
* 1 --------------------[ parameters ]-------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->name = $token->value;
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$ret->parameters = ArrayObj::parse($parser, $list);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionCall $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
return $component->name . $component->parameters;
|
||||
}
|
||||
}
|
||||
130
pma/vendor/phpmyadmin/sql-parser/src/Components/GroupKeyword.php
vendored
Normal file
130
pma/vendor/phpmyadmin/sql-parser/src/Components/GroupKeyword.php
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `GROUP BY` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class GroupKeyword extends Component
|
||||
{
|
||||
/** @var mixed */
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* The expression that is used for grouping.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* @param Expression $expr the expression that we are sorting by
|
||||
*/
|
||||
public function __construct($expr = null)
|
||||
{
|
||||
$this->expr = $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return GroupKeyword[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 --------------------[ expression ]-------------------> 1
|
||||
*
|
||||
* 1 ------------------------[ , ]------------------------> 0
|
||||
* 1 -------------------[ ASC / DESC ]--------------------> 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$expr->expr = Expression::parse($parser, $list);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (
|
||||
($token->type === Token::TYPE_KEYWORD)
|
||||
&& (($token->keyword === 'ASC') || ($token->keyword === 'DESC'))
|
||||
) {
|
||||
$expr->type = $token->keyword;
|
||||
} elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last iteration was not processed.
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GroupKeyword|GroupKeyword[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
return trim((string) $component->expr);
|
||||
}
|
||||
}
|
||||
207
pma/vendor/phpmyadmin/sql-parser/src/Components/IndexHint.php
vendored
Normal file
207
pma/vendor/phpmyadmin/sql-parser/src/Components/IndexHint.php
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Parses an Index hint.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class IndexHint extends Component
|
||||
{
|
||||
/**
|
||||
* The type of hint (USE/FORCE/IGNORE)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* What the hint is for (INDEX/KEY)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $indexOrKey;
|
||||
|
||||
/**
|
||||
* The clause for which this hint is (JOIN/ORDER BY/GROUP BY)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $for;
|
||||
|
||||
/**
|
||||
* List of indexes in this hint
|
||||
*
|
||||
* @var Expression[]
|
||||
*/
|
||||
public $indexes = [];
|
||||
|
||||
/**
|
||||
* @param string $type the type of hint (USE/FORCE/IGNORE)
|
||||
* @param string $indexOrKey What the hint is for (INDEX/KEY)
|
||||
* @param string $for the clause for which this hint is (JOIN/ORDER BY/GROUP BY)
|
||||
* @param Expression[] $indexes List of indexes in this hint
|
||||
*/
|
||||
public function __construct(
|
||||
?string $type = null,
|
||||
?string $indexOrKey = null,
|
||||
?string $for = null,
|
||||
array $indexes = []
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->indexOrKey = $indexOrKey;
|
||||
$this->for = $for;
|
||||
$this->indexes = $indexes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return IndexHint|Component[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
$expr = new static();
|
||||
$expr->type = $options['type'] ?? null;
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
* 0 ----------------- [ USE/IGNORE/FORCE ]-----------------> 1
|
||||
* 1 -------------------- [ INDEX/KEY ] --------------------> 2
|
||||
* 2 ----------------------- [ FOR ] -----------------------> 3
|
||||
* 2 -------------------- [ expr_list ] --------------------> 0
|
||||
* 3 -------------- [ JOIN/GROUP BY/ORDER BY ] -------------> 4
|
||||
* 4 -------------------- [ expr_list ] --------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
// By design, the parser will parse first token after the keyword. So, the keyword
|
||||
// must be analyzed too, in order to determine the type of this index hint.
|
||||
if ($list->idx > 0) {
|
||||
--$list->idx;
|
||||
}
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
switch ($state) {
|
||||
case 0:
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword !== 'USE' && $token->keyword !== 'IGNORE' && $token->keyword !== 'FORCE') {
|
||||
break 2;
|
||||
}
|
||||
|
||||
$expr->type = $token->keyword;
|
||||
$state = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword === 'INDEX' || $token->keyword === 'KEY') {
|
||||
$expr->indexOrKey = $token->keyword;
|
||||
} else {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
}
|
||||
|
||||
$state = 2;
|
||||
} else {
|
||||
// we expect the token to be a keyword
|
||||
$parser->error('Unexpected token.', $token);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'FOR') {
|
||||
$state = 3;
|
||||
} else {
|
||||
$expr->indexes = ExpressionArray::parse($parser, $list);
|
||||
$state = 0;
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if (
|
||||
$token->keyword === 'JOIN'
|
||||
|| $token->keyword === 'GROUP BY'
|
||||
|| $token->keyword === 'ORDER BY'
|
||||
) {
|
||||
$expr->for = $token->keyword;
|
||||
} else {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
}
|
||||
|
||||
$state = 4;
|
||||
} else {
|
||||
// we expect the token to be a keyword
|
||||
$parser->error('Unexpected token.', $token);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4:
|
||||
$expr->indexes = ExpressionArray::parse($parser, $list);
|
||||
$state = 0;
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IndexHint|IndexHint[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(' ', $component);
|
||||
}
|
||||
|
||||
$ret = $component->type . ' ' . $component->indexOrKey . ' ';
|
||||
if ($component->for !== null) {
|
||||
$ret .= 'FOR ' . $component->for . ' ';
|
||||
}
|
||||
|
||||
return $ret . ExpressionArray::build($component->indexes);
|
||||
}
|
||||
}
|
||||
298
pma/vendor/phpmyadmin/sql-parser/src/Components/IntoKeyword.php
vendored
Normal file
298
pma/vendor/phpmyadmin/sql-parser/src/Components/IntoKeyword.php
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `INTO` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class IntoKeyword extends Component
|
||||
{
|
||||
/**
|
||||
* FIELDS/COLUMNS Options for `SELECT...INTO` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $FIELDS_OPTIONS = [
|
||||
'TERMINATED BY' => [
|
||||
1,
|
||||
'expr',
|
||||
],
|
||||
'OPTIONALLY' => 2,
|
||||
'ENCLOSED BY' => [
|
||||
3,
|
||||
'expr',
|
||||
],
|
||||
'ESCAPED BY' => [
|
||||
4,
|
||||
'expr',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* LINES Options for `SELECT...INTO` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $LINES_OPTIONS = [
|
||||
'STARTING BY' => [
|
||||
1,
|
||||
'expr',
|
||||
],
|
||||
'TERMINATED BY' => [
|
||||
2,
|
||||
'expr',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Type of target (OUTFILE or SYMBOL).
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* The destination, which can be a table or a file.
|
||||
*
|
||||
* @var string|Expression|null
|
||||
*/
|
||||
public $dest;
|
||||
|
||||
/**
|
||||
* The name of the columns.
|
||||
*
|
||||
* @var string[]|null
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* The values to be selected into (SELECT .. INTO @var1).
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $values;
|
||||
|
||||
/**
|
||||
* Options for FIELDS/COLUMNS keyword.
|
||||
*
|
||||
* @see static::$FIELDS_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $fields_options;
|
||||
|
||||
/**
|
||||
* Whether to use `FIELDS` or `COLUMNS` while building.
|
||||
*
|
||||
* @var bool|null
|
||||
*/
|
||||
public $fields_keyword;
|
||||
|
||||
/**
|
||||
* Options for OPTIONS keyword.
|
||||
*
|
||||
* @see static::$LINES_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $lines_options;
|
||||
|
||||
/**
|
||||
* @param string|null $type type of destination (may be OUTFILE)
|
||||
* @param string|Expression|null $dest actual destination
|
||||
* @param string[]|null $columns column list of destination
|
||||
* @param Expression[]|null $values selected fields
|
||||
* @param OptionsArray|null $fieldsOptions options for FIELDS/COLUMNS keyword
|
||||
* @param bool|null $fieldsKeyword options for OPTIONS keyword
|
||||
*/
|
||||
public function __construct(
|
||||
$type = null,
|
||||
$dest = null,
|
||||
$columns = null,
|
||||
$values = null,
|
||||
$fieldsOptions = null,
|
||||
$fieldsKeyword = null
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->dest = $dest;
|
||||
$this->columns = $columns;
|
||||
$this->values = $values;
|
||||
$this->fields_options = $fieldsOptions;
|
||||
$this->fields_keyword = $fieldsKeyword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return IntoKeyword
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -----------------------[ name ]----------------------> 1
|
||||
* 0 ---------------------[ OUTFILE ]---------------------> 2
|
||||
*
|
||||
* 1 ------------------------[ ( ]------------------------> (END)
|
||||
*
|
||||
* 2 ---------------------[ filename ]--------------------> 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED)) {
|
||||
if (($state === 0) && ($token->keyword === 'OUTFILE')) {
|
||||
$ret->type = 'OUTFILE';
|
||||
$state = 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// No other keyword is expected except for $state = 4, which expects `LINES`
|
||||
if ($state !== 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if (
|
||||
(isset($options['fromInsert'])
|
||||
&& $options['fromInsert'])
|
||||
|| (isset($options['fromReplace'])
|
||||
&& $options['fromReplace'])
|
||||
) {
|
||||
$ret->dest = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => 'table',
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$ret->values = ExpressionArray::parse($parser, $list);
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$ret->columns = ArrayObj::parse($parser, $list)->values;
|
||||
++$list->idx;
|
||||
}
|
||||
|
||||
break;
|
||||
} elseif ($state === 2) {
|
||||
$ret->dest = $token->value;
|
||||
|
||||
$state = 3;
|
||||
} elseif ($state === 3) {
|
||||
$ret->parseFileOptions($parser, $list, $token->value);
|
||||
$state = 4;
|
||||
} elseif ($state === 4) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'LINES') {
|
||||
break;
|
||||
}
|
||||
|
||||
$ret->parseFileOptions($parser, $list, $token->value);
|
||||
$state = 5;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser The parser
|
||||
* @param TokensList $list A token list
|
||||
* @param string $keyword They keyword
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'FIELDS')
|
||||
{
|
||||
++$list->idx;
|
||||
|
||||
if ($keyword === 'FIELDS' || $keyword === 'COLUMNS') {
|
||||
// parse field options
|
||||
$this->fields_options = OptionsArray::parse($parser, $list, static::$FIELDS_OPTIONS);
|
||||
|
||||
$this->fields_keyword = ($keyword === 'FIELDS');
|
||||
} else {
|
||||
// parse line options
|
||||
$this->lines_options = OptionsArray::parse($parser, $list, static::$LINES_OPTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IntoKeyword $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if ($component->dest instanceof Expression) {
|
||||
$columns = ! empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
|
||||
|
||||
return $component->dest . $columns;
|
||||
}
|
||||
|
||||
if (isset($component->values)) {
|
||||
return ExpressionArray::build($component->values);
|
||||
}
|
||||
|
||||
$ret = 'OUTFILE "' . $component->dest . '"';
|
||||
|
||||
$fieldsOptionsString = OptionsArray::build($component->fields_options);
|
||||
if (trim($fieldsOptionsString) !== '') {
|
||||
$ret .= $component->fields_keyword ? ' FIELDS' : ' COLUMNS';
|
||||
$ret .= ' ' . $fieldsOptionsString;
|
||||
}
|
||||
|
||||
$linesOptionsString = OptionsArray::build($component->lines_options, ['expr' => true]);
|
||||
if (trim($linesOptionsString) !== '') {
|
||||
$ret .= ' LINES ' . $linesOptionsString;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
221
pma/vendor/phpmyadmin/sql-parser/src/Components/JoinKeyword.php
vendored
Normal file
221
pma/vendor/phpmyadmin/sql-parser/src/Components/JoinKeyword.php
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function array_search;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* `JOIN` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class JoinKeyword extends Component
|
||||
{
|
||||
/**
|
||||
* Types of join.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static $JOINS = [
|
||||
'CROSS JOIN' => 'CROSS',
|
||||
'FULL JOIN' => 'FULL',
|
||||
'FULL OUTER JOIN' => 'FULL',
|
||||
'INNER JOIN' => 'INNER',
|
||||
'JOIN' => 'JOIN',
|
||||
'LEFT JOIN' => 'LEFT',
|
||||
'LEFT OUTER JOIN' => 'LEFT',
|
||||
'RIGHT JOIN' => 'RIGHT',
|
||||
'RIGHT OUTER JOIN' => 'RIGHT',
|
||||
'NATURAL JOIN' => 'NATURAL',
|
||||
'NATURAL LEFT JOIN' => 'NATURAL LEFT',
|
||||
'NATURAL RIGHT JOIN' => 'NATURAL RIGHT',
|
||||
'NATURAL LEFT OUTER JOIN' => 'NATURAL LEFT OUTER',
|
||||
'NATURAL RIGHT OUTER JOIN' => 'NATURAL RIGHT OUTER',
|
||||
'STRAIGHT_JOIN' => 'STRAIGHT',
|
||||
];
|
||||
|
||||
/**
|
||||
* Type of this join.
|
||||
*
|
||||
* @see static::$JOINS
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Join expression.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* Join conditions.
|
||||
*
|
||||
* @var Condition[]
|
||||
*/
|
||||
public $on;
|
||||
|
||||
/**
|
||||
* Columns in Using clause.
|
||||
*
|
||||
* @var ArrayObj
|
||||
*/
|
||||
public $using;
|
||||
|
||||
/**
|
||||
* @see JoinKeyword::$JOINS
|
||||
*
|
||||
* @param string $type Join type
|
||||
* @param Expression $expr join expression
|
||||
* @param Condition[] $on join conditions
|
||||
* @param ArrayObj $using columns joined
|
||||
*/
|
||||
public function __construct($type = null, $expr = null, $on = null, $using = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->expr = $expr;
|
||||
$this->on = $on;
|
||||
$this->using = $using;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return JoinKeyword[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -----------------------[ JOIN ]----------------------> 1
|
||||
*
|
||||
* 1 -----------------------[ expr ]----------------------> 2
|
||||
*
|
||||
* 2 ------------------------[ ON ]-----------------------> 3
|
||||
* 2 -----------------------[ USING ]---------------------> 4
|
||||
*
|
||||
* 3 --------------------[ conditions ]-------------------> 0
|
||||
*
|
||||
* 4 ----------------------[ columns ]--------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
// By design, the parser will parse first token after the keyword.
|
||||
// In this case, the keyword must be analyzed too, in order to determine
|
||||
// the type of this join.
|
||||
if ($list->idx > 0) {
|
||||
--$list->idx;
|
||||
}
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if (($token->type !== Token::TYPE_KEYWORD) || empty(static::$JOINS[$token->keyword])) {
|
||||
break;
|
||||
}
|
||||
|
||||
$expr->type = static::$JOINS[$token->keyword];
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
$expr->expr = Expression::parse($parser, $list, ['field' => 'table']);
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
switch ($token->keyword) {
|
||||
case 'ON':
|
||||
$state = 3;
|
||||
break;
|
||||
case 'USING':
|
||||
$state = 4;
|
||||
break;
|
||||
default:
|
||||
if (empty(static::$JOINS[$token->keyword])) {
|
||||
/* Next clause is starting */
|
||||
break 2;
|
||||
}
|
||||
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
$expr->type = static::$JOINS[$token->keyword];
|
||||
$state = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ($state === 3) {
|
||||
$expr->on = Condition::parse($parser, $list);
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
} elseif ($state === 4) {
|
||||
$expr->using = ArrayObj::parse($parser, $list);
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($expr->type)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param JoinKeyword[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
foreach ($component as $c) {
|
||||
$ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
|
||||
. (! empty($c->on)
|
||||
? ' ON ' . Condition::build($c->on) : '')
|
||||
. (! empty($c->using)
|
||||
? ' USING ' . ArrayObj::build($c->using) : '');
|
||||
}
|
||||
|
||||
return implode(' ', $ret);
|
||||
}
|
||||
}
|
||||
307
pma/vendor/phpmyadmin/sql-parser/src/Components/Key.php
vendored
Normal file
307
pma/vendor/phpmyadmin/sql-parser/src/Components/Key.php
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses the definition of a key.
|
||||
*
|
||||
* Used for parsing `CREATE TABLE` statement.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Key extends Component
|
||||
{
|
||||
/**
|
||||
* All key options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $KEY_OPTIONS = [
|
||||
'KEY_BLOCK_SIZE' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'USING' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'WITH PARSER' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'COMMENT' => [
|
||||
4,
|
||||
'var',
|
||||
],
|
||||
// MariaDB options
|
||||
'CLUSTERING' => [
|
||||
4,
|
||||
'var=',
|
||||
],
|
||||
'ENGINE_ATTRIBUTE' => [
|
||||
5,
|
||||
'var=',
|
||||
],
|
||||
'SECONDARY_ENGINE_ATTRIBUTE' => [
|
||||
5,
|
||||
'var=',
|
||||
],
|
||||
// MariaDB & MySQL options
|
||||
'VISIBLE' => 6,
|
||||
'INVISIBLE' => 6,
|
||||
// MariaDB options
|
||||
'IGNORED' => 10,
|
||||
'NOT IGNORED' => 10,
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of this key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The key columns
|
||||
*
|
||||
* @var array<int, array<string, int|string>>
|
||||
* @phpstan-var array{name?: string, length?: int, order?: string}[]
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* The type of this key.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* The expression if the Key is not using column names
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $expr = null;
|
||||
|
||||
/**
|
||||
* The options of this key or null if none where found.
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param string $name the name of the key
|
||||
* @param array<int, array<string, int|string>> $columns the columns covered by this key
|
||||
* @param string $type the type of this key
|
||||
* @param OptionsArray $options the options of this key
|
||||
* @phpstan-param array{name?: string, length?: int, order?: string}[] $columns
|
||||
*/
|
||||
public function __construct(
|
||||
$name = null,
|
||||
array $columns = [],
|
||||
$type = null,
|
||||
$options = null
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->columns = $columns;
|
||||
$this->type = $type;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Key
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* Last parsed column.
|
||||
*
|
||||
* @var array<string,mixed>
|
||||
*/
|
||||
$lastColumn = [];
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ type ]---------------------------> 1
|
||||
*
|
||||
* 1 ---------------------[ name ]---------------------------> 1
|
||||
* 1 ---------------------[ columns ]------------------------> 2
|
||||
* 1 ---------------------[ expression ]---------------------> 5
|
||||
*
|
||||
* 2 ---------------------[ column length ]------------------> 3
|
||||
* 3 ---------------------[ column length ]------------------> 2
|
||||
* 2 ---------------------[ options ]------------------------> 4
|
||||
* 5 ---------------------[ expression ]---------------------> 4
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->type = $token->value;
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$positionBeforeSearch = $list->idx;
|
||||
$list->idx++;// Ignore the current token "(" or the search condition will always be true
|
||||
$nextToken = $list->getNext();
|
||||
$list->idx = $positionBeforeSearch;// Restore the position
|
||||
|
||||
if ($nextToken !== null && $nextToken->value === '(') {
|
||||
// Switch to expression mode
|
||||
$state = 5;
|
||||
} else {
|
||||
$state = 2;
|
||||
}
|
||||
} else {
|
||||
$ret->name = $token->value;
|
||||
}
|
||||
} elseif ($state === 2) {
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if ($token->value === '(') {
|
||||
$state = 3;
|
||||
} elseif (($token->value === ',') || ($token->value === ')')) {
|
||||
$state = $token->value === ',' ? 2 : 4;
|
||||
if (! empty($lastColumn)) {
|
||||
$ret->columns[] = $lastColumn;
|
||||
$lastColumn = [];
|
||||
}
|
||||
}
|
||||
} elseif (
|
||||
(
|
||||
$token->type === Token::TYPE_KEYWORD
|
||||
)
|
||||
&&
|
||||
(
|
||||
($token->keyword === 'ASC') || ($token->keyword === 'DESC')
|
||||
)
|
||||
) {
|
||||
$lastColumn['order'] = $token->keyword;
|
||||
} else {
|
||||
$lastColumn['name'] = $token->value;
|
||||
}
|
||||
} elseif ($state === 3) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ')')) {
|
||||
$state = 2;
|
||||
} else {
|
||||
$lastColumn['length'] = $token->value;
|
||||
}
|
||||
} elseif ($state === 4) {
|
||||
$ret->options = OptionsArray::parse($parser, $list, static::$KEY_OPTIONS);
|
||||
++$list->idx;
|
||||
break;
|
||||
} elseif ($state === 5) {
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
// This got back to here and we reached the end of the expression
|
||||
if ($token->value === ')') {
|
||||
$state = 4;// go back to state 4 to fetch options
|
||||
continue;
|
||||
}
|
||||
|
||||
// The expression is not finished, adding a separator for the next expression
|
||||
if ($token->value === ',') {
|
||||
$ret->expr .= ', ';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Start of the expression
|
||||
if ($token->value === '(') {
|
||||
// This is the first expression, set to empty
|
||||
if ($ret->expr === null) {
|
||||
$ret->expr = '';
|
||||
}
|
||||
|
||||
$ret->expr .= Expression::parse($parser, $list, ['parenthesesDelimited' => true]);
|
||||
continue;
|
||||
}
|
||||
// Another unexpected operator was found
|
||||
}
|
||||
|
||||
// Something else than an operator was found
|
||||
$parser->error('Unexpected token.', $token);
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Key $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$ret = $component->type . ' ';
|
||||
if (! empty($component->name)) {
|
||||
$ret .= Context::escape($component->name) . ' ';
|
||||
}
|
||||
|
||||
if ($component->expr !== null) {
|
||||
return $ret . '(' . $component->expr . ') ' . $component->options;
|
||||
}
|
||||
|
||||
$columns = [];
|
||||
foreach ($component->columns as $column) {
|
||||
$tmp = '';
|
||||
if (isset($column['name'])) {
|
||||
$tmp .= Context::escape($column['name']);
|
||||
}
|
||||
|
||||
if (isset($column['length'])) {
|
||||
$tmp .= '(' . $column['length'] . ')';
|
||||
}
|
||||
|
||||
if (isset($column['order'])) {
|
||||
$tmp .= ' ' . $column['order'];
|
||||
}
|
||||
|
||||
$columns[] = $tmp;
|
||||
}
|
||||
|
||||
$ret .= '(' . implode(',', $columns) . ') ' . $component->options;
|
||||
|
||||
return trim($ret);
|
||||
}
|
||||
}
|
||||
123
pma/vendor/phpmyadmin/sql-parser/src/Components/Limit.php
vendored
Normal file
123
pma/vendor/phpmyadmin/sql-parser/src/Components/Limit.php
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* `LIMIT` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Limit extends Component
|
||||
{
|
||||
/**
|
||||
* The number of rows skipped.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $offset;
|
||||
|
||||
/**
|
||||
* The number of rows to be returned.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $rowCount;
|
||||
|
||||
/**
|
||||
* @param int $rowCount the row count
|
||||
* @param int $offset the offset
|
||||
*/
|
||||
public function __construct($rowCount = 0, $offset = 0)
|
||||
{
|
||||
$this->rowCount = $rowCount;
|
||||
$this->offset = $offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Limit
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
$offset = false;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'OFFSET') {
|
||||
if ($offset) {
|
||||
$parser->error('An offset was expected.', $token);
|
||||
}
|
||||
|
||||
$offset = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
|
||||
$ret->offset = $ret->rowCount;
|
||||
$ret->rowCount = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip if not a number
|
||||
if (($token->type !== Token::TYPE_NUMBER)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($offset) {
|
||||
$ret->offset = $token->value;
|
||||
$offset = false;
|
||||
} else {
|
||||
$ret->rowCount = $token->value;
|
||||
}
|
||||
}
|
||||
|
||||
if ($offset) {
|
||||
$parser->error('An offset was expected.', $list->tokens[$list->idx - 1]);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Limit $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
return $component->offset . ', ' . $component->rowCount;
|
||||
}
|
||||
}
|
||||
206
pma/vendor/phpmyadmin/sql-parser/src/Components/LockExpression.php
vendored
Normal file
206
pma/vendor/phpmyadmin/sql-parser/src/Components/LockExpression.php
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Parses a reference to a LOCK expression.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class LockExpression extends Component
|
||||
{
|
||||
/**
|
||||
* The table to be locked.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* The type of lock to be applied.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return LockExpression
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------- [ tbl_name ] -----------------> 1
|
||||
* 1 ---------------- [ lock_type ] ----------------> 2
|
||||
* 2 -------------------- [ , ] --------------------> break
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
$prevToken = null;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if (
|
||||
$token->type === Token::TYPE_DELIMITER
|
||||
|| ($token->type === Token::TYPE_OPERATOR
|
||||
&& $token->value === ',')
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->table = Expression::parse($parser, $list, ['parseField' => 'table']);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
// parse lock type
|
||||
$ret->type = self::parseLockType($parser, $list);
|
||||
$state = 2;
|
||||
}
|
||||
|
||||
$prevToken = $token;
|
||||
}
|
||||
|
||||
// 2 is the only valid end state
|
||||
if ($state !== 2) {
|
||||
$parser->error('Unexpected end of LOCK expression.', $prevToken);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LockExpression|LockExpression[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
return $component->table . ' ' . $component->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private static function parseLockType(Parser $parser, TokensList $list)
|
||||
{
|
||||
$lockType = '';
|
||||
|
||||
/**
|
||||
* The state of the parser while parsing for lock type.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------- [ READ ] -----------------> 1
|
||||
* 0 ------------- [ LOW_PRIORITY ] ------------> 2
|
||||
* 0 ---------------- [ WRITE ] ----------------> 3
|
||||
* 1 ---------------- [ LOCAL ] ----------------> 3
|
||||
* 2 ---------------- [ WRITE ] ----------------> 3
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
$prevToken = null;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if (
|
||||
$token->type === Token::TYPE_DELIMITER
|
||||
|| ($token->type === Token::TYPE_OPERATOR
|
||||
&& $token->value === ',')
|
||||
) {
|
||||
--$list->idx;
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping whitespaces and comments.
|
||||
if ($token->type === Token::TYPE_WHITESPACE || $token->type === Token::TYPE_COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We only expect keywords
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->keyword === 'READ') {
|
||||
$state = 1;
|
||||
} elseif ($token->keyword === 'LOW_PRIORITY') {
|
||||
$state = 2;
|
||||
} elseif ($token->keyword === 'WRITE') {
|
||||
$state = 3;
|
||||
} else {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$lockType .= $token->keyword;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->keyword !== 'LOCAL') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$lockType .= ' ' . $token->keyword;
|
||||
$state = 3;
|
||||
} elseif ($state === 2) {
|
||||
if ($token->keyword !== 'WRITE') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$lockType .= ' ' . $token->keyword;
|
||||
$state = 3; // parsing over
|
||||
}
|
||||
|
||||
$prevToken = $token;
|
||||
}
|
||||
|
||||
// Only two possible end states
|
||||
if ($state !== 1 && $state !== 3) {
|
||||
$parser->error('Unexpected end of Lock expression.', $prevToken);
|
||||
}
|
||||
|
||||
return $lockType;
|
||||
}
|
||||
}
|
||||
381
pma/vendor/phpmyadmin/sql-parser/src/Components/OptionsArray.php
vendored
Normal file
381
pma/vendor/phpmyadmin/sql-parser/src/Components/OptionsArray.php
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
use PhpMyAdmin\SqlParser\Translator;
|
||||
|
||||
use function array_merge_recursive;
|
||||
use function count;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function ksort;
|
||||
use function sprintf;
|
||||
use function strcasecmp;
|
||||
use function strtoupper;
|
||||
|
||||
/**
|
||||
* Parses a list of options.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class OptionsArray extends Component
|
||||
{
|
||||
/**
|
||||
* ArrayObj of selected options.
|
||||
*
|
||||
* @var array<int, mixed>
|
||||
*/
|
||||
public $options = [];
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $options The array of options. Options that have a value
|
||||
* must be an array with at least two keys `name` and
|
||||
* `expr` or `value`.
|
||||
*/
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return OptionsArray
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The ID that will be assigned to duplicate options.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$lastAssignedId = count($options) + 1;
|
||||
|
||||
/**
|
||||
* The option that was processed last time.
|
||||
*/
|
||||
$lastOption = null;
|
||||
|
||||
/**
|
||||
* The index of the option that was processed last time.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$lastOptionId = 0;
|
||||
|
||||
/**
|
||||
* Counts brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$brackets = 0;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ option ]----------------------> 1
|
||||
*
|
||||
* 1 -------------------[ = (optional) ]------------------> 2
|
||||
*
|
||||
* 2 ----------------------[ value ]----------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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 whitespace if not parsing value.
|
||||
if (($token->type === Token::TYPE_WHITESPACE) && ($brackets === 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($lastOption === null) {
|
||||
$upper = strtoupper($token->token);
|
||||
if (! isset($options[$upper])) {
|
||||
// There is no option to be processed.
|
||||
break;
|
||||
}
|
||||
|
||||
$lastOption = $options[$upper];
|
||||
$lastOptionId = is_array($lastOption) ?
|
||||
$lastOption[0] : $lastOption;
|
||||
$state = 0;
|
||||
|
||||
// Checking for option conflicts.
|
||||
// For example, in `SELECT` statements the keywords `ALL`
|
||||
// and `DISTINCT` conflict and if used together, they
|
||||
// produce an invalid query.
|
||||
//
|
||||
// Usually, tokens can be identified in the array by the
|
||||
// option ID, but if conflicts occur, a generated option ID
|
||||
// is used.
|
||||
//
|
||||
// The first pseudo duplicate ID is the maximum value of the
|
||||
// real options (e.g. if there are 5 options, the first
|
||||
// fake ID is 6).
|
||||
if (isset($ret->options[$lastOptionId])) {
|
||||
$parser->error(
|
||||
sprintf(
|
||||
Translator::gettext('This option conflicts with "%1$s".'),
|
||||
is_array($ret->options[$lastOptionId])
|
||||
? $ret->options[$lastOptionId]['name']
|
||||
: $ret->options[$lastOptionId]
|
||||
),
|
||||
$token
|
||||
);
|
||||
$lastOptionId = $lastAssignedId++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if (! is_array($lastOption)) {
|
||||
// This is a just keyword option without any value.
|
||||
// This is the beginning and the end of it.
|
||||
$ret->options[$lastOptionId] = $token->value;
|
||||
$lastOption = null;
|
||||
$state = 0;
|
||||
} elseif (($lastOption[1] === 'var') || ($lastOption[1] === 'var=')) {
|
||||
// This is a keyword that is followed by a value.
|
||||
// This is only the beginning. The value is parsed in state
|
||||
// 1 and 2. State 1 is used to skip the first equals sign
|
||||
// and state 2 to parse the actual value.
|
||||
$ret->options[$lastOptionId] = [
|
||||
// @var string The name of the option.
|
||||
'name' => $token->value,
|
||||
// @var bool Whether it contains an equal sign.
|
||||
// This is used by the builder to rebuild it.
|
||||
'equals' => $lastOption[1] === 'var=',
|
||||
// @var string Raw value.
|
||||
'expr' => '',
|
||||
// @var string Processed value.
|
||||
'value' => '',
|
||||
];
|
||||
$state = 1;
|
||||
} elseif ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') {
|
||||
// This is a keyword that is followed by an expression.
|
||||
// The expression is used by the specialized parser.
|
||||
|
||||
// Skipping this option in order to parse the expression.
|
||||
++$list->idx;
|
||||
$ret->options[$lastOptionId] = [
|
||||
// @var string The name of the option.
|
||||
'name' => $token->value,
|
||||
// @var bool Whether it contains an equal sign.
|
||||
// This is used by the builder to rebuild it.
|
||||
'equals' => $lastOption[1] === 'expr=',
|
||||
// @var Expression The parsed expression.
|
||||
'expr' => '',
|
||||
];
|
||||
$state = 1;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
$state = 2;
|
||||
if ($token->token === '=') {
|
||||
$ret->options[$lastOptionId]['equals'] = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// This is outside the `elseif` group above because the change might
|
||||
// change this iteration.
|
||||
if ($state !== 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') {
|
||||
$ret->options[$lastOptionId]['expr'] = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
empty($lastOption[2]) ? [] : $lastOption[2]
|
||||
);
|
||||
if ($ret->options[$lastOptionId]['expr'] !== null) {
|
||||
$ret->options[$lastOptionId]['value']
|
||||
= $ret->options[$lastOptionId]['expr']->expr;
|
||||
}
|
||||
|
||||
$lastOption = null;
|
||||
$state = 0;
|
||||
} else {
|
||||
if ($token->token === '(') {
|
||||
++$brackets;
|
||||
} elseif ($token->token === ')') {
|
||||
--$brackets;
|
||||
}
|
||||
|
||||
$ret->options[$lastOptionId]['expr'] .= $token->token;
|
||||
|
||||
if (
|
||||
! (($token->token === '(') && ($brackets === 1)
|
||||
|| (($token->token === ')') && ($brackets === 0)))
|
||||
) {
|
||||
// First pair of brackets is being skipped.
|
||||
$ret->options[$lastOptionId]['value'] .= $token->value;
|
||||
}
|
||||
|
||||
// Checking if we finished parsing.
|
||||
if ($brackets === 0) {
|
||||
$lastOption = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We reached the end of statement without getting a value
|
||||
* for an option for which a value was required
|
||||
*/
|
||||
if (
|
||||
$state === 1
|
||||
&& $lastOption
|
||||
&& ($lastOption[1] === 'expr'
|
||||
|| $lastOption[1] === 'var'
|
||||
|| $lastOption[1] === 'var='
|
||||
|| $lastOption[1] === 'expr=')
|
||||
) {
|
||||
$parser->error(
|
||||
sprintf(
|
||||
'Value/Expression for the option %1$s was expected.',
|
||||
$ret->options[$lastOptionId]['name']
|
||||
),
|
||||
$list->tokens[$list->idx - 1]
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($options['_UNSORTED'])) {
|
||||
ksort($ret->options);
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsArray $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (empty($component->options)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$options = [];
|
||||
foreach ($component->options as $option) {
|
||||
if (! is_array($option)) {
|
||||
$options[] = $option;
|
||||
} else {
|
||||
$options[] = $option['name']
|
||||
. (! empty($option['equals']) && $option['equals'] ? '=' : ' ')
|
||||
. (! empty($option['expr']) ? $option['expr'] : $option['value']);
|
||||
}
|
||||
}
|
||||
|
||||
return implode(' ', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it has the specified option and returns it value or true.
|
||||
*
|
||||
* @param string $key the key to be checked
|
||||
* @param bool $getExpr Gets the expression instead of the value.
|
||||
* The value is the processed form of the expression.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function has($key, $getExpr = false)
|
||||
{
|
||||
foreach ($this->options as $option) {
|
||||
if (is_array($option)) {
|
||||
if (! strcasecmp($key, $option['name'])) {
|
||||
return $getExpr ? $option['expr'] : $option['value'];
|
||||
}
|
||||
} elseif (! strcasecmp($key, $option)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the option from the array.
|
||||
*
|
||||
* @param string $key the key to be removed
|
||||
*
|
||||
* @return bool whether the key was found and deleted or not
|
||||
*/
|
||||
public function remove($key)
|
||||
{
|
||||
foreach ($this->options as $idx => $option) {
|
||||
if (is_array($option)) {
|
||||
if (! strcasecmp($key, $option['name'])) {
|
||||
unset($this->options[$idx]);
|
||||
|
||||
return true;
|
||||
}
|
||||
} elseif (! strcasecmp($key, $option)) {
|
||||
unset($this->options[$idx]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges the specified options with these ones. Values with same ID will be
|
||||
* replaced.
|
||||
*
|
||||
* @param array<int, mixed>|OptionsArray $options the options to be merged
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function merge($options)
|
||||
{
|
||||
if (is_array($options)) {
|
||||
$this->options = array_merge_recursive($this->options, $options);
|
||||
} elseif ($options instanceof self) {
|
||||
$this->options = array_merge_recursive($this->options, $options->options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks tf there are no options set.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return empty($this->options);
|
||||
}
|
||||
}
|
||||
135
pma/vendor/phpmyadmin/sql-parser/src/Components/OrderKeyword.php
vendored
Normal file
135
pma/vendor/phpmyadmin/sql-parser/src/Components/OrderKeyword.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* `ORDER BY` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class OrderKeyword extends Component
|
||||
{
|
||||
/**
|
||||
* The expression that is used for ordering.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* The order type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @param Expression $expr the expression that we are sorting by
|
||||
* @param string $type the sorting type
|
||||
*/
|
||||
public function __construct($expr = null, $type = 'ASC')
|
||||
{
|
||||
$this->expr = $expr;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return OrderKeyword[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 --------------------[ expression ]-------------------> 1
|
||||
*
|
||||
* 1 ------------------------[ , ]------------------------> 0
|
||||
* 1 -------------------[ ASC / DESC ]--------------------> 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$expr->expr = Expression::parse($parser, $list);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (
|
||||
($token->type === Token::TYPE_KEYWORD)
|
||||
&& (($token->keyword === 'ASC') || ($token->keyword === 'DESC'))
|
||||
) {
|
||||
$expr->type = $token->keyword;
|
||||
} elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last iteration was not processed.
|
||||
if (! empty($expr->expr)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderKeyword|OrderKeyword[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
return $component->expr . ' ' . $component->type;
|
||||
}
|
||||
}
|
||||
168
pma/vendor/phpmyadmin/sql-parser/src/Components/ParameterDefinition.php
vendored
Normal file
168
pma/vendor/phpmyadmin/sql-parser/src/Components/ParameterDefinition.php
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* The definition of a parameter of a function or procedure.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class ParameterDefinition extends Component
|
||||
{
|
||||
/**
|
||||
* The name of the new column.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Parameter's direction (IN, OUT or INOUT).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $inOut;
|
||||
|
||||
/**
|
||||
* The data type of thew new column.
|
||||
*
|
||||
* @var DataType
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @param string $name parameter's name
|
||||
* @param string $inOut parameter's directional type (IN / OUT or None)
|
||||
* @param DataType $type parameter's type
|
||||
*/
|
||||
public function __construct($name = null, $inOut = null, $type = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->inOut = $inOut;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return ParameterDefinition[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -----------------------[ ( ]------------------------> 1
|
||||
*
|
||||
* 1 ----------------[ IN / OUT / INOUT ]----------------> 1
|
||||
* 1 ----------------------[ name ]----------------------> 2
|
||||
*
|
||||
* 2 -------------------[ data type ]--------------------> 3
|
||||
*
|
||||
* 3 ------------------------[ , ]-----------------------> 1
|
||||
* 3 ------------------------[ ) ]-----------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$state = 1;
|
||||
}
|
||||
|
||||
continue;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->value === 'IN') || ($token->value === 'OUT') || ($token->value === 'INOUT')) {
|
||||
$expr->inOut = $token->value;
|
||||
++$list->idx;
|
||||
} elseif ($token->value === ')') {
|
||||
++$list->idx;
|
||||
break;
|
||||
} else {
|
||||
$expr->name = $token->value;
|
||||
$state = 2;
|
||||
}
|
||||
} elseif ($state === 2) {
|
||||
$expr->type = DataType::parse($parser, $list);
|
||||
$state = 3;
|
||||
} elseif ($state === 3) {
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
if ($token->value === ',') {
|
||||
$state = 1;
|
||||
} elseif ($token->value === ')') {
|
||||
++$list->idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last iteration was not saved.
|
||||
if (isset($expr->name) && ($expr->name !== '')) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ParameterDefinition[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return '(' . implode(', ', $component) . ')';
|
||||
}
|
||||
|
||||
$tmp = '';
|
||||
if (! empty($component->inOut)) {
|
||||
$tmp .= $component->inOut . ' ';
|
||||
}
|
||||
|
||||
return trim(
|
||||
$tmp . Context::escape($component->name) . ' ' . $component->type
|
||||
);
|
||||
}
|
||||
}
|
||||
253
pma/vendor/phpmyadmin/sql-parser/src/Components/PartitionDefinition.php
vendored
Normal file
253
pma/vendor/phpmyadmin/sql-parser/src/Components/PartitionDefinition.php
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* Parses the create definition of a partition.
|
||||
*
|
||||
* Used for parsing `CREATE TABLE` statement.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class PartitionDefinition extends Component
|
||||
{
|
||||
/**
|
||||
* All field options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'STORAGE ENGINE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'ENGINE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'COMMENT' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'DATA DIRECTORY' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'INDEX DIRECTORY' => [
|
||||
4,
|
||||
'var',
|
||||
],
|
||||
'MAX_ROWS' => [
|
||||
5,
|
||||
'var',
|
||||
],
|
||||
'MIN_ROWS' => [
|
||||
6,
|
||||
'var',
|
||||
],
|
||||
'TABLESPACE' => [
|
||||
7,
|
||||
'var',
|
||||
],
|
||||
'NODEGROUP' => [
|
||||
8,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Whether this entry is a subpartition or a partition.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isSubpartition;
|
||||
|
||||
/**
|
||||
* The name of this partition.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The type of this partition (what follows the `VALUES` keyword).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* The expression used to defined this partition.
|
||||
*
|
||||
* @var Expression|string
|
||||
*/
|
||||
public $expr;
|
||||
|
||||
/**
|
||||
* The subpartitions of this partition.
|
||||
*
|
||||
* @var PartitionDefinition[]
|
||||
*/
|
||||
public $subpartitions;
|
||||
|
||||
/**
|
||||
* The options of this field.
|
||||
*
|
||||
* @var OptionsArray
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return PartitionDefinition
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -------------[ PARTITION | SUBPARTITION ]------------> 1
|
||||
*
|
||||
* 1 -----------------------[ name ]----------------------> 2
|
||||
*
|
||||
* 2 ----------------------[ VALUES ]---------------------> 3
|
||||
*
|
||||
* 3 ---------------------[ LESS THAN ]-------------------> 4
|
||||
* 3 ------------------------[ IN ]-----------------------> 4
|
||||
*
|
||||
* 4 -----------------------[ expr ]----------------------> 5
|
||||
*
|
||||
* 5 ----------------------[ options ]--------------------> 6
|
||||
*
|
||||
* 6 ------------------[ subpartitions ]------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->isSubpartition = ($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'SUBPARTITION');
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
$ret->name = $token->value;
|
||||
|
||||
// Looking ahead for a 'VALUES' keyword.
|
||||
// Loop until the end of the partition name (delimited by a whitespace)
|
||||
while ($nextToken = $list->tokens[++$list->idx]) {
|
||||
if ($nextToken->type !== Token::TYPE_NONE) {
|
||||
break;
|
||||
}
|
||||
|
||||
$ret->name .= $nextToken->value;
|
||||
}
|
||||
|
||||
$idx = $list->idx--;
|
||||
// Get the first token after the white space.
|
||||
$nextToken = $list->tokens[++$idx];
|
||||
|
||||
$state = ($nextToken->type === Token::TYPE_KEYWORD)
|
||||
&& ($nextToken->value === 'VALUES')
|
||||
? 2 : 5;
|
||||
} elseif ($state === 2) {
|
||||
$state = 3;
|
||||
} elseif ($state === 3) {
|
||||
$ret->type = $token->value;
|
||||
$state = 4;
|
||||
} elseif ($state === 4) {
|
||||
if ($token->value === 'MAXVALUE') {
|
||||
$ret->expr = $token->value;
|
||||
} else {
|
||||
$ret->expr = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parenthesesDelimited' => true,
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$state = 5;
|
||||
} elseif ($state === 5) {
|
||||
$ret->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
$state = 6;
|
||||
} elseif ($state === 6) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
$ret->subpartitions = ArrayObj::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition']
|
||||
);
|
||||
++$list->idx;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PartitionDefinition|PartitionDefinition[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return "(\n" . implode(",\n", $component) . "\n)";
|
||||
}
|
||||
|
||||
if ($component->isSubpartition) {
|
||||
return trim('SUBPARTITION ' . $component->name . ' ' . $component->options);
|
||||
}
|
||||
|
||||
$subpartitions = empty($component->subpartitions) ? '' : ' ' . self::build($component->subpartitions);
|
||||
|
||||
return trim(
|
||||
'PARTITION ' . $component->name
|
||||
. (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ')
|
||||
. (! empty($component->options) && ! empty($component->type) ? '' : ' ')
|
||||
. $component->options . $subpartitions
|
||||
);
|
||||
}
|
||||
}
|
||||
158
pma/vendor/phpmyadmin/sql-parser/src/Components/Reference.php
vendored
Normal file
158
pma/vendor/phpmyadmin/sql-parser/src/Components/Reference.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `REFERENCES` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Reference extends Component
|
||||
{
|
||||
/**
|
||||
* All references options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $REFERENCES_OPTIONS = [
|
||||
'MATCH' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'ON DELETE' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'ON UPDATE' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The referenced table.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* The referenced columns.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* The options of the referencing.
|
||||
*
|
||||
* @var OptionsArray
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* @param Expression $table the name of the table referenced
|
||||
* @param string[] $columns the columns referenced
|
||||
* @param OptionsArray $options the options
|
||||
*/
|
||||
public function __construct($table = null, array $columns = [], $options = null)
|
||||
{
|
||||
$this->table = $table;
|
||||
$this->columns = $columns;
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return Reference
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ----------------------[ table ]---------------------> 1
|
||||
*
|
||||
* 1 ---------------------[ columns ]--------------------> 2
|
||||
*
|
||||
* 2 ---------------------[ options ]--------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$ret->table = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => 'table',
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
$ret->columns = ArrayObj::parse($parser, $list)->values;
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
$ret->options = OptionsArray::parse($parser, $list, static::$REFERENCES_OPTIONS);
|
||||
++$list->idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Reference $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
return trim(
|
||||
$component->table
|
||||
. ' (' . implode(', ', Context::escape($component->columns)) . ') '
|
||||
. $component->options
|
||||
);
|
||||
}
|
||||
}
|
||||
167
pma/vendor/phpmyadmin/sql-parser/src/Components/RenameOperation.php
vendored
Normal file
167
pma/vendor/phpmyadmin/sql-parser/src/Components/RenameOperation.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* `RENAME TABLE` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class RenameOperation extends Component
|
||||
{
|
||||
/**
|
||||
* The old table name.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $old;
|
||||
|
||||
/**
|
||||
* The new table name.
|
||||
*
|
||||
* @var Expression
|
||||
*/
|
||||
public $new;
|
||||
|
||||
/**
|
||||
* @param Expression $old old expression
|
||||
* @param Expression $new new expression containing new name
|
||||
*/
|
||||
public function __construct($old = null, $new = null)
|
||||
{
|
||||
$this->old = $old;
|
||||
$this->new = $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return RenameOperation[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ old name ]--------------------> 1
|
||||
*
|
||||
* 1 ------------------------[ TO ]-----------------------> 2
|
||||
*
|
||||
* 2 ---------------------[ new name ]--------------------> 3
|
||||
*
|
||||
* 3 ------------------------[ , ]------------------------> 0
|
||||
* 3 -----------------------[ else ]----------------------> (END)
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$expr->old = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'breakOnAlias' => true,
|
||||
'parseField' => 'table',
|
||||
]
|
||||
);
|
||||
if (empty($expr->old)) {
|
||||
$parser->error('The old name of the table was expected.', $token);
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD || $token->keyword !== 'TO') {
|
||||
$parser->error('Keyword "TO" was expected.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
$expr->new = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'breakOnAlias' => true,
|
||||
'parseField' => 'table',
|
||||
]
|
||||
);
|
||||
if (empty($expr->new)) {
|
||||
$parser->error('The new name of the table was expected.', $token);
|
||||
}
|
||||
|
||||
$state = 3;
|
||||
} elseif ($state === 3) {
|
||||
if (($token->type !== Token::TYPE_OPERATOR) || ($token->value !== ',')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($state !== 3) {
|
||||
$parser->error('A rename operation was expected.', $list->tokens[$list->idx - 1]);
|
||||
}
|
||||
|
||||
// Last iteration was not saved.
|
||||
if (! empty($expr->old)) {
|
||||
$ret[] = $expr;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RenameOperation $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
return $component->old . ' TO ' . $component->new;
|
||||
}
|
||||
}
|
||||
158
pma/vendor/phpmyadmin/sql-parser/src/Components/SetOperation.php
vendored
Normal file
158
pma/vendor/phpmyadmin/sql-parser/src/Components/SetOperation.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `SET` keyword parser.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class SetOperation extends Component
|
||||
{
|
||||
/**
|
||||
* The name of the column that is being updated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $column;
|
||||
|
||||
/**
|
||||
* The new value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* @param string $column Field's name..
|
||||
* @param string $value new value
|
||||
*/
|
||||
public function __construct($column = '', $value = '')
|
||||
{
|
||||
$this->column = $column;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the parser that serves as context
|
||||
* @param TokensList $list the list of tokens that are being parsed
|
||||
* @param array<string, mixed> $options parameters for parsing
|
||||
*
|
||||
* @return SetOperation[]
|
||||
*/
|
||||
public static function parse(Parser $parser, TokensList $list, array $options = [])
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
$expr = new static();
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------[ col_name ]--------------------> 0
|
||||
* 0 ------------------------[ = ]------------------------> 1
|
||||
* 1 -----------------------[ value ]---------------------> 1
|
||||
* 1 ------------------------[ , ]------------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* Token when the parser has seen the latest comma
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
$commaLastSeenAt = null;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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)
|
||||
&& ($state === 0)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->token === '=') {
|
||||
$state = 1;
|
||||
} elseif ($token->value !== ',') {
|
||||
$expr->column .= $token->token;
|
||||
} elseif ($token->value === ',') {
|
||||
$commaLastSeenAt = $token;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
$tmp = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['breakOnAlias' => true]
|
||||
);
|
||||
if ($tmp === null) {
|
||||
$parser->error('Missing expression.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$expr->column = trim($expr->column);
|
||||
$expr->value = $tmp->expr;
|
||||
$ret[] = $expr;
|
||||
$expr = new static();
|
||||
$state = 0;
|
||||
$commaLastSeenAt = null;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
|
||||
// We saw a comma, but didn't see a column-value pair after it
|
||||
if ($commaLastSeenAt !== null) {
|
||||
$parser->error('Unexpected token.', $commaLastSeenAt);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SetOperation|SetOperation[] $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (is_array($component)) {
|
||||
return implode(', ', $component);
|
||||
}
|
||||
|
||||
return $component->column . ' = ' . $component->value;
|
||||
}
|
||||
}
|
||||
33
pma/vendor/phpmyadmin/sql-parser/src/Components/UnionKeyword.php
vendored
Normal file
33
pma/vendor/phpmyadmin/sql-parser/src/Components/UnionKeyword.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* `UNION` keyword builder.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class UnionKeyword extends Component
|
||||
{
|
||||
/**
|
||||
* @param array<UnionKeyword[]> $component the component to be built
|
||||
* @param array<string, mixed> $options parameters for building
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
$tmp = [];
|
||||
foreach ($component as $componentPart) {
|
||||
$tmp[] = $componentPart[0] . ' ' . $componentPart[1];
|
||||
}
|
||||
|
||||
return implode(' ', $tmp);
|
||||
}
|
||||
}
|
||||
64
pma/vendor/phpmyadmin/sql-parser/src/Components/WithKeyword.php
vendored
Normal file
64
pma/vendor/phpmyadmin/sql-parser/src/Components/WithKeyword.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Components;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Component;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* `WITH` keyword builder.
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
final class WithKeyword extends Component
|
||||
{
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
/** @var ArrayObj[] */
|
||||
public $columns = [];
|
||||
|
||||
/** @var Parser|null */
|
||||
public $statement;
|
||||
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WithKeyword $component
|
||||
* @param array<string, mixed> $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function build($component, array $options = [])
|
||||
{
|
||||
if (! $component instanceof WithKeyword) {
|
||||
throw new RuntimeException('Can not build a component that is not a WithKeyword');
|
||||
}
|
||||
|
||||
if (! isset($component->statement)) {
|
||||
throw new RuntimeException('No statement inside WITH');
|
||||
}
|
||||
|
||||
$str = $component->name;
|
||||
|
||||
if ($component->columns) {
|
||||
$str .= ArrayObj::build($component->columns);
|
||||
}
|
||||
|
||||
$str .= ' AS (';
|
||||
|
||||
foreach ($component->statement->statements as $statement) {
|
||||
$str .= $statement->build();
|
||||
}
|
||||
|
||||
$str .= ')';
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
857
pma/vendor/phpmyadmin/sql-parser/src/Context.php
vendored
Normal file
857
pma/vendor/phpmyadmin/sql-parser/src/Context.php
vendored
Normal file
@@ -0,0 +1,857 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Exceptions\LoaderException;
|
||||
|
||||
use function class_exists;
|
||||
use function explode;
|
||||
use function intval;
|
||||
use function is_array;
|
||||
use function is_int;
|
||||
use function is_numeric;
|
||||
use function str_replace;
|
||||
use function str_starts_with;
|
||||
use function strlen;
|
||||
use function strtoupper;
|
||||
use function substr;
|
||||
|
||||
/**
|
||||
* Defines a context class that is later extended to define other contexts.
|
||||
*
|
||||
* A context is a collection of keywords, operators and functions used for parsing.
|
||||
*
|
||||
* Holds the configuration of the context that is currently used.
|
||||
*/
|
||||
abstract class Context
|
||||
{
|
||||
/**
|
||||
* The maximum length of a keyword.
|
||||
*
|
||||
* @see static::$TOKEN_KEYWORD
|
||||
*/
|
||||
public const KEYWORD_MAX_LENGTH = 30;
|
||||
|
||||
/**
|
||||
* The maximum length of a label.
|
||||
*
|
||||
* @see static::$TOKEN_LABEL
|
||||
* Ref: https://dev.mysql.com/doc/refman/5.7/en/statement-labels.html
|
||||
*/
|
||||
public const LABEL_MAX_LENGTH = 16;
|
||||
|
||||
/**
|
||||
* The maximum length of an operator.
|
||||
*
|
||||
* @see static::$TOKEN_OPERATOR
|
||||
*/
|
||||
public const OPERATOR_MAX_LENGTH = 4;
|
||||
|
||||
/**
|
||||
* The name of the default content.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $defaultContext = '\\PhpMyAdmin\\SqlParser\\Contexts\\ContextMySql50700';
|
||||
|
||||
/**
|
||||
* The name of the loaded context.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $loadedContext = '\\PhpMyAdmin\\SqlParser\\Contexts\\ContextMySql50700';
|
||||
|
||||
/**
|
||||
* The prefix concatenated to the context name when an incomplete class name
|
||||
* is specified.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $contextPrefix = '\\PhpMyAdmin\\SqlParser\\Contexts\\Context';
|
||||
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* Because, PHP's associative arrays are basically hash tables, it is more
|
||||
* efficient to store keywords as keys instead of values.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* Elements are sorted by flags, length and keyword.
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [];
|
||||
|
||||
/**
|
||||
* List of operators and their flags.
|
||||
*
|
||||
* @var array<string, int>
|
||||
*/
|
||||
public static $OPERATORS = [
|
||||
// Some operators (*, =) may have ambiguous flags, because they depend on
|
||||
// the context they are being used in.
|
||||
// For example: 1. SELECT * FROM table; # SQL specific (wildcard)
|
||||
// SELECT 2 * 3; # arithmetic
|
||||
// 2. SELECT * FROM table WHERE foo = 'bar';
|
||||
// SET @i = 0;
|
||||
|
||||
// @see Token::FLAG_OPERATOR_ARITHMETIC
|
||||
'%' => 1,
|
||||
'*' => 1,
|
||||
'+' => 1,
|
||||
'-' => 1,
|
||||
'/' => 1,
|
||||
|
||||
// @see Token::FLAG_OPERATOR_LOGICAL
|
||||
'!' => 2,
|
||||
'!=' => 2,
|
||||
'&&' => 2,
|
||||
'<' => 2,
|
||||
'<=' => 2,
|
||||
'<=>' => 2,
|
||||
'<>' => 2,
|
||||
'=' => 2,
|
||||
'>' => 2,
|
||||
'>=' => 2,
|
||||
'||' => 2,
|
||||
|
||||
// @see Token::FLAG_OPERATOR_BITWISE
|
||||
'&' => 4,
|
||||
'<<' => 4,
|
||||
'>>' => 4,
|
||||
'^' => 4,
|
||||
'|' => 4,
|
||||
'~' => 4,
|
||||
|
||||
// @see Token::FLAG_OPERATOR_ASSIGNMENT
|
||||
':=' => 8,
|
||||
|
||||
// @see Token::FLAG_OPERATOR_SQL
|
||||
'(' => 16,
|
||||
')' => 16,
|
||||
'.' => 16,
|
||||
',' => 16,
|
||||
';' => 16,
|
||||
];
|
||||
|
||||
/**
|
||||
* The mode of the MySQL server that will be used in lexing, parsing and building the statements.
|
||||
*
|
||||
* @internal use the {@see Context::getMode()} method instead.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html
|
||||
* @link https://mariadb.com/kb/en/sql-mode/
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public static $MODE = self::SQL_MODE_NONE;
|
||||
|
||||
public const SQL_MODE_NONE = 0;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_allow_invalid_dates
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#allow_invalid_dates
|
||||
*/
|
||||
public const SQL_MODE_ALLOW_INVALID_DATES = 1;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_ansi_quotes
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#ansi_quotes
|
||||
*/
|
||||
public const SQL_MODE_ANSI_QUOTES = 2;
|
||||
|
||||
/** Compatibility mode for Microsoft's SQL server. This is the equivalent of {@see SQL_MODE_ANSI_QUOTES}. */
|
||||
public const SQL_MODE_COMPAT_MYSQL = 2;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_error_for_division_by_zero
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#error_for_division_by_zero
|
||||
*/
|
||||
public const SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO = 4;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_high_not_precedence
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#high_not_precedence
|
||||
*/
|
||||
public const SQL_MODE_HIGH_NOT_PRECEDENCE = 8;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_ignore_space
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#ignore_space
|
||||
*/
|
||||
public const SQL_MODE_IGNORE_SPACE = 16;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_create_user
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_auto_create_user
|
||||
*/
|
||||
public const SQL_MODE_NO_AUTO_CREATE_USER = 32;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_auto_value_on_zero
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_auto_value_on_zero
|
||||
*/
|
||||
public const SQL_MODE_NO_AUTO_VALUE_ON_ZERO = 64;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_backslash_escapes
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_backslash_escapes
|
||||
*/
|
||||
public const SQL_MODE_NO_BACKSLASH_ESCAPES = 128;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_dir_in_create
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_dir_in_create
|
||||
*/
|
||||
public const SQL_MODE_NO_DIR_IN_CREATE = 256;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_engine_substitution
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_engine_substitution
|
||||
*/
|
||||
public const SQL_MODE_NO_ENGINE_SUBSTITUTION = 512;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_field_options
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_field_options
|
||||
*/
|
||||
public const SQL_MODE_NO_FIELD_OPTIONS = 1024;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_key_options
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_key_options
|
||||
*/
|
||||
public const SQL_MODE_NO_KEY_OPTIONS = 2048;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_table_options
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_table_options
|
||||
*/
|
||||
public const SQL_MODE_NO_TABLE_OPTIONS = 4096;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_unsigned_subtraction
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_unsigned_subtraction
|
||||
*/
|
||||
public const SQL_MODE_NO_UNSIGNED_SUBTRACTION = 8192;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_zero_date
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_zero_date
|
||||
*/
|
||||
public const SQL_MODE_NO_ZERO_DATE = 16384;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_no_zero_in_date
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#no_zero_in_date
|
||||
*/
|
||||
public const SQL_MODE_NO_ZERO_IN_DATE = 32768;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_only_full_group_by
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#only_full_group_by
|
||||
*/
|
||||
public const SQL_MODE_ONLY_FULL_GROUP_BY = 65536;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_pipes_as_concat
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#pipes_as_concat
|
||||
*/
|
||||
public const SQL_MODE_PIPES_AS_CONCAT = 131072;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_real_as_float
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#real_as_float
|
||||
*/
|
||||
public const SQL_MODE_REAL_AS_FLOAT = 262144;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_strict_all_tables
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#strict_all_tables
|
||||
*/
|
||||
public const SQL_MODE_STRICT_ALL_TABLES = 524288;
|
||||
|
||||
/**
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_strict_trans_tables
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#strict_trans_tables
|
||||
*/
|
||||
public const SQL_MODE_STRICT_TRANS_TABLES = 1048576;
|
||||
|
||||
/**
|
||||
* Custom mode.
|
||||
* The table and column names and any other field that must be escaped will not be.
|
||||
* Reserved keywords are being escaped regardless this mode is used or not.
|
||||
*/
|
||||
public const SQL_MODE_NO_ENCLOSING_QUOTES = 1073741824;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_REAL_AS_FLOAT}, {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES},
|
||||
* {@see SQL_MODE_IGNORE_SPACE}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_ansi
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#ansi
|
||||
*/
|
||||
public const SQL_MODE_ANSI = 393234;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE},
|
||||
* {@see SQL_MODE_NO_KEY_OPTIONS}, {@see SQL_MODE_NO_TABLE_OPTIONS}, {@see SQL_MODE_NO_FIELD_OPTIONS}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_db2
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#db2
|
||||
*/
|
||||
public const SQL_MODE_DB2 = 138258;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE},
|
||||
* {@see SQL_MODE_NO_KEY_OPTIONS}, {@see SQL_MODE_NO_TABLE_OPTIONS}, {@see SQL_MODE_NO_FIELD_OPTIONS},
|
||||
* {@see SQL_MODE_NO_AUTO_CREATE_USER}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_maxdb
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#maxdb
|
||||
*/
|
||||
public const SQL_MODE_MAXDB = 138290;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE},
|
||||
* {@see SQL_MODE_NO_KEY_OPTIONS}, {@see SQL_MODE_NO_TABLE_OPTIONS}, {@see SQL_MODE_NO_FIELD_OPTIONS}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_mssql
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#mssql
|
||||
*/
|
||||
public const SQL_MODE_MSSQL = 138258;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE},
|
||||
* {@see SQL_MODE_NO_KEY_OPTIONS}, {@see SQL_MODE_NO_TABLE_OPTIONS}, {@see SQL_MODE_NO_FIELD_OPTIONS},
|
||||
* {@see SQL_MODE_NO_AUTO_CREATE_USER}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_oracle
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#oracle
|
||||
*/
|
||||
public const SQL_MODE_ORACLE = 138290;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_PIPES_AS_CONCAT}, {@see SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE},
|
||||
* {@see SQL_MODE_NO_KEY_OPTIONS}, {@see SQL_MODE_NO_TABLE_OPTIONS}, {@see SQL_MODE_NO_FIELD_OPTIONS}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_postgresql
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#postgresql
|
||||
*/
|
||||
public const SQL_MODE_POSTGRESQL = 138258;
|
||||
|
||||
/**
|
||||
* Equivalent to {@see SQL_MODE_STRICT_TRANS_TABLES}, {@see SQL_MODE_STRICT_ALL_TABLES},
|
||||
* {@see SQL_MODE_NO_ZERO_IN_DATE}, {@see SQL_MODE_NO_ZERO_DATE}, {@see SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO},
|
||||
* {@see SQL_MODE_NO_AUTO_CREATE_USER}.
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/en/sql-mode.html#sqlmode_traditional
|
||||
* @link https://mariadb.com/kb/en/sql-mode/#traditional
|
||||
*/
|
||||
public const SQL_MODE_TRADITIONAL = 1622052;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Keyword.
|
||||
|
||||
/**
|
||||
* Checks if the given string is a keyword.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
* @param bool $isReserved checks if the keyword is reserved
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public static function isKeyword($str, $isReserved = false)
|
||||
{
|
||||
$str = strtoupper($str);
|
||||
|
||||
if (isset(static::$KEYWORDS[$str])) {
|
||||
if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return static::$KEYWORDS[$str];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Operator.
|
||||
|
||||
/**
|
||||
* Checks if the given string is an operator.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return int|null the appropriate flag for the operator
|
||||
*/
|
||||
public static function isOperator($str)
|
||||
{
|
||||
if (! isset(static::$OPERATORS[$str])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return static::$OPERATORS[$str];
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Whitespace.
|
||||
|
||||
/**
|
||||
* Checks if the given character is a whitespace.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isWhitespace($str)
|
||||
{
|
||||
return ($str === ' ') || ($str === "\r") || ($str === "\n") || ($str === "\t");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Comment.
|
||||
|
||||
/**
|
||||
* Checks if the given string is the beginning of a whitespace.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return int|null the appropriate flag for the comment type
|
||||
*/
|
||||
public static function isComment($str, $end = false)
|
||||
{
|
||||
$len = strlen($str);
|
||||
if ($len === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If comment is Bash style (#):
|
||||
if ($str[0] === '#') {
|
||||
return Token::FLAG_COMMENT_BASH;
|
||||
}
|
||||
|
||||
// If comment is opening C style (/*), warning, it could be a MySQL command (/*!)
|
||||
if (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
|
||||
return ($len > 2) && ($str[2] === '!') ?
|
||||
Token::FLAG_COMMENT_MYSQL_CMD : Token::FLAG_COMMENT_C;
|
||||
}
|
||||
|
||||
// If comment is closing C style (*/), warning, it could conflicts with wildcard and a real opening C style.
|
||||
// It would looks like the following valid SQL statement: "SELECT */* comment */ FROM...".
|
||||
if (($len > 1) && ($str[0] === '*') && ($str[1] === '/')) {
|
||||
return Token::FLAG_COMMENT_C;
|
||||
}
|
||||
|
||||
// If comment is SQL style (--\s?):
|
||||
if (($len > 2) && ($str[0] === '-') && ($str[1] === '-') && static::isWhitespace($str[2])) {
|
||||
return Token::FLAG_COMMENT_SQL;
|
||||
}
|
||||
|
||||
if (($len === 2) && $end && ($str[0] === '-') && ($str[1] === '-')) {
|
||||
return Token::FLAG_COMMENT_SQL;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Bool.
|
||||
|
||||
/**
|
||||
* Checks if the given string is a boolean value.
|
||||
* This actually check only for `TRUE` and `FALSE` because `1` or `0` are
|
||||
* actually numbers and are parsed by specific methods.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isBool($str)
|
||||
{
|
||||
$str = strtoupper($str);
|
||||
|
||||
return ($str === 'TRUE') || ($str === 'FALSE');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Number.
|
||||
|
||||
/**
|
||||
* Checks if the given character can be a part of a number.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isNumber($str)
|
||||
{
|
||||
return ($str >= '0') && ($str <= '9') || ($str === '.')
|
||||
|| ($str === '-') || ($str === '+') || ($str === 'e') || ($str === 'E');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Symbol.
|
||||
|
||||
/**
|
||||
* Checks if the given character is the beginning of a symbol. A symbol
|
||||
* can be either a variable or a field name.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return int|null the appropriate flag for the symbol type
|
||||
*/
|
||||
public static function isSymbol($str)
|
||||
{
|
||||
if (strlen($str) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($str[0] === '@') {
|
||||
return Token::FLAG_SYMBOL_VARIABLE;
|
||||
}
|
||||
|
||||
if ($str[0] === '`') {
|
||||
return Token::FLAG_SYMBOL_BACKTICK;
|
||||
}
|
||||
|
||||
if ($str[0] === ':' || $str[0] === '?') {
|
||||
return Token::FLAG_SYMBOL_PARAMETER;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// String.
|
||||
|
||||
/**
|
||||
* Checks if the given character is the beginning of a string.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return int|null the appropriate flag for the string type
|
||||
*/
|
||||
public static function isString($str)
|
||||
{
|
||||
if (strlen($str) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($str[0] === '\'') {
|
||||
return Token::FLAG_STRING_SINGLE_QUOTES;
|
||||
}
|
||||
|
||||
if ($str[0] === '"') {
|
||||
return Token::FLAG_STRING_DOUBLE_QUOTES;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Delimiter.
|
||||
|
||||
/**
|
||||
* Checks if the given character can be a separator for two lexeme.
|
||||
*
|
||||
* @param string $str string to be checked
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSeparator($str)
|
||||
{
|
||||
// NOTES: Only non alphanumeric ASCII characters may be separators.
|
||||
// `~` is the last printable ASCII character.
|
||||
return ($str <= '~')
|
||||
&& ($str !== '_')
|
||||
&& ($str !== '$')
|
||||
&& (($str < '0') || ($str > '9'))
|
||||
&& (($str < 'a') || ($str > 'z'))
|
||||
&& (($str < 'A') || ($str > 'Z'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the specified context.
|
||||
*
|
||||
* Contexts may be used by accessing the context directly.
|
||||
*
|
||||
* @param string $context name of the context or full class name that defines the context
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws LoaderException if the specified context doesn't exist.
|
||||
*/
|
||||
public static function load($context = '')
|
||||
{
|
||||
if (empty($context)) {
|
||||
$context = self::$defaultContext;
|
||||
}
|
||||
|
||||
if ($context[0] !== '\\') {
|
||||
// Short context name (must be formatted into class name).
|
||||
$context = self::$contextPrefix . $context;
|
||||
}
|
||||
|
||||
if (! class_exists($context)) {
|
||||
throw @new LoaderException('Specified context ("' . $context . '") does not exist.', $context);
|
||||
}
|
||||
|
||||
self::$loadedContext = $context;
|
||||
self::$KEYWORDS = $context::$KEYWORDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the context with the closest version to the one specified.
|
||||
*
|
||||
* The closest context is found by replacing last digits with zero until one
|
||||
* is loaded successfully.
|
||||
*
|
||||
* @see Context::load()
|
||||
*
|
||||
* @param string $context name of the context or full class name that
|
||||
* defines the context
|
||||
*
|
||||
* @return string|null The loaded context. `null` if no context was loaded.
|
||||
*/
|
||||
public static function loadClosest($context = '')
|
||||
{
|
||||
$length = strlen($context);
|
||||
for ($i = $length; $i > 0;) {
|
||||
try {
|
||||
/* Trying to load the new context */
|
||||
static::load($context);
|
||||
|
||||
return $context;
|
||||
} catch (LoaderException $e) {
|
||||
/* Replace last two non zero digits by zeroes */
|
||||
do {
|
||||
$i -= 2;
|
||||
$part = substr($context, $i, 2);
|
||||
/* No more numeric parts to strip */
|
||||
if (! is_numeric($part)) {
|
||||
break 2;
|
||||
}
|
||||
} while (intval($part) === 0 && $i > 0);
|
||||
|
||||
$context = substr($context, 0, $i) . '00' . substr($context, $i + 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback to loading at least matching engine */
|
||||
if (str_starts_with($context, 'MariaDb')) {
|
||||
return static::loadClosest('MariaDb100300');
|
||||
}
|
||||
|
||||
if (str_starts_with($context, 'MySql')) {
|
||||
return static::loadClosest('MySql50700');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SQL mode.
|
||||
*/
|
||||
public static function getMode(): int
|
||||
{
|
||||
return static::$MODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the SQL mode.
|
||||
*
|
||||
* @param int|string $mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setMode($mode = self::SQL_MODE_NONE)
|
||||
{
|
||||
if (is_int($mode)) {
|
||||
static::$MODE = $mode;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static::$MODE = self::SQL_MODE_NONE;
|
||||
if ($mode === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$modes = explode(',', $mode);
|
||||
foreach ($modes as $sqlMode) {
|
||||
static::$MODE |= self::getModeFromString($sqlMode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-suppress MixedReturnStatement, MixedInferredReturnType Is caused by the LSB of the constants
|
||||
*/
|
||||
private static function getModeFromString(string $mode): int
|
||||
{
|
||||
// phpcs:disable SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant
|
||||
switch ($mode) {
|
||||
case 'ALLOW_INVALID_DATES':
|
||||
return static::SQL_MODE_ALLOW_INVALID_DATES;
|
||||
|
||||
case 'ANSI_QUOTES':
|
||||
return static::SQL_MODE_ANSI_QUOTES;
|
||||
|
||||
case 'COMPAT_MYSQL':
|
||||
return static::SQL_MODE_COMPAT_MYSQL;
|
||||
|
||||
case 'ERROR_FOR_DIVISION_BY_ZERO':
|
||||
return static::SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO;
|
||||
|
||||
case 'HIGH_NOT_PRECEDENCE':
|
||||
return static::SQL_MODE_HIGH_NOT_PRECEDENCE;
|
||||
|
||||
case 'IGNORE_SPACE':
|
||||
return static::SQL_MODE_IGNORE_SPACE;
|
||||
|
||||
case 'NO_AUTO_CREATE_USER':
|
||||
return static::SQL_MODE_NO_AUTO_CREATE_USER;
|
||||
|
||||
case 'NO_AUTO_VALUE_ON_ZERO':
|
||||
return static::SQL_MODE_NO_AUTO_VALUE_ON_ZERO;
|
||||
|
||||
case 'NO_BACKSLASH_ESCAPES':
|
||||
return static::SQL_MODE_NO_BACKSLASH_ESCAPES;
|
||||
|
||||
case 'NO_DIR_IN_CREATE':
|
||||
return static::SQL_MODE_NO_DIR_IN_CREATE;
|
||||
|
||||
case 'NO_ENGINE_SUBSTITUTION':
|
||||
return static::SQL_MODE_NO_ENGINE_SUBSTITUTION;
|
||||
|
||||
case 'NO_FIELD_OPTIONS':
|
||||
return static::SQL_MODE_NO_FIELD_OPTIONS;
|
||||
|
||||
case 'NO_KEY_OPTIONS':
|
||||
return static::SQL_MODE_NO_KEY_OPTIONS;
|
||||
|
||||
case 'NO_TABLE_OPTIONS':
|
||||
return static::SQL_MODE_NO_TABLE_OPTIONS;
|
||||
|
||||
case 'NO_UNSIGNED_SUBTRACTION':
|
||||
return static::SQL_MODE_NO_UNSIGNED_SUBTRACTION;
|
||||
|
||||
case 'NO_ZERO_DATE':
|
||||
return static::SQL_MODE_NO_ZERO_DATE;
|
||||
|
||||
case 'NO_ZERO_IN_DATE':
|
||||
return static::SQL_MODE_NO_ZERO_IN_DATE;
|
||||
|
||||
case 'ONLY_FULL_GROUP_BY':
|
||||
return static::SQL_MODE_ONLY_FULL_GROUP_BY;
|
||||
|
||||
case 'PIPES_AS_CONCAT':
|
||||
return static::SQL_MODE_PIPES_AS_CONCAT;
|
||||
|
||||
case 'REAL_AS_FLOAT':
|
||||
return static::SQL_MODE_REAL_AS_FLOAT;
|
||||
|
||||
case 'STRICT_ALL_TABLES':
|
||||
return static::SQL_MODE_STRICT_ALL_TABLES;
|
||||
|
||||
case 'STRICT_TRANS_TABLES':
|
||||
return static::SQL_MODE_STRICT_TRANS_TABLES;
|
||||
|
||||
case 'NO_ENCLOSING_QUOTES':
|
||||
return static::SQL_MODE_NO_ENCLOSING_QUOTES;
|
||||
|
||||
case 'ANSI':
|
||||
return static::SQL_MODE_ANSI;
|
||||
|
||||
case 'DB2':
|
||||
return static::SQL_MODE_DB2;
|
||||
|
||||
case 'MAXDB':
|
||||
return static::SQL_MODE_MAXDB;
|
||||
|
||||
case 'MSSQL':
|
||||
return static::SQL_MODE_MSSQL;
|
||||
|
||||
case 'ORACLE':
|
||||
return static::SQL_MODE_ORACLE;
|
||||
|
||||
case 'POSTGRESQL':
|
||||
return static::SQL_MODE_POSTGRESQL;
|
||||
|
||||
case 'TRADITIONAL':
|
||||
return static::SQL_MODE_TRADITIONAL;
|
||||
|
||||
default:
|
||||
return self::SQL_MODE_NONE;
|
||||
}
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the symbol by adding surrounding backticks.
|
||||
*
|
||||
* @param string[]|string $str the string to be escaped
|
||||
* @param string $quote quote to be used when escaping
|
||||
*
|
||||
* @return string|string[]
|
||||
*/
|
||||
public static function escape($str, $quote = '`')
|
||||
{
|
||||
if (is_array($str)) {
|
||||
foreach ($str as $key => $value) {
|
||||
$str[$key] = static::escape($value);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (! static::isKeyword($str, true))) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
if (static::$MODE & self::SQL_MODE_ANSI_QUOTES) {
|
||||
$quote = '"';
|
||||
}
|
||||
|
||||
return $quote . str_replace($quote, $quote . $quote, $str) . $quote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns char used to quote identifiers based on currently set SQL Mode (ie. standard or ANSI_QUOTES)
|
||||
*
|
||||
* @return string either " (double quote, ansi_quotes mode) or ` (backtick, standard mode)
|
||||
*/
|
||||
public static function getIdentifierQuote()
|
||||
{
|
||||
return self::hasMode(self::SQL_MODE_ANSI_QUOTES) ? '"' : '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function verifies that given SQL Mode constant is currently set
|
||||
*
|
||||
* @param int $flag for example {@see Context::SQL_MODE_ANSI_QUOTES}
|
||||
*
|
||||
* @return bool false on empty param, true/false on given constant/int value
|
||||
*/
|
||||
public static function hasMode($flag = null)
|
||||
{
|
||||
if (empty($flag)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (self::$MODE & $flag) === $flag;
|
||||
}
|
||||
}
|
||||
|
||||
// Initializing the default context.
|
||||
Context::load();
|
||||
303
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100000.php
vendored
Normal file
303
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100000.php
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.0.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100000 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1,
|
||||
'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'OWNER' => 1, 'PHASE' => 1, 'PROXY' => 1,
|
||||
'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1, 'RTREE' => 1,
|
||||
'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1, 'SWAPS' => 1,
|
||||
'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1, 'CLIENT' => 1,
|
||||
'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1, 'ESCAPE' => 1,
|
||||
'EVENTS' => 1, 'FAULTS' => 1, 'FIELDS' => 1, 'GLOBAL' => 1, 'GRANTS' => 1,
|
||||
'IMPORT' => 1, 'INNODB' => 1, 'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1,
|
||||
'MEDIUM' => 1, 'MEMORY' => 1, 'MODIFY' => 1, 'OFFSET' => 1, 'PARSER' => 1,
|
||||
'PLUGIN' => 1, 'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1,
|
||||
'ROLLUP' => 1, 'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1,
|
||||
'SONAME' => 1, 'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1,
|
||||
'STRING' => 1, 'TABLES' => 1,
|
||||
'AUTHORS' => 1, 'CHANGED' => 1, 'COLUMNS' => 1, 'COMMENT' => 1, 'COMPACT' => 1,
|
||||
'CONTEXT' => 1, 'DEFINER' => 1, 'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1,
|
||||
'ENGINES' => 1, 'EXECUTE' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1,
|
||||
'INSTALL' => 1, 'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1,
|
||||
'OPTIONS' => 1, 'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1,
|
||||
'REBUILD' => 1, 'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1,
|
||||
'SESSION' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'VIRTUAL' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXTENDED' => 1,
|
||||
'FUNCTION' => 1, 'INNOBASE' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'ONE_SHOT' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1, 'REDUNDANT' => 1,
|
||||
'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1,
|
||||
'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PRIVILEGES' => 1,
|
||||
'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1, 'SQL_THREAD' => 1,
|
||||
'TABLESPACE' => 1, 'TABLE_NAME' => 1,
|
||||
'COLUMN_NAME' => 1, 'CURSOR_NAME' => 1, 'EXTENT_SIZE' => 1, 'FRAC_SECOND' => 1,
|
||||
'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1, 'MYSQL_ERRNO' => 1,
|
||||
'PROCESSLIST' => 1, 'REPLICATION' => 1, 'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1,
|
||||
'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'CONTRIBUTORS' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1, 'RELAY_THREAD' => 1,
|
||||
'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1, 'SQL_TSI_WEEK' => 1,
|
||||
'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1, 'SQL_TSI_MONTH' => 1,
|
||||
'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1, 'SQL_TSI_SECOND' => 1,
|
||||
'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'MASTER_LOG_FILE' => 1,
|
||||
'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'IGNORE_SERVER_IDS' => 1, 'MASTER_SSL_CAPATH' => 1,
|
||||
'MASTER_SSL_CIPHER' => 1, 'SQL_BUFFER_RESULT' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1,
|
||||
'SQL_TSI_FRAC_SECOND' => 1,
|
||||
'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1, 'MAX_UPDATES_PER_HOUR' => 1,
|
||||
'MAX_USER_CONNECTIONS' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3, 'USE' => 3,
|
||||
'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'MIDDLEINT' => 3, 'PARTITION' => 3,
|
||||
'PRECISION' => 3, 'PROCEDURE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'TRIM' => 33,
|
||||
'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'CONCAT' => 33, 'DECODE' => 33, 'ENCODE' => 33,
|
||||
'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33, 'LENGTH' => 33,
|
||||
'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33, 'SECOND' => 33,
|
||||
'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'QUARTER' => 33, 'RADIANS' => 33, 'REVERSE' => 33, 'SOUNDEX' => 33,
|
||||
'SUBDATE' => 33, 'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33,
|
||||
'VAR_POP' => 33, 'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'ENDPOINT' => 33,
|
||||
'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33, 'ISSIMPLE' => 33,
|
||||
'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33, 'MBREQUAL' => 33, 'OVERLAPS' => 33,
|
||||
'PASSWORD' => 33, 'POSITION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33, 'CONCAT_WS' => 33,
|
||||
'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33, 'FROM_DAYS' => 33,
|
||||
'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33, 'LOAD_FILE' => 33,
|
||||
'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33, 'ROW_COUNT' => 33,
|
||||
'SUBSTRING' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'DAYOFMONTH' => 33, 'EXPORT_SET' => 33,
|
||||
'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INTERSECTS' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33, 'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'GEOMFROMWKB' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'LINEFROMTEXT' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RELEASE_LOCK' => 33,
|
||||
'SESSION_USER' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'INTERIORRINGN' => 33, 'MBRINTERSECTS' => 33,
|
||||
'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33, 'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33,
|
||||
'POINTFROMTEXT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33, 'POLYGONFROMWKB' => 33, 'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'NUMINTERIORRINGS' => 33,
|
||||
'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTIPOLYGONFROMWKB' => 33, 'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100100.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100100.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.1.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100100 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1,
|
||||
'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1, 'REDUNDANT' => 1,
|
||||
'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1,
|
||||
'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'MIDDLEINT' => 3,
|
||||
'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3, 'SENSITIVE' => 3,
|
||||
'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100200.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100200.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.2.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100200 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1, 'REDUNDANT' => 1,
|
||||
'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1,
|
||||
'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'ROWS' => 3, 'SHOW' => 3, 'THEN' => 3,
|
||||
'TRUE' => 3, 'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'MIDDLEINT' => 3,
|
||||
'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3, 'RECURSIVE' => 3,
|
||||
'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100300.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100300.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.3.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100300 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SEQUENCE' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1,
|
||||
'TRIGGERS' => 1, 'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'INVISIBLE' => 1, 'IO_THREAD' => 1,
|
||||
'ISOLATION' => 1, 'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'ROWS' => 3, 'SHOW' => 3, 'THEN' => 3,
|
||||
'TRUE' => 3, 'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'EXCEPT' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3,
|
||||
'HAVING' => 3, 'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3,
|
||||
'REGEXP' => 3, 'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3,
|
||||
'SIGNAL' => 3, 'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'INTERSECT' => 3,
|
||||
'MIDDLEINT' => 3, 'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3,
|
||||
'RECURSIVE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100400.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100400.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.4.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100400 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SEQUENCE' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1,
|
||||
'TRIGGERS' => 1, 'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'INVISIBLE' => 1, 'IO_THREAD' => 1,
|
||||
'ISOLATION' => 1, 'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'ROWS' => 3, 'SHOW' => 3, 'THEN' => 3,
|
||||
'TRUE' => 3, 'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'EXCEPT' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3,
|
||||
'HAVING' => 3, 'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3,
|
||||
'REGEXP' => 3, 'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3,
|
||||
'SIGNAL' => 3, 'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'INTERSECT' => 3,
|
||||
'MIDDLEINT' => 3, 'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3,
|
||||
'RECURSIVE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100500.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100500.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.5.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100500 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SEQUENCE' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1,
|
||||
'TRIGGERS' => 1, 'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'INVISIBLE' => 1, 'IO_THREAD' => 1,
|
||||
'ISOLATION' => 1, 'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'ROWS' => 3, 'SHOW' => 3, 'THEN' => 3,
|
||||
'TRUE' => 3, 'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'EXCEPT' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3,
|
||||
'HAVING' => 3, 'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3,
|
||||
'REGEXP' => 3, 'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3,
|
||||
'SIGNAL' => 3, 'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'INTERSECT' => 3,
|
||||
'MIDDLEINT' => 3, 'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3,
|
||||
'RECURSIVE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100600.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMariaDb100600.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MariaDB 10.6.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://mariadb.com/kb/en/reserved-words/
|
||||
*/
|
||||
class ContextMariaDb100600 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SEQUENCE' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1,
|
||||
'TRIGGERS' => 1, 'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'INVISIBLE' => 1, 'IO_THREAD' => 1,
|
||||
'ISOLATION' => 1, 'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'ROWS' => 3, 'SHOW' => 3, 'THEN' => 3,
|
||||
'TRUE' => 3, 'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'EXCEPT' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3,
|
||||
'HAVING' => 3, 'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3,
|
||||
'REGEXP' => 3, 'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3,
|
||||
'SIGNAL' => 3, 'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'INTERSECT' => 3,
|
||||
'MIDDLEINT' => 3, 'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3,
|
||||
'RECURSIVE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
276
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50000.php
vendored
Normal file
276
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50000.php
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 5.0.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/5.0/en/keywords.html
|
||||
*/
|
||||
class ContextMySql50000 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
|
||||
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'FAST' => 1,
|
||||
'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1, 'LAST' => 1, 'LOGS' => 1,
|
||||
'MODE' => 1, 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PREV' => 1, 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'TYPE' => 1, 'VIEW' => 1,
|
||||
'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1,
|
||||
'FOUND' => 1, 'HOSTS' => 1, 'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1,
|
||||
'MERGE' => 1, 'MUTEX' => 1, 'NAMES' => 1, 'NCHAR' => 1, 'PHASE' => 1,
|
||||
'QUERY' => 1, 'QUICK' => 1, 'RAID0' => 1, 'RESET' => 1, 'RTREE' => 1,
|
||||
'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1, 'SWAPS' => 1,
|
||||
'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1, 'CLIENT' => 1,
|
||||
'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1, 'ESCAPE' => 1,
|
||||
'EVENTS' => 1, 'FAULTS' => 1, 'FIELDS' => 1, 'GLOBAL' => 1, 'GRANTS' => 1,
|
||||
'IMPORT' => 1, 'INNODB' => 1, 'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1,
|
||||
'MEDIUM' => 1, 'MEMORY' => 1, 'MODIFY' => 1, 'OFFSET' => 1, 'RELOAD' => 1,
|
||||
'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1, 'SIGNED' => 1, 'SIMPLE' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STATUS' => 1, 'STRING' => 1, 'TABLES' => 1,
|
||||
'CHANGED' => 1, 'COLUMNS' => 1, 'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1,
|
||||
'DEFINER' => 1, 'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1,
|
||||
'EXECUTE' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INVOKER' => 1, 'MIGRATE' => 1,
|
||||
'PARTIAL' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'RECOVER' => 1, 'RESTORE' => 1,
|
||||
'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1, 'STORAGE' => 1, 'STRIPED' => 1,
|
||||
'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1, 'UNKNOWN' => 1, 'UPGRADE' => 1,
|
||||
'USE_FRM' => 1, 'VIRTUAL' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DUMPFILE' => 1, 'EXTENDED' => 1, 'FUNCTION' => 1,
|
||||
'INNOBASE' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MIN_ROWS' => 1, 'NATIONAL' => 1,
|
||||
'NVARCHAR' => 1, 'ONE_SHOT' => 1, 'PROFILES' => 1, 'ROLLBACK' => 1, 'SECURITY' => 1,
|
||||
'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'PACK_KEYS' => 1, 'RAID_TYPE' => 1, 'REDUNDANT' => 1, 'SAVEPOINT' => 1,
|
||||
'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1, 'UNDEFINED' => 1,
|
||||
'VARIABLES' => 1,
|
||||
'BERKELEYDB' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PRIVILEGES' => 1,
|
||||
'REPEATABLE' => 1, 'ROW_FORMAT' => 1, 'SQL_THREAD' => 1, 'TABLESPACE' => 1,
|
||||
'FRAC_SECOND' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'PROCESSLIST' => 1, 'RAID_CHUNKS' => 1, 'REPLICATION' => 1, 'SQL_TSI_DAY' => 1,
|
||||
'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'DES_KEY_FILE' => 1, 'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1,
|
||||
'SQL_TSI_HOUR' => 1, 'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1,
|
||||
'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1, 'SQL_TSI_MONTH' => 1,
|
||||
'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'MASTER_LOG_POS' => 1, 'MASTER_SSL_KEY' => 1,
|
||||
'RAID_CHUNKSIZE' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1, 'SQL_TSI_SECOND' => 1,
|
||||
'USER_RESOURCES' => 1,
|
||||
'DELAY_KEY_WRITE' => 1, 'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1,
|
||||
'SQL_TSI_QUARTER' => 1,
|
||||
'MASTER_SERVER_ID' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'SQL_BUFFER_RESULT' => 1,
|
||||
'SQL_TSI_FRAC_SECOND' => 1,
|
||||
'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1, 'MAX_UPDATES_PER_HOUR' => 1,
|
||||
'MAX_USER_CONNECTIONS' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3, 'USE' => 3,
|
||||
'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3, 'UNION' => 3,
|
||||
'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3, 'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'OPTION' => 3, 'REGEXP' => 3, 'RENAME' => 3,
|
||||
'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SONAME' => 3, 'UNLOCK' => 3,
|
||||
'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESTRICT' => 3, 'SPECIFIC' => 3, 'SQLSTATE' => 3,
|
||||
'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3, 'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'MIDDLEINT' => 3, 'PRECISION' => 3,
|
||||
'PROCEDURE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3, 'DAY_SECOND' => 3,
|
||||
'OPTIONALLY' => 3, 'REFERENCES' => 3, 'SQLWARNING' => 3, 'TERMINATED' => 3,
|
||||
'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'TRIM' => 33, 'USER' => 33,
|
||||
'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ATAN2' => 33, 'COUNT' => 33, 'CRC32' => 33, 'FIELD' => 33,
|
||||
'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33, 'LEAST' => 33, 'LOG10' => 33,
|
||||
'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33, 'POWER' => 33, 'QUOTE' => 33,
|
||||
'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33, 'SPACE' => 33, 'UCASE' => 33,
|
||||
'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'CONCAT' => 33, 'DECODE' => 33, 'ENCODE' => 33,
|
||||
'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33, 'LENGTH' => 33,
|
||||
'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33, 'SECOND' => 33,
|
||||
'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'QUARTER' => 33, 'RADIANS' => 33, 'REVERSE' => 33, 'SOUNDEX' => 33,
|
||||
'SUBDATE' => 33, 'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33,
|
||||
'VAR_POP' => 33, 'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'ENDPOINT' => 33,
|
||||
'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33, 'ISSIMPLE' => 33,
|
||||
'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33, 'MBREQUAL' => 33, 'OVERLAPS' => 33,
|
||||
'PASSWORD' => 33, 'POSITION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33, 'CONCAT_WS' => 33,
|
||||
'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33, 'FROM_DAYS' => 33,
|
||||
'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33, 'LOAD_FILE' => 33,
|
||||
'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33, 'ROW_COUNT' => 33,
|
||||
'SUBSTRING' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'DAYOFMONTH' => 33, 'EXPORT_SET' => 33,
|
||||
'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INTERSECTS' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'UNCOMPRESS' => 33, 'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'GEOMFROMWKB' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'GEOMETRYTYPE' => 33, 'GEOMFROMTEXT' => 33,
|
||||
'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33, 'OLD_PASSWORD' => 33,
|
||||
'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RELEASE_LOCK' => 33, 'SESSION_USER' => 33,
|
||||
'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'INTERIORRINGN' => 33, 'MBRINTERSECTS' => 33,
|
||||
'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33, 'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33,
|
||||
'POINTFROMTEXT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33, 'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'NUMINTERIORRINGS' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
298
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50100.php
vendored
Normal file
298
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50100.php
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 5.1.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/5.1/en/keywords.html
|
||||
*/
|
||||
class ContextMySql50100 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'BDB' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1,
|
||||
'NEW' => 1, 'ONE' => 1, 'ROW' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'GOTO' => 1, 'HASH' => 1,
|
||||
'HELP' => 1, 'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1,
|
||||
'MODE' => 1, 'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'EVENT' => 1, 'EVERY' => 1, 'FIRST' => 1,
|
||||
'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1, 'LABEL' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'OWNER' => 1, 'PHASE' => 1, 'QUERY' => 1,
|
||||
'QUICK' => 1, 'RAID0' => 1, 'RESET' => 1, 'RTREE' => 1, 'SHARE' => 1,
|
||||
'SLAVE' => 1, 'START' => 1, 'SUPER' => 1, 'SWAPS' => 1, 'TYPES' => 1,
|
||||
'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1, 'CLIENT' => 1,
|
||||
'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1, 'ESCAPE' => 1,
|
||||
'EVENTS' => 1, 'FAULTS' => 1, 'FIELDS' => 1, 'GLOBAL' => 1, 'GRANTS' => 1,
|
||||
'IMPORT' => 1, 'INNODB' => 1, 'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1,
|
||||
'MEDIUM' => 1, 'MEMORY' => 1, 'MODIFY' => 1, 'OFFSET' => 1, 'PARSER' => 1,
|
||||
'PLUGIN' => 1, 'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1,
|
||||
'ROLLUP' => 1, 'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1,
|
||||
'SONAME' => 1, 'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1,
|
||||
'STRING' => 1, 'TABLES' => 1,
|
||||
'AUTHORS' => 1, 'CHANGED' => 1, 'COLUMNS' => 1, 'COMMENT' => 1, 'COMPACT' => 1,
|
||||
'CONTEXT' => 1, 'DEFINER' => 1, 'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1,
|
||||
'ENGINES' => 1, 'EXECUTE' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STORAGE' => 1, 'STRIPED' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'VIRTUAL' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXTENDED' => 1,
|
||||
'FUNCTION' => 1, 'INNOBASE' => 1, 'LANGUAGE' => 1, 'MAXVALUE' => 1, 'MAX_ROWS' => 1,
|
||||
'MAX_SIZE' => 1, 'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'ONE_SHOT' => 1,
|
||||
'PRESERVE' => 1, 'PROFILES' => 1, 'REDOFILE' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'PARTITION' => 1, 'RAID_TYPE' => 1,
|
||||
'READ_ONLY' => 1, 'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SCHEDULER' => 1,
|
||||
'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1, 'UNDEFINED' => 1,
|
||||
'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'BERKELEYDB' => 1, 'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1,
|
||||
'CONNECTION' => 1, 'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1,
|
||||
'MASTER_SSL' => 1, 'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANISE' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1,
|
||||
'ROW_FORMAT' => 1, 'SQL_THREAD' => 1, 'TABLESPACE' => 1,
|
||||
'EXTENT_SIZE' => 1, 'FRAC_SECOND' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1,
|
||||
'MASTER_USER' => 1, 'PROCESSLIST' => 1, 'RAID_CHUNKS' => 1, 'REPLICATION' => 1,
|
||||
'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CONTRIBUTORS' => 1, 'DES_KEY_FILE' => 1, 'INITIAL_SIZE' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'PAGE_CHECKSUM' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1, 'TRANSACTIONAL' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_KEY' => 1, 'RAID_CHUNKSIZE' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'DELAY_KEY_WRITE' => 1, 'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1,
|
||||
'MASTER_SSL_CERT' => 1, 'SQL_TSI_QUARTER' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'SQL_BUFFER_RESULT' => 1,
|
||||
'SQL_TSI_FRAC_SECOND' => 1,
|
||||
'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1, 'MAX_UPDATES_PER_HOUR' => 1,
|
||||
'MAX_USER_CONNECTIONS' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3, 'USE' => 3,
|
||||
'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'UNLOCK' => 3,
|
||||
'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESTRICT' => 3, 'SPECIFIC' => 3, 'SQLSTATE' => 3,
|
||||
'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3, 'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'MIDDLEINT' => 3, 'PRECISION' => 3,
|
||||
'PROCEDURE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'TRIM' => 33, 'USER' => 33,
|
||||
'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'DECOD' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33,
|
||||
'LCASE' => 33, 'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33,
|
||||
'MONTH' => 33, 'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33,
|
||||
'SLEEP' => 33, 'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'CONCAT' => 33, 'ENCODE' => 33, 'EQUALS' => 33,
|
||||
'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33, 'LENGTH' => 33, 'LOCATE' => 33,
|
||||
'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33, 'SECOND' => 33, 'STDDEV' => 33,
|
||||
'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'QUARTER' => 33, 'RADIANS' => 33, 'REVERSE' => 33, 'SOUNDEX' => 33,
|
||||
'SUBDATE' => 33, 'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33,
|
||||
'VAR_POP' => 33, 'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'ENDPOINT' => 33,
|
||||
'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33, 'ISSIMPLE' => 33,
|
||||
'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33, 'MBREQUAL' => 33, 'OVERLAPS' => 33,
|
||||
'PASSWORD' => 33, 'POSITION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33, 'CONCAT_WS' => 33,
|
||||
'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33, 'FROM_DAYS' => 33,
|
||||
'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33, 'LOAD_FILE' => 33,
|
||||
'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33, 'ROW_COUNT' => 33,
|
||||
'SUBSTRING' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'DAYOFMONTH' => 33, 'EXPORT_SET' => 33,
|
||||
'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INTERSECTS' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'UNCOMPRESS' => 33, 'UUID_SHORT' => 33, 'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'GEOMFROMWKB' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'LINEFROMTEXT' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RELEASE_LOCK' => 33,
|
||||
'SESSION_USER' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'INTERIORRINGN' => 33, 'MBRINTERSECTS' => 33,
|
||||
'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33, 'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33,
|
||||
'POINTFROMTEXT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33, 'POLYGONFROMWKB' => 33, 'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'NUMINTERIORRINGS' => 33,
|
||||
'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTIPOLYGONFROMWKB' => 33, 'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
303
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50500.php
vendored
Normal file
303
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50500.php
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 5.5.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/5.5/en/keywords.html
|
||||
*/
|
||||
class ContextMySql50500 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'OPEN' => 1, 'PAGE' => 1, 'PORT' => 1,
|
||||
'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1, 'THAN' => 1,
|
||||
'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'OWNER' => 1, 'PHASE' => 1, 'PROXY' => 1,
|
||||
'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1, 'RTREE' => 1,
|
||||
'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1, 'SWAPS' => 1,
|
||||
'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1, 'CLIENT' => 1,
|
||||
'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1, 'ESCAPE' => 1,
|
||||
'EVENTS' => 1, 'FAULTS' => 1, 'FIELDS' => 1, 'GLOBAL' => 1, 'GRANTS' => 1,
|
||||
'IMPORT' => 1, 'INNODB' => 1, 'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1,
|
||||
'MEDIUM' => 1, 'MEMORY' => 1, 'MODIFY' => 1, 'OFFSET' => 1, 'PARSER' => 1,
|
||||
'PLUGIN' => 1, 'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1,
|
||||
'ROLLUP' => 1, 'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1,
|
||||
'SONAME' => 1, 'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1,
|
||||
'STRING' => 1, 'TABLES' => 1,
|
||||
'AUTHORS' => 1, 'CHANGED' => 1, 'COLUMNS' => 1, 'COMMENT' => 1, 'COMPACT' => 1,
|
||||
'CONTEXT' => 1, 'DEFINER' => 1, 'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1,
|
||||
'ENGINES' => 1, 'EXECUTE' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1,
|
||||
'INSTALL' => 1, 'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1,
|
||||
'OPTIONS' => 1, 'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1,
|
||||
'REBUILD' => 1, 'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1,
|
||||
'SESSION' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'VIRTUAL' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXTENDED' => 1,
|
||||
'FUNCTION' => 1, 'INNOBASE' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'ONE_SHOT' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'PARTITION' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PRIVILEGES' => 1,
|
||||
'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1, 'SQL_THREAD' => 1,
|
||||
'TABLESPACE' => 1, 'TABLE_NAME' => 1,
|
||||
'COLUMN_NAME' => 1, 'CURSOR_NAME' => 1, 'EXTENT_SIZE' => 1, 'FRAC_SECOND' => 1,
|
||||
'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1, 'MYSQL_ERRNO' => 1,
|
||||
'PROCESSLIST' => 1, 'REPLICATION' => 1, 'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1,
|
||||
'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'CONTRIBUTORS' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1, 'RELAY_THREAD' => 1,
|
||||
'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1, 'SQL_TSI_WEEK' => 1,
|
||||
'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1, 'SQL_TSI_MONTH' => 1,
|
||||
'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1, 'SQL_TSI_SECOND' => 1,
|
||||
'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'MASTER_LOG_FILE' => 1,
|
||||
'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'IGNORE_SERVER_IDS' => 1, 'MASTER_SSL_CAPATH' => 1,
|
||||
'MASTER_SSL_CIPHER' => 1, 'SQL_BUFFER_RESULT' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1,
|
||||
'SQL_TSI_FRAC_SECOND' => 1,
|
||||
'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1, 'MAX_UPDATES_PER_HOUR' => 1,
|
||||
'MAX_USER_CONNECTIONS' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3, 'USE' => 3,
|
||||
'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'MIDDLEINT' => 3, 'PRECISION' => 3,
|
||||
'PROCEDURE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'TRIM' => 33,
|
||||
'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'CONCAT' => 33, 'DECODE' => 33, 'ENCODE' => 33,
|
||||
'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33, 'LENGTH' => 33,
|
||||
'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33, 'SECOND' => 33,
|
||||
'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'QUARTER' => 33, 'RADIANS' => 33, 'REVERSE' => 33, 'SOUNDEX' => 33,
|
||||
'SUBDATE' => 33, 'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33,
|
||||
'VAR_POP' => 33, 'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'ENDPOINT' => 33,
|
||||
'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33, 'ISSIMPLE' => 33,
|
||||
'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33, 'MBREQUAL' => 33, 'OVERLAPS' => 33,
|
||||
'PASSWORD' => 33, 'POSITION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33, 'CONCAT_WS' => 33,
|
||||
'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33, 'FROM_DAYS' => 33,
|
||||
'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33, 'LOAD_FILE' => 33,
|
||||
'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33, 'ROW_COUNT' => 33,
|
||||
'SUBSTRING' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'DAYOFMONTH' => 33, 'EXPORT_SET' => 33,
|
||||
'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INTERSECTS' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33, 'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'GEOMFROMWKB' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'LINEFROMTEXT' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RELEASE_LOCK' => 33,
|
||||
'SESSION_USER' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'INTERIORRINGN' => 33, 'MBRINTERSECTS' => 33,
|
||||
'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33, 'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33,
|
||||
'POINTFROMTEXT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33, 'POLYGONFROMWKB' => 33, 'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'NUMINTERIORRINGS' => 33,
|
||||
'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTIPOLYGONFROMWKB' => 33, 'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
329
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50600.php
vendored
Normal file
329
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50600.php
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 5.6.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/5.6/en/keywords.html
|
||||
*/
|
||||
class ContextMySql50600 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1,
|
||||
'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'OWNER' => 1, 'PHASE' => 1, 'PROXY' => 1,
|
||||
'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1, 'RTREE' => 1,
|
||||
'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1, 'SWAPS' => 1,
|
||||
'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1, 'CLIENT' => 1,
|
||||
'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1, 'ESCAPE' => 1,
|
||||
'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1, 'FIELDS' => 1,
|
||||
'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1, 'ISSUER' => 1, 'LEAVES' => 1,
|
||||
'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1, 'MODIFY' => 1, 'NUMBER' => 1,
|
||||
'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1, 'RELOAD' => 1, 'REMOVE' => 1,
|
||||
'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1, 'SERVER' => 1, 'SIGNED' => 1,
|
||||
'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1, 'SOUNDS' => 1, 'SOURCE' => 1,
|
||||
'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1, 'TABLES' => 1,
|
||||
'ANALYSE' => 1, 'AUTHORS' => 1, 'CHANGED' => 1, 'COLUMNS' => 1, 'COMMENT' => 1,
|
||||
'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1, 'DISABLE' => 1,
|
||||
'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1, 'GENERAL' => 1,
|
||||
'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1, 'INVOKER' => 1, 'LOGFILE' => 1,
|
||||
'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1, 'PARTIAL' => 1, 'PLUGINS' => 1,
|
||||
'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1, 'RECOVER' => 1, 'RESTORE' => 1,
|
||||
'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1, 'STORAGE' => 1, 'SUBJECT' => 1,
|
||||
'SUSPEND' => 1, 'UNICODE' => 1, 'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1,
|
||||
'VIRTUAL' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'ONE_SHOT' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1, 'REDUNDANT' => 1,
|
||||
'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1,
|
||||
'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1,
|
||||
'COLUMN_NAME' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1, 'EXTENT_SIZE' => 1,
|
||||
'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1, 'MYSQL_ERRNO' => 1,
|
||||
'PROCESSLIST' => 1, 'REPLICATION' => 1, 'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1,
|
||||
'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'CONTRIBUTORS' => 1, 'DEFAULT_AUTH' => 1,
|
||||
'DES_KEY_FILE' => 1, 'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1,
|
||||
'PARTITIONING' => 1, 'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1,
|
||||
'SQL_TSI_HOUR' => 1, 'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'MASTER_LOG_FILE' => 1,
|
||||
'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1,
|
||||
'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'IGNORE_SERVER_IDS' => 1, 'MASTER_SSL_CAPATH' => 1,
|
||||
'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1, 'SQL_BUFFER_RESULT' => 1,
|
||||
'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'SQL_AFTER_MTS_GAPS' => 1, 'STATS_SAMPLE_PAGES' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'MIDDLEINT' => 3, 'PARTITION' => 3,
|
||||
'PRECISION' => 3, 'PROCEDURE' => 3, 'SENSITIVE' => 3, 'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'ENDPOINT' => 33,
|
||||
'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33, 'ISSIMPLE' => 33,
|
||||
'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33, 'MBREQUAL' => 33, 'OVERLAPS' => 33,
|
||||
'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33, 'ST_ASWKT' => 33, 'ST_UNION' => 33,
|
||||
'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33, 'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33, 'CONCAT_WS' => 33,
|
||||
'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33, 'FROM_DAYS' => 33,
|
||||
'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33, 'LOAD_FILE' => 33,
|
||||
'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33, 'ROW_COUNT' => 33,
|
||||
'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33, 'ST_POINTN' => 33,
|
||||
'ST_WITHIN' => 33, 'SUBSTRING' => 33, 'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'DAYOFMONTH' => 33, 'EXPORT_SET' => 33,
|
||||
'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33, 'INET6_NTOA' => 33,
|
||||
'INTERSECTS' => 33, 'MBRTOUCHES' => 33, 'NAME_CONST' => 33, 'PERIOD_ADD' => 33,
|
||||
'STARTPOINT' => 33, 'STDDEV_POP' => 33, 'ST_CROSSES' => 33, 'ST_ISEMPTY' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33,
|
||||
'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33, 'MICROSECOND' => 33, 'PERIOD_DIFF' => 33,
|
||||
'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33, 'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33,
|
||||
'ST_ASBINARY' => 33, 'ST_CENTROID' => 33, 'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33,
|
||||
'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33, 'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33,
|
||||
'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'LINEFROMTEXT' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_DIMENSION' => 33, 'ST_GEOMETRYN' => 33,
|
||||
'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'CREATE_DIGEST' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33,
|
||||
'INTERIORRINGN' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_DIFFERENCE' => 33,
|
||||
'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33, 'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'ASYMMETRIC_SIGN' => 33, 'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33,
|
||||
'ST_EXTERIORRING' => 33, 'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33,
|
||||
'ST_LINEFROMTEXT' => 33, 'ST_POINTFROMWKB' => 33, 'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33, 'ST_NUMGEOMETRIES' => 33,
|
||||
'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'ASYMMETRIC_DERIVE' => 33, 'ASYMMETRIC_VERIFY' => 33, 'LINESTRINGFROMWKB' => 33,
|
||||
'MULTIPOINTFROMWKB' => 33, 'ST_POLYGONFROMWKB' => 33,
|
||||
'ASYMMETRIC_DECRYPT' => 33, 'ASYMMETRIC_ENCRYPT' => 33, 'MULTIPOINTFROMTEXT' => 33,
|
||||
'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33, 'ST_GEOMETRYFROMTEXT' => 33,
|
||||
'ST_NUMINTERIORRINGS' => 33, 'UNCOMPRESSED_LENGTH' => 33,
|
||||
'CREATE_DH_PARAMETERS' => 33, 'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33,
|
||||
'CREATE_ASYMMETRIC_PUB_KEY' => 33, 'GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'CREATE_ASYMMETRIC_PRIV_KEY' => 33, 'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'SQL_THREAD_WAIT_AFTER_GTIDS' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50700.php
vendored
Normal file
351
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql50700.php
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 5.7.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/5.7/en/keywords.html
|
||||
*/
|
||||
class ContextMySql50700 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1,
|
||||
'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1, 'REBUILD' => 1,
|
||||
'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1, 'SESSION' => 1,
|
||||
'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1, 'UNICODE' => 1,
|
||||
'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1, 'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'IO_THREAD' => 1, 'ISOLATION' => 1,
|
||||
'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1, 'REDUNDANT' => 1,
|
||||
'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1, 'TEMPTABLE' => 1,
|
||||
'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1, 'SQL_TSI_HOUR' => 1,
|
||||
'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3, 'UNDO' => 3,
|
||||
'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'MIDDLEINT' => 3,
|
||||
'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3, 'SENSITIVE' => 3,
|
||||
'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'QUARTER' => 33, 'RADIANS' => 33,
|
||||
'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33, 'SUBDATE' => 33,
|
||||
'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33, 'VAR_POP' => 33,
|
||||
'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'CHAR_LENGTH' => 33, 'DATE_FORMAT' => 33,
|
||||
'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33, 'FROM_BASE64' => 33,
|
||||
'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33, 'JSON_LENGTH' => 33,
|
||||
'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33, 'JSON_SEARCH' => 33,
|
||||
'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33, 'MBROVERLAPS' => 33,
|
||||
'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33, 'SEC_TO_TIME' => 33,
|
||||
'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33, 'ST_CENTROID' => 33,
|
||||
'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33, 'ST_ENDPOINT' => 33,
|
||||
'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33, 'ST_OVERLAPS' => 33,
|
||||
'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33, 'TIME_FORMAT' => 33,
|
||||
'TIME_TO_SEC' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
352
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql80000.php
vendored
Normal file
352
pma/vendor/phpmyadmin/sql-parser/src/Contexts/ContextMySql80000.php
vendored
Normal file
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Contexts;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Context for MySQL 8.0.
|
||||
*
|
||||
* This class was auto-generated from tools/contexts/*.txt.
|
||||
* Use tools/run_generators.sh for update.
|
||||
*
|
||||
* @see https://dev.mysql.com/doc/refman/8.0/en/keywords.html
|
||||
*/
|
||||
class ContextMySql80000 extends Context
|
||||
{
|
||||
/**
|
||||
* List of keywords.
|
||||
*
|
||||
* The value associated to each keyword represents its flags.
|
||||
*
|
||||
* @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED
|
||||
* Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY
|
||||
* Token::FLAG_KEYWORD_FUNCTION
|
||||
*
|
||||
* @var array<string,int>
|
||||
* @phpstan-var non-empty-array<non-empty-string,Token::FLAG_KEYWORD_*|int>
|
||||
*/
|
||||
public static $KEYWORDS = [
|
||||
'AT' => 1, 'DO' => 1, 'IO' => 1, 'NO' => 1, 'XA' => 1,
|
||||
'ANY' => 1, 'CPU' => 1, 'END' => 1, 'IPC' => 1, 'NDB' => 1, 'NEW' => 1,
|
||||
'ONE' => 1, 'ROW' => 1, 'XID' => 1,
|
||||
'BOOL' => 1, 'BYTE' => 1, 'CODE' => 1, 'CUBE' => 1, 'DATA' => 1, 'DISK' => 1,
|
||||
'ENDS' => 1, 'FAST' => 1, 'FILE' => 1, 'FULL' => 1, 'HASH' => 1, 'HELP' => 1,
|
||||
'HOST' => 1, 'LAST' => 1, 'LESS' => 1, 'LIST' => 1, 'LOGS' => 1, 'MODE' => 1,
|
||||
'NAME' => 1, 'NEXT' => 1, 'NONE' => 1, 'ONLY' => 1, 'OPEN' => 1, 'PAGE' => 1,
|
||||
'PORT' => 1, 'PREV' => 1, 'ROWS' => 1, 'SLOW' => 1, 'SOME' => 1, 'STOP' => 1,
|
||||
'THAN' => 1, 'TYPE' => 1, 'VIEW' => 1, 'WAIT' => 1, 'WORK' => 1, 'X509' => 1,
|
||||
'AFTER' => 1, 'BEGIN' => 1, 'BLOCK' => 1, 'BTREE' => 1, 'CACHE' => 1,
|
||||
'CHAIN' => 1, 'CLOSE' => 1, 'ERROR' => 1, 'EVENT' => 1, 'EVERY' => 1,
|
||||
'FIRST' => 1, 'FIXED' => 1, 'FLUSH' => 1, 'FOUND' => 1, 'HOSTS' => 1,
|
||||
'LEVEL' => 1, 'LOCAL' => 1, 'LOCKS' => 1, 'MERGE' => 1, 'MUTEX' => 1,
|
||||
'NAMES' => 1, 'NCHAR' => 1, 'NEVER' => 1, 'OWNER' => 1, 'PHASE' => 1,
|
||||
'PROXY' => 1, 'QUERY' => 1, 'QUICK' => 1, 'RELAY' => 1, 'RESET' => 1,
|
||||
'RTREE' => 1, 'SHARE' => 1, 'SLAVE' => 1, 'START' => 1, 'SUPER' => 1,
|
||||
'SWAPS' => 1, 'TYPES' => 1, 'UNTIL' => 1, 'VALUE' => 1,
|
||||
'ACTION' => 1, 'ALWAYS' => 1, 'BACKUP' => 1, 'BINLOG' => 1, 'CIPHER' => 1,
|
||||
'CLIENT' => 1, 'COMMIT' => 1, 'ENABLE' => 1, 'ENGINE' => 1, 'ERRORS' => 1,
|
||||
'ESCAPE' => 1, 'EVENTS' => 1, 'EXPIRE' => 1, 'EXPORT' => 1, 'FAULTS' => 1,
|
||||
'FIELDS' => 1, 'FILTER' => 1, 'GLOBAL' => 1, 'GRANTS' => 1, 'IMPORT' => 1,
|
||||
'ISSUER' => 1, 'LEAVES' => 1, 'MASTER' => 1, 'MEDIUM' => 1, 'MEMORY' => 1,
|
||||
'MODIFY' => 1, 'NUMBER' => 1, 'OFFSET' => 1, 'PARSER' => 1, 'PLUGIN' => 1,
|
||||
'RELOAD' => 1, 'REMOVE' => 1, 'REPAIR' => 1, 'RESUME' => 1, 'ROLLUP' => 1,
|
||||
'SERVER' => 1, 'SIGNED' => 1, 'SIMPLE' => 1, 'SOCKET' => 1, 'SONAME' => 1,
|
||||
'SOUNDS' => 1, 'SOURCE' => 1, 'STARTS' => 1, 'STATUS' => 1, 'STRING' => 1,
|
||||
'TABLES' => 1,
|
||||
'ACCOUNT' => 1, 'ANALYSE' => 1, 'CHANGED' => 1, 'CHANNEL' => 1, 'COLUMNS' => 1,
|
||||
'COMMENT' => 1, 'COMPACT' => 1, 'CONTEXT' => 1, 'CURRENT' => 1, 'DEFINER' => 1,
|
||||
'DISABLE' => 1, 'DISCARD' => 1, 'DYNAMIC' => 1, 'ENGINES' => 1, 'EXECUTE' => 1,
|
||||
'FOLLOWS' => 1, 'GENERAL' => 1, 'HANDLER' => 1, 'INDEXES' => 1, 'INSTALL' => 1,
|
||||
'INVOKER' => 1, 'LOGFILE' => 1, 'MIGRATE' => 1, 'NO_WAIT' => 1, 'OPTIONS' => 1,
|
||||
'PARTIAL' => 1, 'PERSIST' => 1, 'PLUGINS' => 1, 'PREPARE' => 1, 'PROFILE' => 1,
|
||||
'REBUILD' => 1, 'RECOVER' => 1, 'RESTORE' => 1, 'RETURNS' => 1, 'ROUTINE' => 1,
|
||||
'SESSION' => 1, 'STACKED' => 1, 'STORAGE' => 1, 'SUBJECT' => 1, 'SUSPEND' => 1,
|
||||
'UNICODE' => 1, 'UNKNOWN' => 1, 'UPGRADE' => 1, 'USE_FRM' => 1, 'WITHOUT' => 1,
|
||||
'WRAPPER' => 1,
|
||||
'CASCADED' => 1, 'CHECKSUM' => 1, 'DATAFILE' => 1, 'DUMPFILE' => 1, 'EXCHANGE' => 1,
|
||||
'EXTENDED' => 1, 'FUNCTION' => 1, 'LANGUAGE' => 1, 'MAX_ROWS' => 1, 'MAX_SIZE' => 1,
|
||||
'MIN_ROWS' => 1, 'NATIONAL' => 1, 'NVARCHAR' => 1, 'PRECEDES' => 1, 'PRESERVE' => 1,
|
||||
'PROFILES' => 1, 'REDOFILE' => 1, 'RELAYLOG' => 1, 'ROLLBACK' => 1, 'SCHEDULE' => 1,
|
||||
'SECURITY' => 1, 'SHUTDOWN' => 1, 'SNAPSHOT' => 1, 'SWITCHES' => 1, 'TRIGGERS' => 1,
|
||||
'UNDOFILE' => 1, 'WARNINGS' => 1,
|
||||
'AGGREGATE' => 1, 'ALGORITHM' => 1, 'COMMITTED' => 1, 'DIRECTORY' => 1,
|
||||
'DUPLICATE' => 1, 'EXPANSION' => 1, 'INVISIBLE' => 1, 'IO_THREAD' => 1,
|
||||
'ISOLATION' => 1, 'NODEGROUP' => 1, 'PACK_KEYS' => 1, 'READ_ONLY' => 1,
|
||||
'REDUNDANT' => 1, 'SAVEPOINT' => 1, 'SQL_CACHE' => 1, 'TEMPORARY' => 1,
|
||||
'TEMPTABLE' => 1, 'UNDEFINED' => 1, 'UNINSTALL' => 1, 'VARIABLES' => 1,
|
||||
'COMPLETION' => 1, 'COMPRESSED' => 1, 'CONCURRENT' => 1, 'CONNECTION' => 1,
|
||||
'CONSISTENT' => 1, 'DEALLOCATE' => 1, 'IDENTIFIED' => 1, 'MASTER_SSL' => 1,
|
||||
'NDBCLUSTER' => 1, 'PARTITIONS' => 1, 'PERSISTENT' => 1, 'PLUGIN_DIR' => 1,
|
||||
'PRIVILEGES' => 1, 'REORGANIZE' => 1, 'REPEATABLE' => 1, 'ROW_FORMAT' => 1,
|
||||
'SQL_THREAD' => 1, 'TABLESPACE' => 1, 'TABLE_NAME' => 1, 'VALIDATION' => 1,
|
||||
'COLUMN_NAME' => 1, 'COMPRESSION' => 1, 'CURSOR_NAME' => 1, 'DIAGNOSTICS' => 1,
|
||||
'EXTENT_SIZE' => 1, 'MASTER_HOST' => 1, 'MASTER_PORT' => 1, 'MASTER_USER' => 1,
|
||||
'MYSQL_ERRNO' => 1, 'NONBLOCKING' => 1, 'PROCESSLIST' => 1, 'REPLICATION' => 1,
|
||||
'SCHEMA_NAME' => 1, 'SQL_TSI_DAY' => 1, 'TRANSACTION' => 1, 'UNCOMMITTED' => 1,
|
||||
'CATALOG_NAME' => 1, 'CLASS_ORIGIN' => 1, 'DEFAULT_AUTH' => 1, 'DES_KEY_FILE' => 1,
|
||||
'INITIAL_SIZE' => 1, 'MASTER_DELAY' => 1, 'MESSAGE_TEXT' => 1, 'PARTITIONING' => 1,
|
||||
'PERSIST_ONLY' => 1, 'RELAY_THREAD' => 1, 'SERIALIZABLE' => 1, 'SQL_NO_CACHE' => 1,
|
||||
'SQL_TSI_HOUR' => 1, 'SQL_TSI_WEEK' => 1, 'SQL_TSI_YEAR' => 1, 'SUBPARTITION' => 1,
|
||||
'COLUMN_FORMAT' => 1, 'INSERT_METHOD' => 1, 'MASTER_SSL_CA' => 1, 'RELAY_LOG_POS' => 1,
|
||||
'SQL_TSI_MONTH' => 1, 'SUBPARTITIONS' => 1,
|
||||
'AUTO_INCREMENT' => 1, 'AVG_ROW_LENGTH' => 1, 'KEY_BLOCK_SIZE' => 1, 'MASTER_LOG_POS' => 1,
|
||||
'MASTER_SSL_CRL' => 1, 'MASTER_SSL_KEY' => 1, 'RELAY_LOG_FILE' => 1, 'SQL_TSI_MINUTE' => 1,
|
||||
'SQL_TSI_SECOND' => 1, 'TABLE_CHECKSUM' => 1, 'USER_RESOURCES' => 1,
|
||||
'AUTOEXTEND_SIZE' => 1, 'CONSTRAINT_NAME' => 1, 'DELAY_KEY_WRITE' => 1, 'FILE_BLOCK_SIZE' => 1,
|
||||
'MASTER_LOG_FILE' => 1, 'MASTER_PASSWORD' => 1, 'MASTER_SSL_CERT' => 1, 'PARSE_GCOL_EXPR' => 1,
|
||||
'REPLICATE_DO_DB' => 1, 'SQL_AFTER_GTIDS' => 1, 'SQL_TSI_QUARTER' => 1, 'SUBCLASS_ORIGIN' => 1,
|
||||
'MASTER_SERVER_ID' => 1, 'REDO_BUFFER_SIZE' => 1, 'SQL_BEFORE_GTIDS' => 1,
|
||||
'STATS_PERSISTENT' => 1, 'UNDO_BUFFER_SIZE' => 1,
|
||||
'CONSTRAINT_SCHEMA' => 1, 'GROUP_REPLICATION' => 1, 'IGNORE_SERVER_IDS' => 1,
|
||||
'MASTER_SSL_CAPATH' => 1, 'MASTER_SSL_CIPHER' => 1, 'RETURNED_SQLSTATE' => 1,
|
||||
'SQL_BUFFER_RESULT' => 1, 'STATS_AUTO_RECALC' => 1,
|
||||
'CONSTRAINT_CATALOG' => 1, 'MASTER_RETRY_COUNT' => 1, 'MASTER_SSL_CRLPATH' => 1,
|
||||
'MAX_STATEMENT_TIME' => 1, 'REPLICATE_DO_TABLE' => 1, 'SQL_AFTER_MTS_GAPS' => 1,
|
||||
'STATS_SAMPLE_PAGES' => 1,
|
||||
'REPLICATE_IGNORE_DB' => 1,
|
||||
'MASTER_AUTO_POSITION' => 1, 'MASTER_CONNECT_RETRY' => 1, 'MAX_QUERIES_PER_HOUR' => 1,
|
||||
'MAX_UPDATES_PER_HOUR' => 1, 'MAX_USER_CONNECTIONS' => 1, 'REPLICATE_REWRITE_DB' => 1,
|
||||
'REPLICATE_IGNORE_TABLE' => 1,
|
||||
'MASTER_HEARTBEAT_PERIOD' => 1, 'REPLICATE_WILD_DO_TABLE' => 1,
|
||||
'MAX_CONNECTIONS_PER_HOUR' => 1,
|
||||
'REPLICATE_WILD_IGNORE_TABLE' => 1,
|
||||
|
||||
'AS' => 3, 'BY' => 3, 'IS' => 3, 'ON' => 3, 'OR' => 3, 'TO' => 3,
|
||||
'ADD' => 3, 'ALL' => 3, 'AND' => 3, 'ASC' => 3, 'DEC' => 3, 'DIV' => 3,
|
||||
'FOR' => 3, 'GET' => 3, 'NOT' => 3, 'OUT' => 3, 'SQL' => 3, 'SSL' => 3,
|
||||
'USE' => 3, 'XOR' => 3,
|
||||
'BOTH' => 3, 'CALL' => 3, 'CASE' => 3, 'DESC' => 3, 'DROP' => 3, 'DUAL' => 3,
|
||||
'EACH' => 3, 'ELSE' => 3, 'EXIT' => 3, 'FROM' => 3, 'INT1' => 3, 'INT2' => 3,
|
||||
'INT3' => 3, 'INT4' => 3, 'INT8' => 3, 'INTO' => 3, 'JOIN' => 3, 'KEYS' => 3,
|
||||
'KILL' => 3, 'LIKE' => 3, 'LOAD' => 3, 'LOCK' => 3, 'LONG' => 3, 'LOOP' => 3,
|
||||
'NULL' => 3, 'OVER' => 3, 'READ' => 3, 'SHOW' => 3, 'THEN' => 3, 'TRUE' => 3,
|
||||
'UNDO' => 3, 'WHEN' => 3, 'WITH' => 3,
|
||||
'ALTER' => 3, 'CHECK' => 3, 'CROSS' => 3, 'FALSE' => 3, 'FETCH' => 3,
|
||||
'FORCE' => 3, 'GRANT' => 3, 'GROUP' => 3, 'INNER' => 3, 'INOUT' => 3,
|
||||
'LEAVE' => 3, 'LIMIT' => 3, 'LINES' => 3, 'ORDER' => 3, 'OUTER' => 3,
|
||||
'PURGE' => 3, 'RANGE' => 3, 'READS' => 3, 'RLIKE' => 3, 'TABLE' => 3,
|
||||
'UNION' => 3, 'USAGE' => 3, 'USING' => 3, 'WHERE' => 3, 'WHILE' => 3,
|
||||
'WRITE' => 3,
|
||||
'BEFORE' => 3, 'CHANGE' => 3, 'COLUMN' => 3, 'CREATE' => 3, 'CURSOR' => 3,
|
||||
'DELETE' => 3, 'ELSEIF' => 3, 'FLOAT4' => 3, 'FLOAT8' => 3, 'HAVING' => 3,
|
||||
'IGNORE' => 3, 'INFILE' => 3, 'LINEAR' => 3, 'OPTION' => 3, 'REGEXP' => 3,
|
||||
'RENAME' => 3, 'RETURN' => 3, 'REVOKE' => 3, 'SELECT' => 3, 'SIGNAL' => 3,
|
||||
'STORED' => 3, 'UNLOCK' => 3, 'UPDATE' => 3,
|
||||
'ANALYZE' => 3, 'BETWEEN' => 3, 'CASCADE' => 3, 'COLLATE' => 3, 'DECLARE' => 3,
|
||||
'DELAYED' => 3, 'ESCAPED' => 3, 'EXPLAIN' => 3, 'FOREIGN' => 3, 'ITERATE' => 3,
|
||||
'LEADING' => 3, 'NATURAL' => 3, 'OUTFILE' => 3, 'PRIMARY' => 3, 'RELEASE' => 3,
|
||||
'REQUIRE' => 3, 'SCHEMAS' => 3, 'TRIGGER' => 3, 'VARYING' => 3, 'VIRTUAL' => 3,
|
||||
'CONTINUE' => 3, 'DAY_HOUR' => 3, 'DESCRIBE' => 3, 'DISTINCT' => 3, 'ENCLOSED' => 3,
|
||||
'MAXVALUE' => 3, 'MODIFIES' => 3, 'OPTIMIZE' => 3, 'RESIGNAL' => 3, 'RESTRICT' => 3,
|
||||
'SPECIFIC' => 3, 'SQLSTATE' => 3, 'STARTING' => 3, 'TRAILING' => 3, 'UNSIGNED' => 3,
|
||||
'ZEROFILL' => 3,
|
||||
'CONDITION' => 3, 'DATABASES' => 3, 'GENERATED' => 3, 'MIDDLEINT' => 3,
|
||||
'PARTITION' => 3, 'PRECISION' => 3, 'PROCEDURE' => 3, 'SENSITIVE' => 3,
|
||||
'SEPARATOR' => 3,
|
||||
'ACCESSIBLE' => 3, 'ASENSITIVE' => 3, 'CONSTRAINT' => 3, 'DAY_MINUTE' => 3,
|
||||
'DAY_SECOND' => 3, 'OPTIONALLY' => 3, 'READ_WRITE' => 3, 'REFERENCES' => 3,
|
||||
'SQLWARNING' => 3, 'TERMINATED' => 3, 'YEAR_MONTH' => 3,
|
||||
'DISTINCTROW' => 3, 'HOUR_MINUTE' => 3, 'HOUR_SECOND' => 3, 'INSENSITIVE' => 3,
|
||||
'MASTER_BIND' => 3,
|
||||
'LOW_PRIORITY' => 3, 'SQLEXCEPTION' => 3, 'VARCHARACTER' => 3,
|
||||
'DETERMINISTIC' => 3, 'HIGH_PRIORITY' => 3, 'MINUTE_SECOND' => 3, 'STRAIGHT_JOIN' => 3,
|
||||
'IO_AFTER_GTIDS' => 3, 'SQL_BIG_RESULT' => 3,
|
||||
'DAY_MICROSECOND' => 3, 'IO_BEFORE_GTIDS' => 3, 'OPTIMIZER_COSTS' => 3,
|
||||
'HOUR_MICROSECOND' => 3, 'SQL_SMALL_RESULT' => 3,
|
||||
'MINUTE_MICROSECOND' => 3, 'NO_WRITE_TO_BINLOG' => 3, 'SECOND_MICROSECOND' => 3,
|
||||
'SQL_CALC_FOUND_ROWS' => 3,
|
||||
'MASTER_SSL_VERIFY_SERVER_CERT' => 3,
|
||||
|
||||
'NO SQL' => 7,
|
||||
'GROUP BY' => 7, 'NOT NULL' => 7, 'ORDER BY' => 7, 'SET NULL' => 7,
|
||||
'AND CHAIN' => 7, 'FULL JOIN' => 7, 'IF EXISTS' => 7, 'LEFT JOIN' => 7,
|
||||
'LESS THAN' => 7, 'LOAD DATA' => 7, 'NO ACTION' => 7, 'ON DELETE' => 7,
|
||||
'ON UPDATE' => 7, 'UNION ALL' => 7,
|
||||
'CROSS JOIN' => 7, 'ESCAPED BY' => 7, 'FOR UPDATE' => 7, 'INNER JOIN' => 7,
|
||||
'LINEAR KEY' => 7, 'NO RELEASE' => 7, 'OR REPLACE' => 7, 'RIGHT JOIN' => 7,
|
||||
'ENCLOSED BY' => 7, 'LINEAR HASH' => 7, 'ON SCHEDULE' => 7, 'STARTING BY' => 7,
|
||||
'AND NO CHAIN' => 7, 'CONTAINS SQL' => 7, 'FOR EACH ROW' => 7, 'NATURAL JOIN' => 7,
|
||||
'PARTITION BY' => 7, 'SET PASSWORD' => 7, 'SQL SECURITY' => 7,
|
||||
'CHARACTER SET' => 7, 'IF NOT EXISTS' => 7, 'TERMINATED BY' => 7,
|
||||
'DATA DIRECTORY' => 7, 'READS SQL DATA' => 7, 'UNION DISTINCT' => 7,
|
||||
'DEFAULT CHARSET' => 7, 'DEFAULT COLLATE' => 7, 'FULL OUTER JOIN' => 7, 'INDEX DIRECTORY' => 7,
|
||||
'LEFT OUTER JOIN' => 7, 'SUBPARTITION BY' => 7,
|
||||
'DISABLE ON SLAVE' => 7, 'GENERATED ALWAYS' => 7, 'RIGHT OUTER JOIN' => 7,
|
||||
'MODIFIES SQL DATA' => 7, 'NATURAL LEFT JOIN' => 7, 'START TRANSACTION' => 7,
|
||||
'LOCK IN SHARE MODE' => 7, 'NATURAL RIGHT JOIN' => 7, 'SELECT TRANSACTION' => 7,
|
||||
'DEFAULT CHARACTER SET' => 7,
|
||||
'ON COMPLETION PRESERVE' => 7,
|
||||
'NATURAL LEFT OUTER JOIN' => 7,
|
||||
'NATURAL RIGHT OUTER JOIN' => 7, 'WITH CONSISTENT SNAPSHOT' => 7,
|
||||
'ON COMPLETION NOT PRESERVE' => 7,
|
||||
|
||||
'BIT' => 9, 'XML' => 9,
|
||||
'ENUM' => 9, 'JSON' => 9, 'TEXT' => 9,
|
||||
'ARRAY' => 9,
|
||||
'SERIAL' => 9,
|
||||
'BOOLEAN' => 9,
|
||||
'DATETIME' => 9, 'GEOMETRY' => 9, 'MULTISET' => 9,
|
||||
'MULTILINEPOINT' => 9,
|
||||
'MULTILINEPOLYGON' => 9,
|
||||
|
||||
'INT' => 11, 'SET' => 11,
|
||||
'BLOB' => 11, 'REAL' => 11,
|
||||
'FLOAT' => 11,
|
||||
'BIGINT' => 11, 'DOUBLE' => 11,
|
||||
'DECIMAL' => 11, 'INTEGER' => 11, 'NUMERIC' => 11, 'TINYINT' => 11, 'VARCHAR' => 11,
|
||||
'LONGBLOB' => 11, 'LONGTEXT' => 11, 'SMALLINT' => 11, 'TINYBLOB' => 11, 'TINYTEXT' => 11,
|
||||
'CHARACTER' => 11, 'MEDIUMINT' => 11, 'VARBINARY' => 11,
|
||||
'MEDIUMBLOB' => 11, 'MEDIUMTEXT' => 11,
|
||||
|
||||
'BINARY VARYING' => 15,
|
||||
|
||||
'KEY' => 19,
|
||||
'INDEX' => 19,
|
||||
'UNIQUE' => 19,
|
||||
'SPATIAL' => 19,
|
||||
'FULLTEXT' => 19,
|
||||
|
||||
'INDEX KEY' => 23,
|
||||
'UNIQUE KEY' => 23,
|
||||
'FOREIGN KEY' => 23, 'PRIMARY KEY' => 23, 'SPATIAL KEY' => 23,
|
||||
'FULLTEXT KEY' => 23, 'UNIQUE INDEX' => 23,
|
||||
'SPATIAL INDEX' => 23,
|
||||
'FULLTEXT INDEX' => 23,
|
||||
|
||||
'X' => 33, 'Y' => 33,
|
||||
'LN' => 33, 'PI' => 33,
|
||||
'ABS' => 33, 'AVG' => 33, 'BIN' => 33, 'COS' => 33, 'COT' => 33, 'DAY' => 33,
|
||||
'ELT' => 33, 'EXP' => 33, 'HEX' => 33, 'LOG' => 33, 'MAX' => 33, 'MD5' => 33,
|
||||
'MID' => 33, 'MIN' => 33, 'NOW' => 33, 'OCT' => 33, 'ORD' => 33, 'POW' => 33,
|
||||
'SHA' => 33, 'SIN' => 33, 'STD' => 33, 'SUM' => 33, 'TAN' => 33,
|
||||
'ACOS' => 33, 'AREA' => 33, 'ASIN' => 33, 'ATAN' => 33, 'CAST' => 33, 'CEIL' => 33,
|
||||
'CONV' => 33, 'HOUR' => 33, 'LOG2' => 33, 'LPAD' => 33, 'RAND' => 33, 'RPAD' => 33,
|
||||
'SHA1' => 33, 'SHA2' => 33, 'SIGN' => 33, 'SQRT' => 33, 'SRID' => 33, 'ST_X' => 33,
|
||||
'ST_Y' => 33, 'TRIM' => 33, 'USER' => 33, 'UUID' => 33, 'WEEK' => 33,
|
||||
'ASCII' => 33, 'ASWKB' => 33, 'ASWKT' => 33, 'ATAN2' => 33, 'COUNT' => 33,
|
||||
'CRC32' => 33, 'FIELD' => 33, 'FLOOR' => 33, 'INSTR' => 33, 'LCASE' => 33,
|
||||
'LEAST' => 33, 'LOG10' => 33, 'LOWER' => 33, 'LTRIM' => 33, 'MONTH' => 33,
|
||||
'POWER' => 33, 'QUOTE' => 33, 'ROUND' => 33, 'RTRIM' => 33, 'SLEEP' => 33,
|
||||
'SPACE' => 33, 'UCASE' => 33, 'UNHEX' => 33, 'UPPER' => 33,
|
||||
'ASTEXT' => 33, 'BIT_OR' => 33, 'BUFFER' => 33, 'CONCAT' => 33, 'DECODE' => 33,
|
||||
'ENCODE' => 33, 'EQUALS' => 33, 'FORMAT' => 33, 'IFNULL' => 33, 'ISNULL' => 33,
|
||||
'LENGTH' => 33, 'LOCATE' => 33, 'MINUTE' => 33, 'NULLIF' => 33, 'POINTN' => 33,
|
||||
'SECOND' => 33, 'STDDEV' => 33, 'STRCMP' => 33, 'SUBSTR' => 33, 'WITHIN' => 33,
|
||||
'ADDDATE' => 33, 'ADDTIME' => 33, 'AGAINST' => 33, 'BIT_AND' => 33, 'BIT_XOR' => 33,
|
||||
'CEILING' => 33, 'CHARSET' => 33, 'CROSSES' => 33, 'CURDATE' => 33, 'CURTIME' => 33,
|
||||
'DAYNAME' => 33, 'DEGREES' => 33, 'ENCRYPT' => 33, 'EXTRACT' => 33, 'GLENGTH' => 33,
|
||||
'ISEMPTY' => 33, 'IS_IPV4' => 33, 'IS_IPV6' => 33, 'IS_UUID' => 33, 'QUARTER' => 33,
|
||||
'RADIANS' => 33, 'REVERSE' => 33, 'SOUNDEX' => 33, 'ST_AREA' => 33, 'ST_SRID' => 33,
|
||||
'SUBDATE' => 33, 'SUBTIME' => 33, 'SYSDATE' => 33, 'TOUCHES' => 33, 'TO_DAYS' => 33,
|
||||
'VAR_POP' => 33, 'VERSION' => 33, 'WEEKDAY' => 33,
|
||||
'ASBINARY' => 33, 'CENTROID' => 33, 'COALESCE' => 33, 'COMPRESS' => 33, 'CONTAINS' => 33,
|
||||
'DATEDIFF' => 33, 'DATE_ADD' => 33, 'DATE_SUB' => 33, 'DISJOINT' => 33, 'DISTANCE' => 33,
|
||||
'ENDPOINT' => 33, 'ENVELOPE' => 33, 'GET_LOCK' => 33, 'GREATEST' => 33, 'ISCLOSED' => 33,
|
||||
'ISSIMPLE' => 33, 'JSON_SET' => 33, 'MAKEDATE' => 33, 'MAKETIME' => 33, 'MAKE_SET' => 33,
|
||||
'MBREQUAL' => 33, 'OVERLAPS' => 33, 'PASSWORD' => 33, 'POSITION' => 33, 'ST_ASWKB' => 33,
|
||||
'ST_ASWKT' => 33, 'ST_UNION' => 33, 'TIMEDIFF' => 33, 'TRUNCATE' => 33, 'VARIANCE' => 33,
|
||||
'VAR_SAMP' => 33, 'YEARWEEK' => 33,
|
||||
'ANY_VALUE' => 33, 'BENCHMARK' => 33, 'BIT_COUNT' => 33, 'COLLATION' => 33,
|
||||
'CONCAT_WS' => 33, 'DAYOFWEEK' => 33, 'DAYOFYEAR' => 33, 'DIMENSION' => 33,
|
||||
'FROM_DAYS' => 33, 'GEOMETRYN' => 33, 'INET_ATON' => 33, 'INET_NTOA' => 33,
|
||||
'JSON_KEYS' => 33, 'JSON_TYPE' => 33, 'LOAD_FILE' => 33, 'MBRCOVERS' => 33,
|
||||
'MBREQUALS' => 33, 'MBRWITHIN' => 33, 'MONTHNAME' => 33, 'NUMPOINTS' => 33,
|
||||
'ROW_COUNT' => 33, 'ST_ASTEXT' => 33, 'ST_BUFFER' => 33, 'ST_EQUALS' => 33,
|
||||
'ST_LENGTH' => 33, 'ST_POINTN' => 33, 'ST_WITHIN' => 33, 'SUBSTRING' => 33,
|
||||
'TO_BASE64' => 33, 'UPDATEXML' => 33,
|
||||
'BIT_LENGTH' => 33, 'CONVERT_TZ' => 33, 'CONVEXHULL' => 33, 'DAYOFMONTH' => 33,
|
||||
'EXPORT_SET' => 33, 'FOUND_ROWS' => 33, 'GET_FORMAT' => 33, 'INET6_ATON' => 33,
|
||||
'INET6_NTOA' => 33, 'INTERSECTS' => 33, 'JSON_ARRAY' => 33, 'JSON_DEPTH' => 33,
|
||||
'JSON_MERGE' => 33, 'JSON_QUOTE' => 33, 'JSON_VALID' => 33, 'MBRTOUCHES' => 33,
|
||||
'NAME_CONST' => 33, 'PERIOD_ADD' => 33, 'STARTPOINT' => 33, 'STDDEV_POP' => 33,
|
||||
'ST_CROSSES' => 33, 'ST_GEOHASH' => 33, 'ST_ISEMPTY' => 33, 'ST_ISVALID' => 33,
|
||||
'ST_TOUCHES' => 33, 'TO_SECONDS' => 33, 'UNCOMPRESS' => 33, 'UUID_SHORT' => 33,
|
||||
'WEEKOFYEAR' => 33,
|
||||
'AES_DECRYPT' => 33, 'AES_ENCRYPT' => 33, 'BIN_TO_UUID' => 33, 'CHAR_LENGTH' => 33,
|
||||
'DATE_FORMAT' => 33, 'DES_DECRYPT' => 33, 'DES_ENCRYPT' => 33, 'FIND_IN_SET' => 33,
|
||||
'FROM_BASE64' => 33, 'GEOMFROMWKB' => 33, 'GTID_SUBSET' => 33, 'JSON_INSERT' => 33,
|
||||
'JSON_LENGTH' => 33, 'JSON_OBJECT' => 33, 'JSON_PRETTY' => 33, 'JSON_REMOVE' => 33,
|
||||
'JSON_SEARCH' => 33, 'LINEFROMWKB' => 33, 'MBRCONTAINS' => 33, 'MBRDISJOINT' => 33,
|
||||
'MBROVERLAPS' => 33, 'MICROSECOND' => 33, 'PERIOD_DIFF' => 33, 'POLYFROMWKB' => 33,
|
||||
'SEC_TO_TIME' => 33, 'STDDEV_SAMP' => 33, 'STR_TO_DATE' => 33, 'ST_ASBINARY' => 33,
|
||||
'ST_CENTROID' => 33, 'ST_CONTAINS' => 33, 'ST_DISJOINT' => 33, 'ST_DISTANCE' => 33,
|
||||
'ST_ENDPOINT' => 33, 'ST_ENVELOPE' => 33, 'ST_ISCLOSED' => 33, 'ST_ISSIMPLE' => 33,
|
||||
'ST_OVERLAPS' => 33, 'ST_SIMPLIFY' => 33, 'ST_VALIDATE' => 33, 'SYSTEM_USER' => 33,
|
||||
'TIME_FORMAT' => 33, 'TIME_TO_SEC' => 33, 'UUID_TO_BIN' => 33,
|
||||
'COERCIBILITY' => 33, 'EXTERIORRING' => 33, 'EXTRACTVALUE' => 33, 'GEOMETRYTYPE' => 33,
|
||||
'GEOMFROMTEXT' => 33, 'GROUP_CONCAT' => 33, 'IS_FREE_LOCK' => 33, 'IS_USED_LOCK' => 33,
|
||||
'JSON_EXTRACT' => 33, 'JSON_REPLACE' => 33, 'JSON_UNQUOTE' => 33, 'LINEFROMTEXT' => 33,
|
||||
'MBRCOVEREDBY' => 33, 'MLINEFROMWKB' => 33, 'MPOLYFROMWKB' => 33, 'OCTET_LENGTH' => 33,
|
||||
'OLD_PASSWORD' => 33, 'POINTFROMWKB' => 33, 'POLYFROMTEXT' => 33, 'RANDOM_BYTES' => 33,
|
||||
'RELEASE_LOCK' => 33, 'SESSION_USER' => 33, 'ST_ASGEOJSON' => 33, 'ST_DIMENSION' => 33,
|
||||
'ST_GEOMETRYN' => 33, 'ST_NUMPOINTS' => 33, 'TIMESTAMPADD' => 33,
|
||||
'CONNECTION_ID' => 33, 'FROM_UNIXTIME' => 33, 'GTID_SUBTRACT' => 33, 'INTERIORRINGN' => 33,
|
||||
'JSON_CONTAINS' => 33, 'MBRINTERSECTS' => 33, 'MLINEFROMTEXT' => 33, 'MPOINTFROMWKB' => 33,
|
||||
'MPOLYFROMTEXT' => 33, 'NUMGEOMETRIES' => 33, 'POINTFROMTEXT' => 33, 'ST_CONVEXHULL' => 33,
|
||||
'ST_DIFFERENCE' => 33, 'ST_INTERSECTS' => 33, 'ST_STARTPOINT' => 33, 'TIMESTAMPDIFF' => 33,
|
||||
'WEIGHT_STRING' => 33,
|
||||
'IS_IPV4_COMPAT' => 33, 'IS_IPV4_MAPPED' => 33, 'LAST_INSERT_ID' => 33, 'MPOINTFROMTEXT' => 33,
|
||||
'POLYGONFROMWKB' => 33, 'ST_GEOMFROMWKB' => 33, 'ST_LINEFROMWKB' => 33, 'ST_POLYFROMWKB' => 33,
|
||||
'UNIX_TIMESTAMP' => 33,
|
||||
'GEOMCOLLFROMWKB' => 33, 'MASTER_POS_WAIT' => 33, 'POLYGONFROMTEXT' => 33, 'ST_EXTERIORRING' => 33,
|
||||
'ST_GEOMETRYTYPE' => 33, 'ST_GEOMFROMTEXT' => 33, 'ST_INTERSECTION' => 33, 'ST_LINEFROMTEXT' => 33,
|
||||
'ST_MAKEENVELOPE' => 33, 'ST_MLINEFROMWKB' => 33, 'ST_MPOLYFROMWKB' => 33, 'ST_POINTFROMWKB' => 33,
|
||||
'ST_POLYFROMTEXT' => 33, 'SUBSTRING_INDEX' => 33,
|
||||
'CHARACTER_LENGTH' => 33, 'GEOMCOLLFROMTEXT' => 33, 'GEOMETRYFROMTEXT' => 33,
|
||||
'JSON_MERGE_PATCH' => 33, 'NUMINTERIORRINGS' => 33, 'ST_INTERIORRINGN' => 33,
|
||||
'ST_MLINEFROMTEXT' => 33, 'ST_MPOINTFROMWKB' => 33, 'ST_MPOLYFROMTEXT' => 33,
|
||||
'ST_NUMGEOMETRIES' => 33, 'ST_POINTFROMTEXT' => 33, 'ST_SYMDIFFERENCE' => 33,
|
||||
'JSON_ARRAY_APPEND' => 33, 'JSON_ARRAY_INSERT' => 33, 'JSON_STORAGE_FREE' => 33,
|
||||
'JSON_STORAGE_SIZE' => 33, 'LINESTRINGFROMWKB' => 33, 'MULTIPOINTFROMWKB' => 33,
|
||||
'RELEASE_ALL_LOCKS' => 33, 'ST_LATFROMGEOHASH' => 33, 'ST_MPOINTFROMTEXT' => 33,
|
||||
'ST_POLYGONFROMWKB' => 33,
|
||||
'JSON_CONTAINS_PATH' => 33, 'MULTIPOINTFROMTEXT' => 33, 'ST_BUFFER_STRATEGY' => 33,
|
||||
'ST_DISTANCE_SPHERE' => 33, 'ST_GEOMCOLLFROMTXT' => 33, 'ST_GEOMCOLLFROMWKB' => 33,
|
||||
'ST_GEOMFROMGEOJSON' => 33, 'ST_LONGFROMGEOHASH' => 33, 'ST_POLYGONFROMTEXT' => 33,
|
||||
'JSON_MERGE_PRESERVE' => 33, 'MULTIPOLYGONFROMWKB' => 33, 'ST_GEOMCOLLFROMTEXT' => 33,
|
||||
'ST_GEOMETRYFROMTEXT' => 33, 'ST_NUMINTERIORRINGS' => 33, 'ST_POINTFROMGEOHASH' => 33,
|
||||
'UNCOMPRESSED_LENGTH' => 33,
|
||||
'MULTIPOLYGONFROMTEXT' => 33, 'ST_LINESTRINGFROMWKB' => 33, 'ST_MULTIPOINTFROMWKB' => 33,
|
||||
'ST_MULTIPOINTFROMTEXT' => 33,
|
||||
'MULTILINESTRINGFROMWKB' => 33, 'ST_MULTIPOLYGONFROMWKB' => 33,
|
||||
'MULTILINESTRINGFROMTEXT' => 33, 'ST_MULTIPOLYGONFROMTEXT' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMWKB' => 33, 'ST_MULTILINESTRINGFROMWKB' => 33,
|
||||
'GEOMETRYCOLLECTIONFROMTEXT' => 33, 'ST_MULTILINESTRINGFROMTEXT' => 33, 'VALIDATE_PASSWORD_STRENGTH' => 33,
|
||||
'WAIT_FOR_EXECUTED_GTID_SET' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMWKB' => 33,
|
||||
'ST_GEOMETRYCOLLECTIONFROMTEXT' => 33,
|
||||
'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS' => 33,
|
||||
|
||||
'IF' => 35, 'IN' => 35,
|
||||
'MOD' => 35,
|
||||
'LEFT' => 35,
|
||||
'MATCH' => 35, 'RIGHT' => 35,
|
||||
'EXISTS' => 35, 'INSERT' => 35, 'REPEAT' => 35, 'SCHEMA' => 35, 'VALUES' => 35,
|
||||
'CONVERT' => 35, 'DEFAULT' => 35, 'REPLACE' => 35,
|
||||
'DATABASE' => 35, 'UTC_DATE' => 35, 'UTC_TIME' => 35,
|
||||
'LOCALTIME' => 35,
|
||||
'CURRENT_DATE' => 35, 'CURRENT_TIME' => 35, 'CURRENT_USER' => 35,
|
||||
'UTC_TIMESTAMP' => 35,
|
||||
'LOCALTIMESTAMP' => 35,
|
||||
'CURRENT_TIMESTAMP' => 35,
|
||||
|
||||
'NOT IN' => 39,
|
||||
|
||||
'DATE' => 41, 'TIME' => 41, 'YEAR' => 41,
|
||||
'POINT' => 41,
|
||||
'POLYGON' => 41,
|
||||
'TIMESTAMP' => 41,
|
||||
'LINESTRING' => 41, 'MULTIPOINT' => 41,
|
||||
'MULTIPOLYGON' => 41,
|
||||
'MULTILINESTRING' => 41,
|
||||
'GEOMETRYCOLLECTION' => 41,
|
||||
|
||||
'CHAR' => 43,
|
||||
'BINARY' => 43,
|
||||
'INTERVAL' => 43,
|
||||
];
|
||||
}
|
||||
53
pma/vendor/phpmyadmin/sql-parser/src/Core.php
vendored
Normal file
53
pma/vendor/phpmyadmin/sql-parser/src/Core.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Defines the core helper infrastructure of the library.
|
||||
*/
|
||||
class Core
|
||||
{
|
||||
/**
|
||||
* Whether errors should throw exceptions or just be stored.
|
||||
*
|
||||
* @see static::$errors
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $strict = false;
|
||||
|
||||
/**
|
||||
* List of errors that occurred during lexing.
|
||||
*
|
||||
* Usually, the lexing does not stop once an error occurred because that
|
||||
* error might be false positive or a partial result (even a bad one)
|
||||
* might be needed.
|
||||
*
|
||||
* @see Core::error()
|
||||
*
|
||||
* @var Exception[]
|
||||
*/
|
||||
public $errors = [];
|
||||
|
||||
/**
|
||||
* Creates a new error log.
|
||||
*
|
||||
* @param Exception $error the error exception
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception throws the exception, if strict mode is enabled.
|
||||
*/
|
||||
public function error($error)
|
||||
{
|
||||
if ($this->strict) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
$this->errors[] = $error;
|
||||
}
|
||||
}
|
||||
40
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/LexerException.php
vendored
Normal file
40
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/LexerException.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown by the lexer.
|
||||
*/
|
||||
class LexerException extends Exception
|
||||
{
|
||||
/**
|
||||
* The character that produced this error.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ch;
|
||||
|
||||
/**
|
||||
* The index of the character that produced this error.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $pos;
|
||||
|
||||
/**
|
||||
* @param string $msg the message of this exception
|
||||
* @param string $ch the character that produced this exception
|
||||
* @param int $pos the position of the character
|
||||
* @param int $code the code of this error
|
||||
*/
|
||||
public function __construct($msg = '', $ch = '', $pos = 0, $code = 0)
|
||||
{
|
||||
parent::__construct($msg, $code);
|
||||
$this->ch = $ch;
|
||||
$this->pos = $pos;
|
||||
}
|
||||
}
|
||||
31
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/LoaderException.php
vendored
Normal file
31
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/LoaderException.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown by the lexer.
|
||||
*/
|
||||
class LoaderException extends Exception
|
||||
{
|
||||
/**
|
||||
* The failed load name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @param string $msg the message of this exception
|
||||
* @param string $name the character that produced this exception
|
||||
* @param int $code the code of this error
|
||||
*/
|
||||
public function __construct($msg = '', $name = '', $code = 0)
|
||||
{
|
||||
parent::__construct($msg, $code);
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
32
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/ParserException.php
vendored
Normal file
32
pma/vendor/phpmyadmin/sql-parser/src/Exceptions/ParserException.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
|
||||
/**
|
||||
* Exception thrown by the parser.
|
||||
*/
|
||||
class ParserException extends Exception
|
||||
{
|
||||
/**
|
||||
* The token that produced this error.
|
||||
*
|
||||
* @var Token
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* @param string $msg the message of this exception
|
||||
* @param Token $token the token that produced this exception
|
||||
* @param int $code the code of this error
|
||||
*/
|
||||
public function __construct($msg = '', ?Token $token = null, $code = 0)
|
||||
{
|
||||
parent::__construct($msg, $code);
|
||||
$this->token = $token;
|
||||
}
|
||||
}
|
||||
1117
pma/vendor/phpmyadmin/sql-parser/src/Lexer.php
vendored
Normal file
1117
pma/vendor/phpmyadmin/sql-parser/src/Lexer.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
630
pma/vendor/phpmyadmin/sql-parser/src/Parser.php
vendored
Normal file
630
pma/vendor/phpmyadmin/sql-parser/src/Parser.php
vendored
Normal file
@@ -0,0 +1,630 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Exceptions\ParserException;
|
||||
use PhpMyAdmin\SqlParser\Statements\SelectStatement;
|
||||
use PhpMyAdmin\SqlParser\Statements\TransactionStatement;
|
||||
|
||||
use function is_string;
|
||||
use function strtoupper;
|
||||
|
||||
/**
|
||||
* Defines the parser of the library.
|
||||
*
|
||||
* This is one of the most important components, along with the lexer.
|
||||
*
|
||||
* Takes multiple tokens (contained in a Lexer instance) as input and builds a parse tree.
|
||||
*/
|
||||
class Parser extends Core
|
||||
{
|
||||
/**
|
||||
* Array of classes that are used in parsing the SQL statements.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static $STATEMENT_PARSERS = [
|
||||
// MySQL Utility Statements
|
||||
'DESCRIBE' => 'PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement',
|
||||
'DESC' => 'PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement',
|
||||
'EXPLAIN' => 'PhpMyAdmin\\SqlParser\\Statements\\ExplainStatement',
|
||||
'FLUSH' => '',
|
||||
'GRANT' => '',
|
||||
'HELP' => '',
|
||||
'SET PASSWORD' => '',
|
||||
'STATUS' => '',
|
||||
'USE' => '',
|
||||
|
||||
// Table Maintenance Statements
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/table-maintenance-sql.html
|
||||
'ANALYZE' => 'PhpMyAdmin\\SqlParser\\Statements\\AnalyzeStatement',
|
||||
'BACKUP' => 'PhpMyAdmin\\SqlParser\\Statements\\BackupStatement',
|
||||
'CHECK' => 'PhpMyAdmin\\SqlParser\\Statements\\CheckStatement',
|
||||
'CHECKSUM' => 'PhpMyAdmin\\SqlParser\\Statements\\ChecksumStatement',
|
||||
'OPTIMIZE' => 'PhpMyAdmin\\SqlParser\\Statements\\OptimizeStatement',
|
||||
'REPAIR' => 'PhpMyAdmin\\SqlParser\\Statements\\RepairStatement',
|
||||
'RESTORE' => 'PhpMyAdmin\\SqlParser\\Statements\\RestoreStatement',
|
||||
|
||||
// Database Administration Statements
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-server-administration.html
|
||||
'SET' => 'PhpMyAdmin\\SqlParser\\Statements\\SetStatement',
|
||||
'SHOW' => 'PhpMyAdmin\\SqlParser\\Statements\\ShowStatement',
|
||||
|
||||
// Data Definition Statements.
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-data-definition.html
|
||||
'ALTER' => 'PhpMyAdmin\\SqlParser\\Statements\\AlterStatement',
|
||||
'CREATE' => 'PhpMyAdmin\\SqlParser\\Statements\\CreateStatement',
|
||||
'DROP' => 'PhpMyAdmin\\SqlParser\\Statements\\DropStatement',
|
||||
'RENAME' => 'PhpMyAdmin\\SqlParser\\Statements\\RenameStatement',
|
||||
'TRUNCATE' => 'PhpMyAdmin\\SqlParser\\Statements\\TruncateStatement',
|
||||
|
||||
// Data Manipulation Statements.
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-data-manipulation.html
|
||||
'CALL' => 'PhpMyAdmin\\SqlParser\\Statements\\CallStatement',
|
||||
'DELETE' => 'PhpMyAdmin\\SqlParser\\Statements\\DeleteStatement',
|
||||
'DO' => '',
|
||||
'HANDLER' => '',
|
||||
'INSERT' => 'PhpMyAdmin\\SqlParser\\Statements\\InsertStatement',
|
||||
'LOAD DATA' => 'PhpMyAdmin\\SqlParser\\Statements\\LoadStatement',
|
||||
'REPLACE' => 'PhpMyAdmin\\SqlParser\\Statements\\ReplaceStatement',
|
||||
'SELECT' => 'PhpMyAdmin\\SqlParser\\Statements\\SelectStatement',
|
||||
'UPDATE' => 'PhpMyAdmin\\SqlParser\\Statements\\UpdateStatement',
|
||||
'WITH' => 'PhpMyAdmin\\SqlParser\\Statements\\WithStatement',
|
||||
|
||||
// Prepared Statements.
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-prepared-statements.html
|
||||
'DEALLOCATE' => '',
|
||||
'EXECUTE' => '',
|
||||
'PREPARE' => '',
|
||||
|
||||
// Transactional and Locking Statements
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/commit.html
|
||||
'BEGIN' => 'PhpMyAdmin\\SqlParser\\Statements\\TransactionStatement',
|
||||
'COMMIT' => 'PhpMyAdmin\\SqlParser\\Statements\\TransactionStatement',
|
||||
'ROLLBACK' => 'PhpMyAdmin\\SqlParser\\Statements\\TransactionStatement',
|
||||
'START TRANSACTION' => 'PhpMyAdmin\\SqlParser\\Statements\\TransactionStatement',
|
||||
|
||||
'PURGE' => 'PhpMyAdmin\\SqlParser\\Statements\\PurgeStatement',
|
||||
|
||||
// Lock statements
|
||||
// https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html
|
||||
'LOCK' => 'PhpMyAdmin\\SqlParser\\Statements\\LockStatement',
|
||||
'UNLOCK' => 'PhpMyAdmin\\SqlParser\\Statements\\LockStatement',
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of classes that are used in parsing SQL components.
|
||||
*
|
||||
* @var array<string, array<string, string|array<string, string>>>
|
||||
* @psalm-var array<string, array{class?: string, field?: non-empty-string, options?: array<string, string>}>
|
||||
*/
|
||||
public static $KEYWORD_PARSERS = [
|
||||
// This is not a proper keyword and was added here to help the
|
||||
// formatter.
|
||||
'PARTITION BY' => [],
|
||||
'SUBPARTITION BY' => [],
|
||||
|
||||
// This is not a proper keyword and was added here to help the
|
||||
// builder.
|
||||
'_OPTIONS' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OptionsArray',
|
||||
'field' => 'options',
|
||||
],
|
||||
'_END_OPTIONS' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OptionsArray',
|
||||
'field' => 'end_options',
|
||||
],
|
||||
|
||||
'INTERSECT' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
|
||||
'field' => 'union',
|
||||
],
|
||||
'EXCEPT' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
|
||||
'field' => 'union',
|
||||
],
|
||||
'UNION' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
|
||||
'field' => 'union',
|
||||
],
|
||||
'UNION ALL' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
|
||||
'field' => 'union',
|
||||
],
|
||||
'UNION DISTINCT' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\UnionKeyword',
|
||||
'field' => 'union',
|
||||
],
|
||||
|
||||
// Actual clause parsers.
|
||||
'ALTER' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
|
||||
'field' => 'table',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'ANALYZE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'BACKUP' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'CALL' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\FunctionCall',
|
||||
'field' => 'call',
|
||||
],
|
||||
'CHECK' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'CHECKSUM' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'CROSS JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'DROP' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'fields',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'FORCE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
|
||||
'field' => 'index_hints',
|
||||
],
|
||||
'FROM' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'from',
|
||||
'options' => ['field' => 'table'],
|
||||
],
|
||||
'GROUP BY' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\GroupKeyword',
|
||||
'field' => 'group',
|
||||
],
|
||||
'HAVING' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Condition',
|
||||
'field' => 'having',
|
||||
],
|
||||
'IGNORE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
|
||||
'field' => 'index_hints',
|
||||
],
|
||||
'INTO' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IntoKeyword',
|
||||
'field' => 'into',
|
||||
],
|
||||
'JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'LEFT JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'LEFT OUTER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'ON' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
|
||||
'field' => 'table',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'RIGHT JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'RIGHT OUTER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'INNER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'FULL JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'FULL OUTER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'NATURAL JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'NATURAL LEFT JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'NATURAL RIGHT JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'NATURAL LEFT OUTER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'NATURAL RIGHT OUTER JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'STRAIGHT_JOIN' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\JoinKeyword',
|
||||
'field' => 'join',
|
||||
],
|
||||
'LIMIT' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Limit',
|
||||
'field' => 'limit',
|
||||
],
|
||||
'OPTIMIZE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'ORDER BY' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\OrderKeyword',
|
||||
'field' => 'order',
|
||||
],
|
||||
'PARTITION' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ArrayObj',
|
||||
'field' => 'partition',
|
||||
],
|
||||
'PROCEDURE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\FunctionCall',
|
||||
'field' => 'procedure',
|
||||
],
|
||||
'RENAME' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\RenameOperation',
|
||||
'field' => 'renames',
|
||||
],
|
||||
'REPAIR' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'RESTORE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'SET' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\SetOperation',
|
||||
'field' => 'set',
|
||||
],
|
||||
'SELECT' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'expr',
|
||||
],
|
||||
'TRUNCATE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Expression',
|
||||
'field' => 'table',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'UPDATE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\ExpressionArray',
|
||||
'field' => 'tables',
|
||||
'options' => ['parseField' => 'table'],
|
||||
],
|
||||
'USE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\IndexHint',
|
||||
'field' => 'index_hints',
|
||||
],
|
||||
'VALUE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Array2d',
|
||||
'field' => 'values',
|
||||
],
|
||||
'VALUES' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Array2d',
|
||||
'field' => 'values',
|
||||
],
|
||||
'WHERE' => [
|
||||
'class' => 'PhpMyAdmin\\SqlParser\\Components\\Condition',
|
||||
'field' => 'where',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The list of tokens that are parsed.
|
||||
*
|
||||
* @var TokensList|null
|
||||
*/
|
||||
public $list;
|
||||
|
||||
/**
|
||||
* List of statements parsed.
|
||||
*
|
||||
* @var Statement[]
|
||||
*/
|
||||
public $statements = [];
|
||||
|
||||
/**
|
||||
* The number of opened brackets.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $brackets = 0;
|
||||
|
||||
/**
|
||||
* @param string|UtfString|TokensList|null $list the list of tokens to be parsed
|
||||
* @param bool $strict whether strict mode should be enabled or not
|
||||
*/
|
||||
public function __construct($list = null, $strict = false)
|
||||
{
|
||||
if (is_string($list) || ($list instanceof UtfString)) {
|
||||
$lexer = new Lexer($list, $strict);
|
||||
$this->list = $lexer->list;
|
||||
} elseif ($list instanceof TokensList) {
|
||||
$this->list = $list;
|
||||
}
|
||||
|
||||
$this->strict = $strict;
|
||||
|
||||
if ($list === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->parse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the parse trees.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ParserException
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
/**
|
||||
* Last transaction.
|
||||
*
|
||||
* @var TransactionStatement
|
||||
*/
|
||||
$lastTransaction = null;
|
||||
|
||||
/**
|
||||
* Last parsed statement.
|
||||
*
|
||||
* @var Statement
|
||||
*/
|
||||
$lastStatement = null;
|
||||
|
||||
/**
|
||||
* Union's type or false for no union.
|
||||
*
|
||||
* @var bool|string
|
||||
*/
|
||||
$unionType = false;
|
||||
|
||||
/**
|
||||
* The index of the last token from the last statement.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$prevLastIdx = -1;
|
||||
|
||||
/**
|
||||
* The list of tokens.
|
||||
*/
|
||||
$list = &$this->list;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// `DELIMITER` is not an actual statement and it requires
|
||||
// special handling.
|
||||
if (($token->type === Token::TYPE_NONE) && (strtoupper($token->token) === 'DELIMITER')) {
|
||||
// Skipping to the end of this statement.
|
||||
$list->getNextOfType(Token::TYPE_DELIMITER);
|
||||
$prevLastIdx = $list->idx;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Counting the brackets around statements.
|
||||
if ($token->value === '(') {
|
||||
++$this->brackets;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Statements can start with keywords only.
|
||||
// Comments, whitespaces, etc. are ignored.
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
if (
|
||||
($token->type !== Token::TYPE_COMMENT)
|
||||
&& ($token->type !== Token::TYPE_WHITESPACE)
|
||||
&& ($token->type !== Token::TYPE_OPERATOR) // `(` and `)`
|
||||
&& ($token->type !== Token::TYPE_DELIMITER)
|
||||
) {
|
||||
$this->error('Unexpected beginning of statement.', $token);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
($token->keyword === 'UNION') ||
|
||||
($token->keyword === 'UNION ALL') ||
|
||||
($token->keyword === 'UNION DISTINCT') ||
|
||||
($token->keyword === 'EXCEPT') ||
|
||||
($token->keyword === 'INTERSECT')
|
||||
) {
|
||||
$unionType = $token->keyword;
|
||||
continue;
|
||||
}
|
||||
|
||||
$lastIdx = $list->idx;
|
||||
$statementName = null;
|
||||
|
||||
if ($token->keyword === 'ANALYZE') {
|
||||
++$list->idx; // Skip ANALYZE
|
||||
|
||||
$first = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
$second = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
|
||||
// ANALYZE keyword can be an indication of two cases:
|
||||
// 1 - ANALYZE TABLE statements, in both MariaDB and MySQL
|
||||
// 2 - Explain statement, in case of MariaDB https://mariadb.com/kb/en/explain-analyze/
|
||||
// We need to point case 2 to use the EXPLAIN Parser.
|
||||
$statementName = 'EXPLAIN';
|
||||
if (($first && $first->keyword === 'TABLE') || ($second && $second->keyword === 'TABLE')) {
|
||||
$statementName = 'ANALYZE';
|
||||
}
|
||||
|
||||
$list->idx = $lastIdx;
|
||||
} else {
|
||||
// Checking if it is a known statement that can be parsed.
|
||||
if (empty(static::$STATEMENT_PARSERS[$token->keyword])) {
|
||||
if (! isset(static::$STATEMENT_PARSERS[$token->keyword])) {
|
||||
// A statement is considered recognized if the parser
|
||||
// is aware that it is a statement, but it does not have
|
||||
// a parser for it yet.
|
||||
$this->error('Unrecognized statement type.', $token);
|
||||
}
|
||||
|
||||
// Skipping to the end of this statement.
|
||||
$list->getNextOfType(Token::TYPE_DELIMITER);
|
||||
$prevLastIdx = $list->idx;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the class that is used for parsing.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$class = static::$STATEMENT_PARSERS[$statementName ?? $token->keyword];
|
||||
|
||||
/**
|
||||
* Processed statement.
|
||||
*
|
||||
* @var Statement
|
||||
*/
|
||||
$statement = new $class($this, $this->list);
|
||||
|
||||
// The first token that is a part of this token is the next token
|
||||
// unprocessed by the previous statement.
|
||||
// There might be brackets around statements and this shouldn't
|
||||
// affect the parser
|
||||
$statement->first = $prevLastIdx + 1;
|
||||
|
||||
// Storing the index of the last token parsed and updating the old
|
||||
// index.
|
||||
$statement->last = $list->idx;
|
||||
$prevLastIdx = $list->idx;
|
||||
|
||||
// Handles unions.
|
||||
if (
|
||||
! empty($unionType)
|
||||
&& ($lastStatement instanceof SelectStatement)
|
||||
&& ($statement instanceof SelectStatement)
|
||||
) {
|
||||
/*
|
||||
* This SELECT statement.
|
||||
*
|
||||
* @var SelectStatement $statement
|
||||
*/
|
||||
|
||||
/*
|
||||
* Last SELECT statement.
|
||||
*
|
||||
* @var SelectStatement $lastStatement
|
||||
*/
|
||||
$lastStatement->union[] = [
|
||||
$unionType,
|
||||
$statement,
|
||||
];
|
||||
|
||||
// if there are no no delimiting brackets, the `ORDER` and
|
||||
// `LIMIT` keywords actually belong to the first statement.
|
||||
$lastStatement->order = $statement->order;
|
||||
$lastStatement->limit = $statement->limit;
|
||||
$statement->order = [];
|
||||
$statement->limit = null;
|
||||
|
||||
// The statement actually ends where the last statement in
|
||||
// union ends.
|
||||
$lastStatement->last = $statement->last;
|
||||
|
||||
$unionType = false;
|
||||
|
||||
// Validate clause order
|
||||
$statement->validateClauseOrder($this, $list);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handles transactions.
|
||||
if ($statement instanceof TransactionStatement) {
|
||||
/*
|
||||
* @var TransactionStatement
|
||||
*/
|
||||
if ($statement->type === TransactionStatement::TYPE_BEGIN) {
|
||||
$lastTransaction = $statement;
|
||||
$this->statements[] = $statement;
|
||||
} elseif ($statement->type === TransactionStatement::TYPE_END) {
|
||||
if ($lastTransaction === null) {
|
||||
// Even though an error occurred, the query is being
|
||||
// saved.
|
||||
$this->statements[] = $statement;
|
||||
$this->error('No transaction was previously started.', $token);
|
||||
} else {
|
||||
$lastTransaction->end = $statement;
|
||||
}
|
||||
|
||||
$lastTransaction = null;
|
||||
}
|
||||
|
||||
// Validate clause order
|
||||
$statement->validateClauseOrder($this, $list);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate clause order
|
||||
$statement->validateClauseOrder($this, $list);
|
||||
|
||||
// Finally, storing the statement.
|
||||
if ($lastTransaction !== null) {
|
||||
$lastTransaction->statements[] = $statement;
|
||||
} else {
|
||||
$this->statements[] = $statement;
|
||||
}
|
||||
|
||||
$lastStatement = $statement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new error log.
|
||||
*
|
||||
* @param string $msg the error message
|
||||
* @param Token $token the token that produced the error
|
||||
* @param int $code the code of the error
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ParserException throws the exception, if strict mode is enabled.
|
||||
*/
|
||||
public function error($msg, ?Token $token = null, $code = 0)
|
||||
{
|
||||
$error = new ParserException(
|
||||
Translator::gettext($msg),
|
||||
$token,
|
||||
$code
|
||||
);
|
||||
parent::error($error);
|
||||
}
|
||||
}
|
||||
558
pma/vendor/phpmyadmin/sql-parser/src/Statement.php
vendored
Normal file
558
pma/vendor/phpmyadmin/sql-parser/src/Statement.php
vendored
Normal file
@@ -0,0 +1,558 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\FunctionCall;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use Stringable;
|
||||
|
||||
use function array_flip;
|
||||
use function array_keys;
|
||||
use function count;
|
||||
use function in_array;
|
||||
use function stripos;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* The result of the parser is an array of statements are extensions of the class defined here.
|
||||
*
|
||||
* A statement represents the result of parsing the lexemes.
|
||||
*
|
||||
* Abstract statement definition.
|
||||
*/
|
||||
#[\AllowDynamicProperties]
|
||||
abstract class Statement implements Stringable
|
||||
{
|
||||
/**
|
||||
* Options for this statement.
|
||||
*
|
||||
* The option would be the key and the value can be an integer or an array.
|
||||
*
|
||||
* The integer represents only the index used.
|
||||
*
|
||||
* The array may have two keys: `0` is used to represent the index used and
|
||||
* `1` is the type of the option (which may be 'var' or 'var='). Both
|
||||
* options mean they expect a value after the option (e.g. `A = B` or `A B`,
|
||||
* in which case `A` is the key and `B` is the value). The only difference
|
||||
* is in the building process. `var` options are built as `A B` and `var=`
|
||||
* options are built as `A = B`
|
||||
*
|
||||
* Two options that can be used together must have different values for
|
||||
* indexes, else, when they will be used together, an error will occur.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [];
|
||||
|
||||
/**
|
||||
* The clauses of this statement, in order.
|
||||
*
|
||||
* The value attributed to each clause is used by the builder and it may
|
||||
* have one of the following values:
|
||||
*
|
||||
* - 1 = 01 - add the clause only
|
||||
* - 2 = 10 - add the keyword
|
||||
* - 3 = 11 - add both the keyword and the clause
|
||||
*
|
||||
* @var array<string, array<int, int|string>>
|
||||
* @psalm-var array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public static $CLAUSES = [];
|
||||
|
||||
/**
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $END_OPTIONS = [];
|
||||
|
||||
/**
|
||||
* The options of this query.
|
||||
*
|
||||
* @see static::$OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* The index of the first token used in this statement.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $first;
|
||||
|
||||
/**
|
||||
* The index of the last token used in this statement.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $last;
|
||||
|
||||
/**
|
||||
* @param Parser|null $parser the instance that requests parsing
|
||||
* @param TokensList|null $list the list of tokens to be parsed
|
||||
*/
|
||||
public function __construct(?Parser $parser = null, ?TokensList $list = null)
|
||||
{
|
||||
if (($parser === null) || ($list === null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->parse($parser, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the string representation of this statement.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
/**
|
||||
* Query to be returned.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$query = '';
|
||||
|
||||
/**
|
||||
* Clauses which were built already.
|
||||
*
|
||||
* It is required to keep track of built clauses because some fields,
|
||||
* for example `join` is used by multiple clauses (`JOIN`, `LEFT JOIN`,
|
||||
* `LEFT OUTER JOIN`, etc.). The same happens for `VALUE` and `VALUES`.
|
||||
*
|
||||
* A clause is considered built just after fields' value
|
||||
* (`$this->field`) was used in building.
|
||||
*/
|
||||
$built = [];
|
||||
|
||||
/**
|
||||
* Statement's clauses.
|
||||
*/
|
||||
$clauses = $this->getClauses();
|
||||
|
||||
foreach ($clauses as $clause) {
|
||||
/**
|
||||
* The name of the clause.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$name = $clause[0];
|
||||
|
||||
/**
|
||||
* The type of the clause.
|
||||
*
|
||||
* @see self::$CLAUSES
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$type = $clause[1];
|
||||
|
||||
/**
|
||||
* The builder (parser) of this clause.
|
||||
*
|
||||
* @var Component
|
||||
*/
|
||||
$class = Parser::$KEYWORD_PARSERS[$name]['class'];
|
||||
|
||||
/**
|
||||
* The name of the field that is used as source for the builder.
|
||||
* Same field is used to store the result of parsing.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$field = Parser::$KEYWORD_PARSERS[$name]['field'];
|
||||
|
||||
// The field is empty, there is nothing to be built.
|
||||
if (empty($this->$field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Checking if this field was already built.
|
||||
if ($type & 1) {
|
||||
if (! empty($built[$field])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$built[$field] = true;
|
||||
}
|
||||
|
||||
// Checking if the name of the clause should be added.
|
||||
if ($type & 2) {
|
||||
$query = trim($query) . ' ' . $name;
|
||||
}
|
||||
|
||||
// Checking if the result of the builder should be added.
|
||||
if (! ($type & 1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = trim($query) . ' ' . $class::build($this->$field);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the statements defined by the tokens list.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Exceptions\ParserException
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
/**
|
||||
* Array containing all list of clauses parsed.
|
||||
* This is used to check for duplicates.
|
||||
*/
|
||||
$parsedClauses = [];
|
||||
|
||||
// This may be corrected by the parser.
|
||||
$this->first = $list->idx;
|
||||
|
||||
/**
|
||||
* Whether options were parsed or not.
|
||||
* For statements that do not have any options this is set to `true` by
|
||||
* default.
|
||||
*/
|
||||
$parsedOptions = empty(static::$OPTIONS);
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Checking if this closing bracket is the pair for a bracket
|
||||
// outside the statement.
|
||||
if (($token->value === ')') && ($parser->brackets > 0)) {
|
||||
--$parser->brackets;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only keywords are relevant here. Other parts of the query are
|
||||
// processed in the functions below.
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
if (($token->type !== Token::TYPE_COMMENT) && ($token->type !== Token::TYPE_WHITESPACE)) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Unions are parsed by the parser because they represent more than
|
||||
// one statement.
|
||||
if (
|
||||
($token->keyword === 'UNION') ||
|
||||
($token->keyword === 'UNION ALL') ||
|
||||
($token->keyword === 'UNION DISTINCT') ||
|
||||
($token->keyword === 'EXCEPT') ||
|
||||
($token->keyword === 'INTERSECT')
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
$lastIdx = $list->idx;
|
||||
|
||||
// ON DUPLICATE KEY UPDATE ...
|
||||
// has to be parsed in parent statement (INSERT or REPLACE)
|
||||
// so look for it and break
|
||||
if ($this instanceof Statements\SelectStatement && $token->value === 'ON') {
|
||||
++$list->idx; // Skip ON
|
||||
|
||||
// look for ON DUPLICATE KEY UPDATE
|
||||
$first = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
$second = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
$third = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
|
||||
if (
|
||||
$first && $second && $third
|
||||
&& $first->value === 'DUPLICATE'
|
||||
&& $second->value === 'KEY'
|
||||
&& $third->value === 'UPDATE'
|
||||
) {
|
||||
$list->idx = $lastIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$list->idx = $lastIdx;
|
||||
|
||||
/**
|
||||
* The name of the class that is used for parsing.
|
||||
*
|
||||
* @var Component
|
||||
*/
|
||||
$class = null;
|
||||
|
||||
/**
|
||||
* The name of the field where the result of the parsing is stored.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$field = null;
|
||||
|
||||
/**
|
||||
* Parser's options.
|
||||
*/
|
||||
$options = [];
|
||||
|
||||
// Looking for duplicated clauses.
|
||||
if (
|
||||
! empty(Parser::$KEYWORD_PARSERS[$token->value])
|
||||
|| ! empty(Parser::$STATEMENT_PARSERS[$token->value])
|
||||
) {
|
||||
if (! empty($parsedClauses[$token->value])) {
|
||||
$parser->error('This type of clause was previously parsed.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$parsedClauses[$token->value] = true;
|
||||
}
|
||||
|
||||
// Checking if this is the beginning of a clause.
|
||||
// Fix Issue #221: As `truncate` is not a keyword
|
||||
// but it might be the beginning of a statement of truncate,
|
||||
// so let the value use the keyword field for truncate type.
|
||||
$tokenValue = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value;
|
||||
if (! empty(Parser::$KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) {
|
||||
$class = Parser::$KEYWORD_PARSERS[$tokenValue]['class'];
|
||||
$field = Parser::$KEYWORD_PARSERS[$tokenValue]['field'];
|
||||
if (! empty(Parser::$KEYWORD_PARSERS[$tokenValue]['options'])) {
|
||||
$options = Parser::$KEYWORD_PARSERS[$tokenValue]['options'];
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if this is the beginning of the statement.
|
||||
if (! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) {
|
||||
if (
|
||||
! empty(static::$CLAUSES) // Undefined for some statements.
|
||||
&& empty(static::$CLAUSES[$token->value])
|
||||
) {
|
||||
// Some keywords (e.g. `SET`) may be the beginning of a
|
||||
// statement and a clause.
|
||||
// If such keyword was found and it cannot be a clause of
|
||||
// this statement it means it is a new statement, but no
|
||||
// delimiter was found between them.
|
||||
$parser->error(
|
||||
'A new statement was found, but no delimiter between it and the previous one.',
|
||||
$token
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $parsedOptions) {
|
||||
if (empty(static::$OPTIONS[$token->value])) {
|
||||
// Skipping keyword because if it is not a option.
|
||||
++$list->idx;
|
||||
}
|
||||
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
$parsedOptions = true;
|
||||
}
|
||||
} elseif ($class === null) {
|
||||
if (
|
||||
$this instanceof Statements\SelectStatement
|
||||
&& ($token->value === 'FOR UPDATE'
|
||||
|| $token->value === 'LOCK IN SHARE MODE')
|
||||
) {
|
||||
// Handle special end options in Select statement
|
||||
// See Statements\SelectStatement::$END_OPTIONS
|
||||
$this->end_options = OptionsArray::parse($parser, $list, static::$END_OPTIONS);
|
||||
} elseif (
|
||||
$this instanceof Statements\SetStatement
|
||||
&& ($token->value === 'COLLATE'
|
||||
|| $token->value === 'DEFAULT')
|
||||
) {
|
||||
// Handle special end options in SET statement
|
||||
// See Statements\SetStatement::$END_OPTIONS
|
||||
$this->end_options = OptionsArray::parse($parser, $list, static::$END_OPTIONS);
|
||||
} else {
|
||||
// There is no parser for this keyword and isn't the beginning
|
||||
// of a statement (so no options) either.
|
||||
$parser->error('Unrecognized keyword.', $token);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->before($parser, $list, $token);
|
||||
|
||||
// Parsing this keyword.
|
||||
if ($class !== null) {
|
||||
// We can't parse keyword at the end of statement
|
||||
if ($list->idx >= $list->count) {
|
||||
$parser->error('Keyword at end of statement.', $token);
|
||||
continue;
|
||||
}
|
||||
|
||||
++$list->idx; // Skipping keyword or last option.
|
||||
$this->$field = $class::parse($parser, $list, $options);
|
||||
}
|
||||
|
||||
$this->after($parser, $list, $token);
|
||||
|
||||
// #223 Here may make a patch, if last is delimiter, back one
|
||||
if ($class !== FunctionCall::class || $list->offsetGet($list->idx)->type !== Token::TYPE_DELIMITER) {
|
||||
continue;
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
}
|
||||
|
||||
// This may be corrected by the parser.
|
||||
$this->last = --$list->idx; // Go back to last used token.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called before the token is processed.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
* @param Token $token the token that is being parsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function before(Parser $parser, TokensList $list, Token $token)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called after the token was processed.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
* @param Token $token the token that is being parsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function after(Parser $parser, TokensList $list, Token $token)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the clauses of this statement.
|
||||
*
|
||||
* @return array<string, array<int, int|string>>
|
||||
* @psalm-return array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public function getClauses()
|
||||
{
|
||||
return static::$CLAUSES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the string representation of this statement.
|
||||
*
|
||||
* @see static::build
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the order of the clauses in parsed statement
|
||||
* Ideally this should be called after successfully
|
||||
* completing the parsing of each statement.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws Exceptions\ParserException
|
||||
*/
|
||||
public function validateClauseOrder($parser, $list)
|
||||
{
|
||||
$clauses = array_flip(array_keys($this->getClauses()));
|
||||
|
||||
if (empty($clauses) || count($clauses) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$minIdx = -1;
|
||||
|
||||
/**
|
||||
* For tracking JOIN clauses in a query
|
||||
* = 0 - JOIN not found till now
|
||||
* > 0 - Index of first JOIN clause in the statement.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$minJoin = 0;
|
||||
|
||||
/**
|
||||
* For tracking JOIN clauses in a query
|
||||
* = 0 - JOIN not found till now
|
||||
* > 0 - Index of last JOIN clause
|
||||
* (which appears together with other JOINs)
|
||||
* in the statement.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$maxJoin = 0;
|
||||
|
||||
$error = 0;
|
||||
$lastIdx = 0;
|
||||
foreach ($clauses as $clauseType => $index) {
|
||||
$clauseStartIdx = Utils\Query::getClauseStartOffset($this, $list, $clauseType);
|
||||
|
||||
if (
|
||||
$clauseStartIdx !== -1
|
||||
&& $this instanceof Statements\SelectStatement
|
||||
&& ($clauseType === 'FORCE'
|
||||
|| $clauseType === 'IGNORE'
|
||||
|| $clauseType === 'USE')
|
||||
) {
|
||||
// TODO: ordering of clauses in a SELECT statement with
|
||||
// Index hints is not supported
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle ordering of Multiple Joins in a query
|
||||
if ($clauseStartIdx !== -1) {
|
||||
if ($minJoin === 0 && stripos($clauseType, 'JOIN')) {
|
||||
// First JOIN clause is detected
|
||||
$minJoin = $maxJoin = $clauseStartIdx;
|
||||
} elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) {
|
||||
// After a previous JOIN clause, a non-JOIN clause has been detected
|
||||
$maxJoin = $lastIdx;
|
||||
} elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) {
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($clauseStartIdx !== -1 && $clauseStartIdx < $minIdx) {
|
||||
if ($minJoin === 0 || $error === 1) {
|
||||
$token = $list->tokens[$clauseStartIdx];
|
||||
$parser->error('Unexpected ordering of clauses.', $token);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$minIdx = $clauseStartIdx;
|
||||
} elseif ($clauseStartIdx !== -1) {
|
||||
$minIdx = $clauseStartIdx;
|
||||
}
|
||||
|
||||
$lastIdx = $clauseStartIdx !== -1 ? $clauseStartIdx : $lastIdx;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
146
pma/vendor/phpmyadmin/sql-parser/src/Statements/AlterStatement.php
vendored
Normal file
146
pma/vendor/phpmyadmin/sql-parser/src/Statements/AlterStatement.php
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\AlterOperation;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* `ALTER` statement.
|
||||
*/
|
||||
class AlterStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Table affected.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* Column affected by this statement.
|
||||
*
|
||||
* @var AlterOperation[]|null
|
||||
*/
|
||||
public $altered = [];
|
||||
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'ONLINE' => 1,
|
||||
'OFFLINE' => 1,
|
||||
'IGNORE' => 2,
|
||||
|
||||
'DATABASE' => 3,
|
||||
'EVENT' => 3,
|
||||
'FUNCTION' => 3,
|
||||
'PROCEDURE' => 3,
|
||||
'SERVER' => 3,
|
||||
'TABLE' => 3,
|
||||
'TABLESPACE' => 3,
|
||||
'USER' => 3,
|
||||
'VIEW' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `ALTER`.
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
// Parsing affected table.
|
||||
$this->table = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => 'table',
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
++$list->idx; // Skipping field.
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -----------------[ alter operation ]-----------------> 1
|
||||
*
|
||||
* 1 -------------------------[ , ]-----------------------> 0
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
$options = [];
|
||||
if ($this->options->has('DATABASE')) {
|
||||
$options = AlterOperation::$DB_OPTIONS;
|
||||
} elseif ($this->options->has('TABLE')) {
|
||||
$options = AlterOperation::$TABLE_OPTIONS;
|
||||
} elseif ($this->options->has('VIEW')) {
|
||||
$options = AlterOperation::$VIEW_OPTIONS;
|
||||
} elseif ($this->options->has('USER')) {
|
||||
$options = AlterOperation::$USER_OPTIONS;
|
||||
} elseif ($this->options->has('EVENT')) {
|
||||
$options = AlterOperation::$EVENT_OPTIONS;
|
||||
}
|
||||
|
||||
$this->altered[] = AlterOperation::parse($parser, $list, $options);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
|
||||
$state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$tmp = [];
|
||||
foreach ($this->altered as $altered) {
|
||||
$tmp[] = $altered::build($altered);
|
||||
}
|
||||
|
||||
return 'ALTER ' . OptionsArray::build($this->options)
|
||||
. ' ' . Expression::build($this->table)
|
||||
. ' ' . implode(', ', $tmp);
|
||||
}
|
||||
}
|
||||
37
pma/vendor/phpmyadmin/sql-parser/src/Statements/AnalyzeStatement.php
vendored
Normal file
37
pma/vendor/phpmyadmin/sql-parser/src/Statements/AnalyzeStatement.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
/**
|
||||
* `ANALYZE` statement.
|
||||
*
|
||||
* ANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
|
||||
* tbl_name [, tbl_name] ...
|
||||
*/
|
||||
class AnalyzeStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'NO_WRITE_TO_BINLOG' => 2,
|
||||
'LOCAL' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* Analyzed tables.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $tables;
|
||||
}
|
||||
31
pma/vendor/phpmyadmin/sql-parser/src/Statements/BackupStatement.php
vendored
Normal file
31
pma/vendor/phpmyadmin/sql-parser/src/Statements/BackupStatement.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
/**
|
||||
* `BACKUP` statement.
|
||||
*
|
||||
* BACKUP TABLE tbl_name [, tbl_name] ... TO '/path/to/backup/directory'
|
||||
*/
|
||||
class BackupStatement extends MaintenanceStatement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'NO_WRITE_TO_BINLOG' => 2,
|
||||
'LOCAL' => 3,
|
||||
|
||||
'TO' => [
|
||||
4,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
}
|
||||
40
pma/vendor/phpmyadmin/sql-parser/src/Statements/CallStatement.php
vendored
Normal file
40
pma/vendor/phpmyadmin/sql-parser/src/Statements/CallStatement.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\FunctionCall;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* `CALL` statement.
|
||||
*
|
||||
* CALL sp_name([parameter[,...]])
|
||||
*
|
||||
* or
|
||||
*
|
||||
* CALL sp_name[()]
|
||||
*/
|
||||
class CallStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* The name of the function and its parameters.
|
||||
*
|
||||
* @var FunctionCall|null
|
||||
*/
|
||||
public $call;
|
||||
|
||||
/**
|
||||
* Build statement for CALL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return 'CALL ' . $this->call->name . '('
|
||||
. ($this->call->parameters ? implode(',', $this->call->parameters->raw) : '') . ')';
|
||||
}
|
||||
}
|
||||
30
pma/vendor/phpmyadmin/sql-parser/src/Statements/CheckStatement.php
vendored
Normal file
30
pma/vendor/phpmyadmin/sql-parser/src/Statements/CheckStatement.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
/**
|
||||
* `CHECK` statement.
|
||||
*
|
||||
* CHECK TABLE tbl_name [, tbl_name] ... [option] ...
|
||||
*/
|
||||
class CheckStatement extends MaintenanceStatement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'FOR UPGRADE' => 2,
|
||||
'QUICK' => 3,
|
||||
'FAST' => 4,
|
||||
'MEDIUM' => 5,
|
||||
'EXTENDED' => 6,
|
||||
'CHANGED' => 7,
|
||||
];
|
||||
}
|
||||
26
pma/vendor/phpmyadmin/sql-parser/src/Statements/ChecksumStatement.php
vendored
Normal file
26
pma/vendor/phpmyadmin/sql-parser/src/Statements/ChecksumStatement.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
/**
|
||||
* `CHECKSUM` statement.
|
||||
*
|
||||
* CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]
|
||||
*/
|
||||
class ChecksumStatement extends MaintenanceStatement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'QUICK' => 2,
|
||||
'EXTENDED' => 3,
|
||||
];
|
||||
}
|
||||
797
pma/vendor/phpmyadmin/sql-parser/src/Statements/CreateStatement.php
vendored
Normal file
797
pma/vendor/phpmyadmin/sql-parser/src/Statements/CreateStatement.php
vendored
Normal file
@@ -0,0 +1,797 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\ArrayObj;
|
||||
use PhpMyAdmin\SqlParser\Components\CreateDefinition;
|
||||
use PhpMyAdmin\SqlParser\Components\DataType;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\ParameterDefinition;
|
||||
use PhpMyAdmin\SqlParser\Components\PartitionDefinition;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function is_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `CREATE` statement.
|
||||
*/
|
||||
class CreateStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `CREATE` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
// CREATE TABLE
|
||||
'TEMPORARY' => 1,
|
||||
|
||||
// CREATE VIEW
|
||||
'OR REPLACE' => 2,
|
||||
'ALGORITHM' => [
|
||||
3,
|
||||
'var=',
|
||||
],
|
||||
// `DEFINER` is also used for `CREATE FUNCTION / PROCEDURE`
|
||||
'DEFINER' => [
|
||||
4,
|
||||
'expr=',
|
||||
],
|
||||
// Used in `CREATE VIEW`
|
||||
'SQL SECURITY' => [
|
||||
5,
|
||||
'var',
|
||||
],
|
||||
|
||||
'DATABASE' => 6,
|
||||
'EVENT' => 6,
|
||||
'FUNCTION' => 6,
|
||||
'INDEX' => 6,
|
||||
'UNIQUE INDEX' => 6,
|
||||
'FULLTEXT INDEX' => 6,
|
||||
'SPATIAL INDEX' => 6,
|
||||
'PROCEDURE' => 6,
|
||||
'SERVER' => 6,
|
||||
'TABLE' => 6,
|
||||
'TABLESPACE' => 6,
|
||||
'TRIGGER' => 6,
|
||||
'USER' => 6,
|
||||
'VIEW' => 6,
|
||||
'SCHEMA' => 6,
|
||||
|
||||
// CREATE TABLE
|
||||
'IF NOT EXISTS' => 7,
|
||||
];
|
||||
|
||||
/**
|
||||
* All database options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $DB_OPTIONS = [
|
||||
'CHARACTER SET' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'CHARSET' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'DEFAULT CHARACTER SET' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'DEFAULT CHARSET' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'DEFAULT COLLATE' => [
|
||||
2,
|
||||
'var=',
|
||||
],
|
||||
'COLLATE' => [
|
||||
2,
|
||||
'var=',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* All table options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $TABLE_OPTIONS = [
|
||||
'ENGINE' => [
|
||||
1,
|
||||
'var=',
|
||||
],
|
||||
'AUTO_INCREMENT' => [
|
||||
2,
|
||||
'var=',
|
||||
],
|
||||
'AVG_ROW_LENGTH' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'CHARACTER SET' => [
|
||||
4,
|
||||
'var=',
|
||||
],
|
||||
'CHARSET' => [
|
||||
4,
|
||||
'var=',
|
||||
],
|
||||
'DEFAULT CHARACTER SET' => [
|
||||
4,
|
||||
'var=',
|
||||
],
|
||||
'DEFAULT CHARSET' => [
|
||||
4,
|
||||
'var=',
|
||||
],
|
||||
'CHECKSUM' => [
|
||||
5,
|
||||
'var',
|
||||
],
|
||||
'DEFAULT COLLATE' => [
|
||||
6,
|
||||
'var=',
|
||||
],
|
||||
'COLLATE' => [
|
||||
6,
|
||||
'var=',
|
||||
],
|
||||
'COMMENT' => [
|
||||
7,
|
||||
'var=',
|
||||
],
|
||||
'CONNECTION' => [
|
||||
8,
|
||||
'var',
|
||||
],
|
||||
'DATA DIRECTORY' => [
|
||||
9,
|
||||
'var',
|
||||
],
|
||||
'DELAY_KEY_WRITE' => [
|
||||
10,
|
||||
'var',
|
||||
],
|
||||
'INDEX DIRECTORY' => [
|
||||
11,
|
||||
'var',
|
||||
],
|
||||
'INSERT_METHOD' => [
|
||||
12,
|
||||
'var',
|
||||
],
|
||||
'KEY_BLOCK_SIZE' => [
|
||||
13,
|
||||
'var',
|
||||
],
|
||||
'MAX_ROWS' => [
|
||||
14,
|
||||
'var',
|
||||
],
|
||||
'MIN_ROWS' => [
|
||||
15,
|
||||
'var',
|
||||
],
|
||||
'PACK_KEYS' => [
|
||||
16,
|
||||
'var',
|
||||
],
|
||||
'PASSWORD' => [
|
||||
17,
|
||||
'var',
|
||||
],
|
||||
'ROW_FORMAT' => [
|
||||
18,
|
||||
'var',
|
||||
],
|
||||
'TABLESPACE' => [
|
||||
19,
|
||||
'var',
|
||||
],
|
||||
'STORAGE' => [
|
||||
20,
|
||||
'var',
|
||||
],
|
||||
'UNION' => [
|
||||
21,
|
||||
'var',
|
||||
],
|
||||
'PAGE_COMPRESSED' => [
|
||||
22,
|
||||
'var',
|
||||
],
|
||||
'PAGE_COMPRESSION_LEVEL' => [
|
||||
23,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* All function options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $FUNC_OPTIONS = [
|
||||
'NOT' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
'FUNCTION' => [
|
||||
3,
|
||||
'var=',
|
||||
],
|
||||
'PROCEDURE' => [
|
||||
3,
|
||||
'var=',
|
||||
],
|
||||
'CONTAINS SQL' => 4,
|
||||
'NO SQL' => 4,
|
||||
'READS SQL DATA' => 4,
|
||||
'MODIFIES SQL DATA' => 4,
|
||||
'SQL SECURITY' => [
|
||||
6,
|
||||
'var',
|
||||
],
|
||||
'LANGUAGE' => [
|
||||
7,
|
||||
'var',
|
||||
],
|
||||
'COMMENT' => [
|
||||
8,
|
||||
'var',
|
||||
],
|
||||
|
||||
'CREATE' => 1,
|
||||
'DETERMINISTIC' => 2,
|
||||
];
|
||||
|
||||
/**
|
||||
* All trigger options.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $TRIGGER_OPTIONS = [
|
||||
'BEFORE' => 1,
|
||||
'AFTER' => 1,
|
||||
'INSERT' => 2,
|
||||
'UPDATE' => 2,
|
||||
'DELETE' => 2,
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of the entity that is created.
|
||||
*
|
||||
* Used by all `CREATE` statements.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* The options of the entity (table, procedure, function, etc.).
|
||||
*
|
||||
* Used by `CREATE TABLE`, `CREATE FUNCTION` and `CREATE PROCEDURE`.
|
||||
*
|
||||
* @see static::$TABLE_OPTIONS
|
||||
* @see static::$FUNC_OPTIONS
|
||||
* @see static::$TRIGGER_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $entityOptions;
|
||||
|
||||
/**
|
||||
* If `CREATE TABLE`, a list of columns and keys.
|
||||
* If `CREATE VIEW`, a list of columns.
|
||||
*
|
||||
* Used by `CREATE TABLE` and `CREATE VIEW`.
|
||||
*
|
||||
* @var CreateDefinition[]|ArrayObj|null
|
||||
*/
|
||||
public $fields;
|
||||
|
||||
/**
|
||||
* If `CREATE TABLE WITH`.
|
||||
* If `CREATE TABLE AS WITH`.
|
||||
* If `CREATE VIEW AS WITH`.
|
||||
*
|
||||
* Used by `CREATE TABLE`, `CREATE VIEW`
|
||||
*
|
||||
* @var WithStatement|null
|
||||
*/
|
||||
public $with;
|
||||
|
||||
/**
|
||||
* If `CREATE TABLE ... SELECT`.
|
||||
* If `CREATE VIEW AS ` ... SELECT`.
|
||||
*
|
||||
* Used by `CREATE TABLE`, `CREATE VIEW`
|
||||
*
|
||||
* @var SelectStatement|null
|
||||
*/
|
||||
public $select;
|
||||
|
||||
/**
|
||||
* If `CREATE TABLE ... LIKE`.
|
||||
*
|
||||
* Used by `CREATE TABLE`
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $like;
|
||||
|
||||
/**
|
||||
* Expression used for partitioning.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $partitionBy;
|
||||
|
||||
/**
|
||||
* The number of partitions.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $partitionsNum;
|
||||
|
||||
/**
|
||||
* Expression used for subpartitioning.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $subpartitionBy;
|
||||
|
||||
/**
|
||||
* The number of subpartitions.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $subpartitionsNum;
|
||||
|
||||
/**
|
||||
* The partition of the new table.
|
||||
*
|
||||
* @var PartitionDefinition[]|null
|
||||
*/
|
||||
public $partitions;
|
||||
|
||||
/**
|
||||
* If `CREATE TRIGGER` the name of the table.
|
||||
*
|
||||
* Used by `CREATE TRIGGER`.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* The return data type of this routine.
|
||||
*
|
||||
* Used by `CREATE FUNCTION`.
|
||||
*
|
||||
* @var DataType|null
|
||||
*/
|
||||
public $return;
|
||||
|
||||
/**
|
||||
* The parameters of this routine.
|
||||
*
|
||||
* Used by `CREATE FUNCTION` and `CREATE PROCEDURE`.
|
||||
*
|
||||
* @var ParameterDefinition[]|null
|
||||
*/
|
||||
public $parameters;
|
||||
|
||||
/**
|
||||
* The body of this function or procedure.
|
||||
* For views, it is the select statement that creates the view.
|
||||
* Used by `CREATE FUNCTION`, `CREATE PROCEDURE` and `CREATE VIEW`.
|
||||
*
|
||||
* @var Token[]|string
|
||||
*/
|
||||
public $body = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$fields = '';
|
||||
if (! empty($this->fields)) {
|
||||
if (is_array($this->fields)) {
|
||||
$fields = CreateDefinition::build($this->fields) . ' ';
|
||||
} elseif ($this->fields instanceof ArrayObj) {
|
||||
$fields = ArrayObj::build($this->fields);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->options->has('DATABASE') || $this->options->has('SCHEMA')) {
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. OptionsArray::build($this->entityOptions);
|
||||
}
|
||||
|
||||
if ($this->options->has('TABLE')) {
|
||||
if ($this->select !== null) {
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. $this->select->build();
|
||||
}
|
||||
|
||||
if ($this->like !== null) {
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' LIKE '
|
||||
. Expression::build($this->like);
|
||||
}
|
||||
|
||||
if ($this->with !== null) {
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. $this->with->build();
|
||||
}
|
||||
|
||||
$partition = '';
|
||||
|
||||
if (! empty($this->partitionBy)) {
|
||||
$partition .= "\nPARTITION BY " . $this->partitionBy;
|
||||
}
|
||||
|
||||
if (! empty($this->partitionsNum)) {
|
||||
$partition .= "\nPARTITIONS " . $this->partitionsNum;
|
||||
}
|
||||
|
||||
if (! empty($this->subpartitionBy)) {
|
||||
$partition .= "\nSUBPARTITION BY " . $this->subpartitionBy;
|
||||
}
|
||||
|
||||
if (! empty($this->subpartitionsNum)) {
|
||||
$partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum;
|
||||
}
|
||||
|
||||
if (! empty($this->partitions)) {
|
||||
$partition .= "\n" . PartitionDefinition::build($this->partitions);
|
||||
}
|
||||
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. $fields
|
||||
. OptionsArray::build($this->entityOptions)
|
||||
. $partition;
|
||||
} elseif ($this->options->has('VIEW')) {
|
||||
$builtStatement = '';
|
||||
if ($this->select !== null) {
|
||||
$builtStatement = $this->select->build();
|
||||
} elseif ($this->with !== null) {
|
||||
$builtStatement = $this->with->build();
|
||||
}
|
||||
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. $fields . ' AS ' . $builtStatement
|
||||
. (! empty($this->body) ? TokensList::build($this->body) : '') . ' '
|
||||
. OptionsArray::build($this->entityOptions);
|
||||
} elseif ($this->options->has('TRIGGER')) {
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. OptionsArray::build($this->entityOptions) . ' '
|
||||
. 'ON ' . Expression::build($this->table) . ' '
|
||||
. 'FOR EACH ROW ' . TokensList::build($this->body);
|
||||
} elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
|
||||
$tmp = '';
|
||||
if ($this->options->has('FUNCTION')) {
|
||||
$tmp = 'RETURNS ' . DataType::build($this->return);
|
||||
}
|
||||
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. ParameterDefinition::build($this->parameters) . ' '
|
||||
. $tmp . ' ' . OptionsArray::build($this->entityOptions) . ' '
|
||||
. TokensList::build($this->body);
|
||||
}
|
||||
|
||||
return 'CREATE '
|
||||
. OptionsArray::build($this->options) . ' '
|
||||
. Expression::build($this->name) . ' '
|
||||
. TokensList::build($this->body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `CREATE`.
|
||||
|
||||
// Parsing options.
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
++$list->idx; // Skipping last option.
|
||||
|
||||
$isDatabase = $this->options->has('DATABASE') || $this->options->has('SCHEMA');
|
||||
$fieldName = $isDatabase ? 'database' : 'table';
|
||||
|
||||
// Parsing the field name.
|
||||
$this->name = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => $fieldName,
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
|
||||
if (! isset($this->name) || ($this->name === '')) {
|
||||
$parser->error('The name of the entity was expected.', $list->tokens[$list->idx]);
|
||||
} else {
|
||||
++$list->idx; // Skipping field.
|
||||
}
|
||||
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
$nextidx = $list->idx + 1;
|
||||
while ($nextidx < $list->count && $list->tokens[$nextidx]->type === Token::TYPE_WHITESPACE) {
|
||||
++$nextidx;
|
||||
}
|
||||
|
||||
if ($isDatabase) {
|
||||
$this->entityOptions = OptionsArray::parse($parser, $list, static::$DB_OPTIONS);
|
||||
} elseif ($this->options->has('TABLE')) {
|
||||
if (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'SELECT')) {
|
||||
/* CREATE TABLE ... SELECT */
|
||||
$this->select = new SelectStatement($parser, $list);
|
||||
} elseif ($token->type === Token::TYPE_KEYWORD && ($token->keyword === 'WITH')) {
|
||||
/* CREATE TABLE WITH */
|
||||
$this->with = new WithStatement($parser, $list);
|
||||
} elseif (
|
||||
($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'AS')
|
||||
&& ($list->tokens[$nextidx]->type === Token::TYPE_KEYWORD)
|
||||
) {
|
||||
if ($list->tokens[$nextidx]->value === 'SELECT') {
|
||||
/* CREATE TABLE ... AS SELECT */
|
||||
$list->idx = $nextidx;
|
||||
$this->select = new SelectStatement($parser, $list);
|
||||
} elseif ($list->tokens[$nextidx]->value === 'WITH') {
|
||||
/* CREATE TABLE WITH */
|
||||
$list->idx = $nextidx;
|
||||
$this->with = new WithStatement($parser, $list);
|
||||
}
|
||||
} elseif ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'LIKE') {
|
||||
/* CREATE TABLE `new_tbl` LIKE 'orig_tbl' */
|
||||
$list->idx = $nextidx;
|
||||
$this->like = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => 'table',
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
// The 'LIKE' keyword was found, but no table_name was found next to it
|
||||
if ($this->like === null) {
|
||||
$parser->error('A table name was expected.', $list->tokens[$list->idx]);
|
||||
}
|
||||
} else {
|
||||
$this->fields = CreateDefinition::parse($parser, $list);
|
||||
if (empty($this->fields)) {
|
||||
$parser->error('At least one column definition was expected.', $list->tokens[$list->idx]);
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
|
||||
$this->entityOptions = OptionsArray::parse($parser, $list, static::$TABLE_OPTIONS);
|
||||
|
||||
/**
|
||||
* The field that is being filled (`partitionBy` or
|
||||
* `subpartitionBy`).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
$field = null;
|
||||
|
||||
/**
|
||||
* The number of brackets. `false` means no bracket was found
|
||||
* previously. At least one bracket is required to validate the
|
||||
* expression.
|
||||
*
|
||||
* @var int|bool
|
||||
*/
|
||||
$brackets = false;
|
||||
|
||||
/*
|
||||
* Handles partitions.
|
||||
*/
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Skipping comments.
|
||||
if ($token->type === Token::TYPE_COMMENT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'PARTITION BY')) {
|
||||
$field = 'partitionBy';
|
||||
$brackets = false;
|
||||
} elseif (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'SUBPARTITION BY')) {
|
||||
$field = 'subpartitionBy';
|
||||
$brackets = false;
|
||||
} elseif (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'PARTITIONS')) {
|
||||
$token = $list->getNextOfType(Token::TYPE_NUMBER);
|
||||
--$list->idx; // `getNextOfType` also advances one position.
|
||||
$this->partitionsNum = $token->value;
|
||||
} elseif (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'SUBPARTITIONS')) {
|
||||
$token = $list->getNextOfType(Token::TYPE_NUMBER);
|
||||
--$list->idx; // `getNextOfType` also advances one position.
|
||||
$this->subpartitionsNum = $token->value;
|
||||
} elseif (! empty($field)) {
|
||||
/*
|
||||
* Handling the content of `PARTITION BY` and `SUBPARTITION BY`.
|
||||
*/
|
||||
|
||||
// Counting brackets.
|
||||
if ($token->type === Token::TYPE_OPERATOR) {
|
||||
if ($token->value === '(') {
|
||||
// This is used instead of `++$brackets` because,
|
||||
// initially, `$brackets` is `false` cannot be
|
||||
// incremented.
|
||||
$brackets += 1;
|
||||
} elseif ($token->value === ')') {
|
||||
--$brackets;
|
||||
}
|
||||
}
|
||||
|
||||
// Building the expression used for partitioning.
|
||||
$this->$field .= $token->type === Token::TYPE_WHITESPACE ? ' ' : $token->token;
|
||||
|
||||
// Last bracket was read, the expression ended.
|
||||
// Comparing with `0` and not `false`, because `false` means
|
||||
// that no bracket was found and at least one must is
|
||||
// required.
|
||||
if ($brackets === 0) {
|
||||
$this->$field = trim($this->$field);
|
||||
$field = null;
|
||||
}
|
||||
} elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
if (! empty($this->partitionBy)) {
|
||||
$this->partitions = ArrayObj::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition']
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
|
||||
$this->parameters = ParameterDefinition::parse($parser, $list);
|
||||
if ($this->options->has('FUNCTION')) {
|
||||
$prevToken = $token;
|
||||
$token = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
if ($token === null || $token->keyword !== 'RETURNS') {
|
||||
$parser->error('A "RETURNS" keyword was expected.', $token ?? $prevToken);
|
||||
} else {
|
||||
++$list->idx;
|
||||
$this->return = DataType::parse($parser, $list);
|
||||
}
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
|
||||
$this->entityOptions = OptionsArray::parse($parser, $list, static::$FUNC_OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
$token = $list->tokens[$list->idx];
|
||||
$this->body[] = $token;
|
||||
}
|
||||
} elseif ($this->options->has('VIEW')) {
|
||||
/** @var Token $token */
|
||||
$token = $list->getNext(); // Skipping whitespaces and comments.
|
||||
|
||||
// Parsing columns list.
|
||||
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
|
||||
--$list->idx; // getNext() also goes forward one field.
|
||||
$this->fields = ArrayObj::parse($parser, $list);
|
||||
++$list->idx; // Skipping last token from the array.
|
||||
$list->getNext();
|
||||
}
|
||||
|
||||
// Parsing the SELECT expression if the view started with it.
|
||||
if (
|
||||
$token->type === Token::TYPE_KEYWORD
|
||||
&& $token->keyword === 'AS'
|
||||
&& $list->tokens[$nextidx]->type === Token::TYPE_KEYWORD
|
||||
) {
|
||||
if ($list->tokens[$nextidx]->value === 'SELECT') {
|
||||
$list->idx = $nextidx;
|
||||
$this->select = new SelectStatement($parser, $list);
|
||||
++$list->idx; // Skipping last token from the select.
|
||||
} elseif ($list->tokens[$nextidx]->value === 'WITH') {
|
||||
++$list->idx;
|
||||
$this->with = new WithStatement($parser, $list);
|
||||
}
|
||||
}
|
||||
|
||||
// Parsing all other tokens
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
$token = $list->tokens[$list->idx];
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->body[] = $token;
|
||||
}
|
||||
} elseif ($this->options->has('TRIGGER')) {
|
||||
// Parsing the time and the event.
|
||||
$this->entityOptions = OptionsArray::parse($parser, $list, static::$TRIGGER_OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
$list->getNextOfTypeAndValue(Token::TYPE_KEYWORD, 'ON');
|
||||
++$list->idx; // Skipping `ON`.
|
||||
|
||||
// Parsing the name of the table.
|
||||
$this->table = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
[
|
||||
'parseField' => 'table',
|
||||
'breakOnAlias' => true,
|
||||
]
|
||||
);
|
||||
++$list->idx;
|
||||
|
||||
$list->getNextOfTypeAndValue(Token::TYPE_KEYWORD, 'FOR EACH ROW');
|
||||
++$list->idx; // Skipping `FOR EACH ROW`.
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
$token = $list->tokens[$list->idx];
|
||||
$this->body[] = $token;
|
||||
}
|
||||
} else {
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
$token = $list->tokens[$list->idx];
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->body[] = $token;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
374
pma/vendor/phpmyadmin/sql-parser/src/Statements/DeleteStatement.php
vendored
Normal file
374
pma/vendor/phpmyadmin/sql-parser/src/Statements/DeleteStatement.php
vendored
Normal file
@@ -0,0 +1,374 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\ArrayObj;
|
||||
use PhpMyAdmin\SqlParser\Components\Condition;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\ExpressionArray;
|
||||
use PhpMyAdmin\SqlParser\Components\JoinKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\Limit;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\OrderKeyword;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
use function stripos;
|
||||
use function strlen;
|
||||
|
||||
/**
|
||||
* `DELETE` statement.
|
||||
*
|
||||
* DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* [WHERE where_condition]
|
||||
* [ORDER BY ...]
|
||||
* [LIMIT row_count]
|
||||
*
|
||||
* Multi-table syntax
|
||||
*
|
||||
* DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
|
||||
* tbl_name[.*] [, tbl_name[.*]] ...
|
||||
* FROM table_references
|
||||
* [WHERE where_condition]
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
|
||||
* FROM tbl_name[.*] [, tbl_name[.*]] ...
|
||||
* USING table_references
|
||||
* [WHERE where_condition]
|
||||
*/
|
||||
class DeleteStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `DELETE` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'LOW_PRIORITY' => 1,
|
||||
'QUICK' => 2,
|
||||
'IGNORE' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* The clauses of this statement, in order.
|
||||
*
|
||||
* @see Statement::$CLAUSES
|
||||
*
|
||||
* @var array<string, array<int, int|string>>
|
||||
* @psalm-var array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public static $CLAUSES = [
|
||||
'DELETE' => [
|
||||
'DELETE',
|
||||
2,
|
||||
],
|
||||
// Used for options.
|
||||
'_OPTIONS' => [
|
||||
'_OPTIONS',
|
||||
1,
|
||||
],
|
||||
'FROM' => [
|
||||
'FROM',
|
||||
3,
|
||||
],
|
||||
'PARTITION' => [
|
||||
'PARTITION',
|
||||
3,
|
||||
],
|
||||
'USING' => [
|
||||
'USING',
|
||||
3,
|
||||
],
|
||||
'WHERE' => [
|
||||
'WHERE',
|
||||
3,
|
||||
],
|
||||
'ORDER BY' => [
|
||||
'ORDER BY',
|
||||
3,
|
||||
],
|
||||
'LIMIT' => [
|
||||
'LIMIT',
|
||||
3,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Table(s) used as sources for this statement.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $from;
|
||||
|
||||
/**
|
||||
* Joins.
|
||||
*
|
||||
* @var JoinKeyword[]|null
|
||||
*/
|
||||
public $join;
|
||||
|
||||
/**
|
||||
* Tables used as sources for this statement.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $using;
|
||||
|
||||
/**
|
||||
* Columns used in this statement.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $columns;
|
||||
|
||||
/**
|
||||
* Partitions used as source for this statement.
|
||||
*
|
||||
* @var ArrayObj|null
|
||||
*/
|
||||
public $partition;
|
||||
|
||||
/**
|
||||
* Conditions used for filtering each row of the result set.
|
||||
*
|
||||
* @var Condition[]|null
|
||||
*/
|
||||
public $where;
|
||||
|
||||
/**
|
||||
* Specifies the order of the rows in the result set.
|
||||
*
|
||||
* @var OrderKeyword[]|null
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* Conditions used for limiting the size of the result set.
|
||||
*
|
||||
* @var Limit|null
|
||||
*/
|
||||
public $limit;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'DELETE ' . OptionsArray::build($this->options);
|
||||
|
||||
if ($this->columns !== null && count($this->columns) > 0) {
|
||||
$ret .= ' ' . ExpressionArray::build($this->columns);
|
||||
}
|
||||
|
||||
if ($this->from !== null && count($this->from) > 0) {
|
||||
$ret .= ' FROM ' . ExpressionArray::build($this->from);
|
||||
}
|
||||
|
||||
if ($this->join !== null && count($this->join) > 0) {
|
||||
$ret .= ' ' . JoinKeyword::build($this->join);
|
||||
}
|
||||
|
||||
if ($this->using !== null && count($this->using) > 0) {
|
||||
$ret .= ' USING ' . ExpressionArray::build($this->using);
|
||||
}
|
||||
|
||||
if ($this->where !== null && count($this->where) > 0) {
|
||||
$ret .= ' WHERE ' . Condition::build($this->where);
|
||||
}
|
||||
|
||||
if ($this->order !== null && count($this->order) > 0) {
|
||||
$ret .= ' ORDER BY ' . ExpressionArray::build($this->order);
|
||||
}
|
||||
|
||||
if ($this->limit !== null && strlen((string) $this->limit) > 0) {
|
||||
$ret .= ' LIMIT ' . Limit::build($this->limit);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `DELETE`.
|
||||
|
||||
// parse any options if provided
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------------------[ FROM ]----------------------------------> 2
|
||||
* 0 ------------------------------[ table[.*] ]--------------------------------> 1
|
||||
* 1 ---------------------------------[ FROM ]----------------------------------> 2
|
||||
* 2 --------------------------------[ USING ]----------------------------------> 3
|
||||
* 2 --------------------------------[ WHERE ]----------------------------------> 4
|
||||
* 2 --------------------------------[ ORDER ]----------------------------------> 5
|
||||
* 2 --------------------------------[ LIMIT ]----------------------------------> 6
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* If the query is multi-table or not.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
$multiTable = false;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
// End of statement.
|
||||
if ($token->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword !== 'FROM') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx; // Skip 'FROM'
|
||||
$this->from = ExpressionArray::parse($parser, $list);
|
||||
|
||||
$state = 2;
|
||||
} else {
|
||||
$this->columns = ExpressionArray::parse($parser, $list);
|
||||
$state = 1;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->keyword !== 'FROM') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx; // Skip 'FROM'
|
||||
$this->from = ExpressionArray::parse($parser, $list);
|
||||
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if (stripos($token->keyword, 'JOIN') !== false) {
|
||||
++$list->idx;
|
||||
$this->join = JoinKeyword::parse($parser, $list);
|
||||
|
||||
// remain in state = 2
|
||||
} else {
|
||||
switch ($token->keyword) {
|
||||
case 'USING':
|
||||
++$list->idx; // Skip 'USING'
|
||||
$this->using = ExpressionArray::parse($parser, $list);
|
||||
$state = 3;
|
||||
|
||||
$multiTable = true;
|
||||
break;
|
||||
case 'WHERE':
|
||||
++$list->idx; // Skip 'WHERE'
|
||||
$this->where = Condition::parse($parser, $list);
|
||||
$state = 4;
|
||||
break;
|
||||
case 'ORDER BY':
|
||||
++$list->idx; // Skip 'ORDER BY'
|
||||
$this->order = OrderKeyword::parse($parser, $list);
|
||||
$state = 5;
|
||||
break;
|
||||
case 'LIMIT':
|
||||
++$list->idx; // Skip 'LIMIT'
|
||||
$this->limit = Limit::parse($parser, $list);
|
||||
$state = 6;
|
||||
break;
|
||||
default:
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($state === 3) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->keyword !== 'WHERE') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx; // Skip 'WHERE'
|
||||
$this->where = Condition::parse($parser, $list);
|
||||
$state = 4;
|
||||
} elseif ($state === 4) {
|
||||
if ($multiTable === true && $token->type === Token::TYPE_KEYWORD) {
|
||||
$parser->error('This type of clause is not valid in Multi-table queries.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
switch ($token->keyword) {
|
||||
case 'ORDER BY':
|
||||
++$list->idx; // Skip 'ORDER BY'
|
||||
$this->order = OrderKeyword::parse($parser, $list);
|
||||
$state = 5;
|
||||
break;
|
||||
case 'LIMIT':
|
||||
++$list->idx; // Skip 'LIMIT'
|
||||
$this->limit = Limit::parse($parser, $list);
|
||||
$state = 6;
|
||||
break;
|
||||
default:
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
} elseif ($state === 5) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword !== 'LIMIT') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx; // Skip 'LIMIT'
|
||||
$this->limit = Limit::parse($parser, $list);
|
||||
$state = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($state >= 2) {
|
||||
foreach ($this->from as $fromExpr) {
|
||||
$fromExpr->database = $fromExpr->table;
|
||||
$fromExpr->table = $fromExpr->column;
|
||||
$fromExpr->column = null;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
}
|
||||
}
|
||||
82
pma/vendor/phpmyadmin/sql-parser/src/Statements/DropStatement.php
vendored
Normal file
82
pma/vendor/phpmyadmin/sql-parser/src/Statements/DropStatement.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
/**
|
||||
* `DROP` statement.
|
||||
*/
|
||||
class DropStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'DATABASE' => 1,
|
||||
'EVENT' => 1,
|
||||
'FUNCTION' => 1,
|
||||
'INDEX' => 1,
|
||||
'LOGFILE' => 1,
|
||||
'PROCEDURE' => 1,
|
||||
'SCHEMA' => 1,
|
||||
'SERVER' => 1,
|
||||
'TABLE' => 1,
|
||||
'VIEW' => 1,
|
||||
'TABLESPACE' => 1,
|
||||
'TRIGGER' => 1,
|
||||
'USER' => 1,
|
||||
|
||||
'TEMPORARY' => 2,
|
||||
'IF EXISTS' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* The clauses of this statement, in order.
|
||||
*
|
||||
* @see Statement::$CLAUSES
|
||||
*
|
||||
* @var array<string, array<int, int|string>>
|
||||
* @psalm-var array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public static $CLAUSES = [
|
||||
'DROP' => [
|
||||
'DROP',
|
||||
2,
|
||||
],
|
||||
// Used for options.
|
||||
'_OPTIONS' => [
|
||||
'_OPTIONS',
|
||||
1,
|
||||
],
|
||||
// Used for select expressions.
|
||||
'DROP_' => [
|
||||
'DROP',
|
||||
1,
|
||||
],
|
||||
'ON' => [
|
||||
'ON',
|
||||
3,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Dropped elements.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $fields;
|
||||
|
||||
/**
|
||||
* Table of the dropped index.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $table;
|
||||
}
|
||||
207
pma/vendor/phpmyadmin/sql-parser/src/Statements/ExplainStatement.php
vendored
Normal file
207
pma/vendor/phpmyadmin/sql-parser/src/Statements/ExplainStatement.php
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function array_slice;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* `EXPLAIN` statement.
|
||||
*/
|
||||
class ExplainStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `EXPLAIN` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
|
||||
'EXTENDED' => 1,
|
||||
'PARTITIONS' => 1,
|
||||
'FORMAT' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The parser of the statement to be explained
|
||||
*
|
||||
* @var Parser|null
|
||||
*/
|
||||
public $bodyParser = null;
|
||||
|
||||
/**
|
||||
* The statement alias, could be any of the following:
|
||||
* - {EXPLAIN | DESCRIBE | DESC}
|
||||
* - {EXPLAIN | DESCRIBE | DESC} ANALYZE
|
||||
* - ANALYZE
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $statementAlias;
|
||||
|
||||
/**
|
||||
* The connection identifier, if used.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $connectionId = null;
|
||||
|
||||
/**
|
||||
* The explained table's name, if used.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $explainedTable = null;
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 -------------------[ EXPLAIN/EXPLAIN ANALYZE/ANALYZE ]-----------------------> 1
|
||||
*
|
||||
* 1 ------------------------------[ OPTIONS ]------------------------------------> 2
|
||||
*
|
||||
* 2 --------------[ tablename / STATEMENT / FOR CONNECTION ]---------------------> 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* To Differentiate between ANALYZE / EXPLAIN / EXPLAIN ANALYZE
|
||||
* 0 -> ANALYZE ( used by mariaDB https://mariadb.com/kb/en/analyze-statement)
|
||||
* 1 -> {EXPLAIN | DESCRIBE | DESC}
|
||||
* 2 -> {EXPLAIN | DESCRIBE | DESC} ANALYZE
|
||||
*/
|
||||
$miniState = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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->keyword === 'ANALYZE' && $miniState === 0) {
|
||||
$state = 1;
|
||||
$this->statementAlias = 'ANALYZE';
|
||||
} elseif (
|
||||
$token->keyword === 'EXPLAIN'
|
||||
|| $token->keyword === 'DESC'
|
||||
|| $token->keyword === 'DESCRIBE'
|
||||
) {
|
||||
$miniState = 1;
|
||||
$this->statementAlias = $token->keyword;
|
||||
|
||||
$lastIdx = $list->idx;
|
||||
$nextKeyword = $list->getNextOfTypeAndValue(Token::TYPE_KEYWORD, 'ANALYZE');
|
||||
if ($nextKeyword && $nextKeyword->keyword !== null) {
|
||||
$miniState = 2;
|
||||
$this->statementAlias .= ' ANALYZE';
|
||||
} else {
|
||||
$list->idx = $lastIdx;
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
}
|
||||
} elseif ($state === 1) {
|
||||
// Parsing options.
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
$currIdx = $list->idx;
|
||||
$list->idx++; // Ignore the current token
|
||||
$nextToken = $list->getNext();
|
||||
$list->idx = $currIdx;
|
||||
|
||||
if ($token->keyword === 'FOR' && $nextToken->keyword === 'CONNECTION') {
|
||||
$list->idx++; // Ignore the current token
|
||||
$list->getNext(); // CONNECTION
|
||||
$nextToken = $list->getNext(); // Identifier
|
||||
$this->connectionId = $nextToken->value;
|
||||
break;
|
||||
}
|
||||
|
||||
// To support EXPLAIN tablename
|
||||
if ($token->type === Token::TYPE_NONE) {
|
||||
$this->explainedTable = $token->value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
$token->keyword !== 'SELECT'
|
||||
&& $token->keyword !== 'INSERT'
|
||||
&& $token->keyword !== 'UPDATE'
|
||||
&& $token->keyword !== 'DELETE'
|
||||
) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
// Index of the last parsed token by default would be the last token in the $list, because we're
|
||||
// assuming that all remaining tokens at state 2, are related to the to-be-explained statement.
|
||||
$idxOfLastParsedToken = $list->count - 1;
|
||||
$subList = new TokensList(array_slice($list->tokens, $list->idx));
|
||||
|
||||
$this->bodyParser = new Parser($subList);
|
||||
if (count($this->bodyParser->errors)) {
|
||||
foreach ($this->bodyParser->errors as $error) {
|
||||
$parser->errors[] = $error;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$list->idx = $idxOfLastParsedToken;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function build(): string
|
||||
{
|
||||
$str = $this->statementAlias;
|
||||
|
||||
if (count($this->options->options)) {
|
||||
$str .= ' ';
|
||||
}
|
||||
|
||||
$str .= OptionsArray::build($this->options) . ' ';
|
||||
|
||||
if ($this->bodyParser) {
|
||||
foreach ($this->bodyParser->statements as $statement) {
|
||||
$str .= $statement->build();
|
||||
}
|
||||
} elseif ($this->connectionId) {
|
||||
$str .= 'FOR CONNECTION ' . $this->connectionId;
|
||||
} elseif ($this->explainedTable) {
|
||||
$str .= $this->explainedTable;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
254
pma/vendor/phpmyadmin/sql-parser/src/Statements/InsertStatement.php
vendored
Normal file
254
pma/vendor/phpmyadmin/sql-parser/src/Statements/InsertStatement.php
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Array2d;
|
||||
use PhpMyAdmin\SqlParser\Components\ArrayObj;
|
||||
use PhpMyAdmin\SqlParser\Components\IntoKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\SetOperation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `INSERT` statement.
|
||||
*
|
||||
* INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
|
||||
* [INTO] tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* [(col_name,...)]
|
||||
* {VALUES | VALUE} ({expr | DEFAULT},...),(...),...
|
||||
* [ ON DUPLICATE KEY UPDATE
|
||||
* col_name=expr
|
||||
* [, col_name=expr] ... ]
|
||||
*
|
||||
* or
|
||||
*
|
||||
* INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
|
||||
* [INTO] tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* SET col_name={expr | DEFAULT}, ...
|
||||
* [ ON DUPLICATE KEY UPDATE
|
||||
* col_name=expr
|
||||
* [, col_name=expr] ... ]
|
||||
*
|
||||
* or
|
||||
*
|
||||
* INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
|
||||
* [INTO] tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* [(col_name,...)]
|
||||
* SELECT ...
|
||||
* [ ON DUPLICATE KEY UPDATE
|
||||
* col_name=expr
|
||||
* [, col_name=expr] ... ]
|
||||
*/
|
||||
class InsertStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `INSERT` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'LOW_PRIORITY' => 1,
|
||||
'DELAYED' => 2,
|
||||
'HIGH_PRIORITY' => 3,
|
||||
'IGNORE' => 4,
|
||||
];
|
||||
|
||||
/**
|
||||
* Tables used as target for this statement.
|
||||
*
|
||||
* @var IntoKeyword|null
|
||||
*/
|
||||
public $into;
|
||||
|
||||
/**
|
||||
* Values to be inserted.
|
||||
*
|
||||
* @var ArrayObj[]|null
|
||||
*/
|
||||
public $values;
|
||||
|
||||
/**
|
||||
* If SET clause is present
|
||||
* holds the SetOperation.
|
||||
*
|
||||
* @var SetOperation[]|null
|
||||
*/
|
||||
public $set;
|
||||
|
||||
/**
|
||||
* If SELECT clause is present
|
||||
* holds the SelectStatement.
|
||||
*
|
||||
* @var SelectStatement|null
|
||||
*/
|
||||
public $select;
|
||||
|
||||
/**
|
||||
* If WITH CTE is present
|
||||
* holds the WithStatement.
|
||||
*
|
||||
* @var WithStatement|null
|
||||
*/
|
||||
public $with;
|
||||
|
||||
/**
|
||||
* If ON DUPLICATE KEY UPDATE clause is present
|
||||
* holds the SetOperation.
|
||||
*
|
||||
* @var SetOperation[]|null
|
||||
*/
|
||||
public $onDuplicateSet;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'INSERT ' . $this->options;
|
||||
$ret = trim($ret) . ' INTO ' . $this->into;
|
||||
|
||||
if ($this->values !== null && count($this->values) > 0) {
|
||||
$ret .= ' VALUES ' . Array2d::build($this->values);
|
||||
} elseif ($this->set !== null && count($this->set) > 0) {
|
||||
$ret .= ' SET ' . SetOperation::build($this->set);
|
||||
} elseif ($this->select !== null && strlen((string) $this->select) > 0) {
|
||||
$ret .= ' ' . $this->select->build();
|
||||
}
|
||||
|
||||
if ($this->onDuplicateSet !== null && count($this->onDuplicateSet) > 0) {
|
||||
$ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `INSERT`.
|
||||
|
||||
// parse any options if provided
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------------------[ INTO ]----------------------------------> 1
|
||||
*
|
||||
* 1 -------------------------[ VALUES/VALUE/SET/SELECT ]-----------------------> 2
|
||||
*
|
||||
* 2 -------------------------[ ON DUPLICATE KEY UPDATE ]-----------------------> 3
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* For keeping track of semi-states on encountering
|
||||
* ON DUPLICATE KEY UPDATE ...
|
||||
*/
|
||||
$miniState = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'INTO') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
$this->into = IntoKeyword::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['fromInsert' => true]
|
||||
);
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->keyword === 'VALUE' || $token->keyword === 'VALUES') {
|
||||
++$list->idx; // skip VALUES
|
||||
|
||||
$this->values = Array2d::parse($parser, $list);
|
||||
} elseif ($token->keyword === 'SET') {
|
||||
++$list->idx; // skip SET
|
||||
|
||||
$this->set = SetOperation::parse($parser, $list);
|
||||
} elseif ($token->keyword === 'SELECT') {
|
||||
$this->select = new SelectStatement($parser, $list);
|
||||
} elseif ($token->keyword === 'WITH') {
|
||||
$this->with = new WithStatement($parser, $list);
|
||||
} else {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 2;
|
||||
$miniState = 1;
|
||||
} elseif ($state === 2) {
|
||||
$lastCount = $miniState;
|
||||
|
||||
if ($miniState === 1 && $token->keyword === 'ON') {
|
||||
++$miniState;
|
||||
} elseif ($miniState === 2 && $token->keyword === 'DUPLICATE') {
|
||||
++$miniState;
|
||||
} elseif ($miniState === 3 && $token->keyword === 'KEY') {
|
||||
++$miniState;
|
||||
} elseif ($miniState === 4 && $token->keyword === 'UPDATE') {
|
||||
++$miniState;
|
||||
}
|
||||
|
||||
if ($lastCount === $miniState) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($miniState === 5) {
|
||||
++$list->idx;
|
||||
$this->onDuplicateSet = SetOperation::parse($parser, $list);
|
||||
$state = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
}
|
||||
}
|
||||
410
pma/vendor/phpmyadmin/sql-parser/src/Statements/LoadStatement.php
vendored
Normal file
410
pma/vendor/phpmyadmin/sql-parser/src/Statements/LoadStatement.php
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\ArrayObj;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\ExpressionArray;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\SetOperation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `LOAD` statement.
|
||||
*
|
||||
* LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
|
||||
* [REPLACE | IGNORE]
|
||||
* INTO TABLE tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* [CHARACTER SET charset_name]
|
||||
* [{FIELDS | COLUMNS}
|
||||
* [TERMINATED BY 'string']
|
||||
* [[OPTIONALLY] ENCLOSED BY 'char']
|
||||
* [ESCAPED BY 'char']
|
||||
* ]
|
||||
* [LINES
|
||||
* [STARTING BY 'string']
|
||||
* [TERMINATED BY 'string']
|
||||
* ]
|
||||
* [IGNORE number {LINES | ROWS}]
|
||||
* [(col_name_or_user_var,...)]
|
||||
* [SET col_name = expr,...]
|
||||
*/
|
||||
class LoadStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `LOAD` statements and their slot ID.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'LOW_PRIORITY' => 1,
|
||||
'CONCURRENT' => 1,
|
||||
'LOCAL' => 2,
|
||||
];
|
||||
|
||||
/**
|
||||
* FIELDS/COLUMNS Options for `LOAD DATA...INFILE` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $FIELDS_OPTIONS = [
|
||||
'TERMINATED BY' => [
|
||||
1,
|
||||
'expr',
|
||||
],
|
||||
'OPTIONALLY' => 2,
|
||||
'ENCLOSED BY' => [
|
||||
3,
|
||||
'expr',
|
||||
],
|
||||
'ESCAPED BY' => [
|
||||
4,
|
||||
'expr',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* LINES Options for `LOAD DATA...INFILE` statements.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $LINES_OPTIONS = [
|
||||
'STARTING BY' => [
|
||||
1,
|
||||
'expr',
|
||||
],
|
||||
'TERMINATED BY' => [
|
||||
2,
|
||||
'expr',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* File name being used to load data.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $file_name;
|
||||
|
||||
/**
|
||||
* Table used as destination for this statement.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $table;
|
||||
|
||||
/**
|
||||
* Partitions used as source for this statement.
|
||||
*
|
||||
* @var ArrayObj|null
|
||||
*/
|
||||
public $partition;
|
||||
|
||||
/**
|
||||
* Character set used in this statement.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $charset_name;
|
||||
|
||||
/**
|
||||
* Options for FIELDS/COLUMNS keyword.
|
||||
*
|
||||
* @see static::$FIELDS_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $fields_options;
|
||||
|
||||
/**
|
||||
* Whether to use `FIELDS` or `COLUMNS` while building.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $fields_keyword;
|
||||
|
||||
/**
|
||||
* Options for OPTIONS keyword.
|
||||
*
|
||||
* @see static::$LINES_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $lines_options;
|
||||
|
||||
/**
|
||||
* Column names or user variables.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $col_name_or_user_var;
|
||||
|
||||
/**
|
||||
* SET clause's updated values(optional).
|
||||
*
|
||||
* @var SetOperation[]|null
|
||||
*/
|
||||
public $set;
|
||||
|
||||
/**
|
||||
* Ignore 'number' LINES/ROWS.
|
||||
*
|
||||
* @var Expression|null
|
||||
*/
|
||||
public $ignore_number;
|
||||
|
||||
/**
|
||||
* REPLACE/IGNORE Keyword.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $replace_ignore;
|
||||
|
||||
/**
|
||||
* LINES/ROWS Keyword.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $lines_rows;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'LOAD DATA ' . $this->options
|
||||
. ' INFILE ' . $this->file_name;
|
||||
|
||||
if ($this->replace_ignore !== null) {
|
||||
$ret .= ' ' . trim($this->replace_ignore);
|
||||
}
|
||||
|
||||
$ret .= ' INTO TABLE ' . $this->table;
|
||||
|
||||
if ($this->partition !== null && strlen((string) $this->partition) > 0) {
|
||||
$ret .= ' PARTITION ' . ArrayObj::build($this->partition);
|
||||
}
|
||||
|
||||
if ($this->charset_name !== null) {
|
||||
$ret .= ' CHARACTER SET ' . $this->charset_name;
|
||||
}
|
||||
|
||||
if ($this->fields_keyword !== null) {
|
||||
$ret .= ' ' . $this->fields_keyword . ' ' . $this->fields_options;
|
||||
}
|
||||
|
||||
if ($this->lines_options !== null && strlen((string) $this->lines_options) > 0) {
|
||||
$ret .= ' LINES ' . $this->lines_options;
|
||||
}
|
||||
|
||||
if ($this->ignore_number !== null) {
|
||||
$ret .= ' IGNORE ' . $this->ignore_number . ' ' . $this->lines_rows;
|
||||
}
|
||||
|
||||
if ($this->col_name_or_user_var !== null && count($this->col_name_or_user_var) > 0) {
|
||||
$ret .= ' ' . ExpressionArray::build($this->col_name_or_user_var);
|
||||
}
|
||||
|
||||
if ($this->set !== null && count($this->set) > 0) {
|
||||
$ret .= ' SET ' . SetOperation::build($this->set);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `LOAD DATA`.
|
||||
|
||||
// parse any options if provided
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
++$list->idx;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'INFILE') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
$this->file_name = Expression::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['parseField' => 'file']
|
||||
);
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword === 'REPLACE' || $token->keyword === 'IGNORE') {
|
||||
$this->replace_ignore = trim($token->keyword);
|
||||
} elseif ($token->keyword === 'INTO') {
|
||||
$state = 2;
|
||||
}
|
||||
}
|
||||
} elseif ($state === 2) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD || $token->keyword !== 'TABLE') {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
$this->table = Expression::parse($parser, $list, ['parseField' => 'table']);
|
||||
$state = 3;
|
||||
} elseif ($state >= 3 && $state <= 7) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
$newState = $this->parseKeywordsAccordingToState($parser, $list, $state);
|
||||
if ($newState === $state) {
|
||||
// Avoid infinite loop
|
||||
break;
|
||||
}
|
||||
} elseif ($token->type === Token::TYPE_OPERATOR && $token->token === '(') {
|
||||
$this->col_name_or_user_var
|
||||
= ExpressionArray::parse($parser, $list);
|
||||
$state = 7;
|
||||
} else {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser The parser
|
||||
* @param TokensList $list A token list
|
||||
* @param string $keyword The keyword
|
||||
*/
|
||||
public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'FIELDS'): void
|
||||
{
|
||||
++$list->idx;
|
||||
|
||||
if ($keyword === 'FIELDS' || $keyword === 'COLUMNS') {
|
||||
// parse field options
|
||||
$this->fields_options = OptionsArray::parse($parser, $list, static::$FIELDS_OPTIONS);
|
||||
|
||||
$this->fields_keyword = $keyword;
|
||||
} else {
|
||||
// parse line options
|
||||
$this->lines_options = OptionsArray::parse($parser, $list, static::$LINES_OPTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser
|
||||
* @param TokensList $list
|
||||
* @param int $state
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function parseKeywordsAccordingToState($parser, $list, $state)
|
||||
{
|
||||
$token = $list->tokens[$list->idx];
|
||||
|
||||
switch ($state) {
|
||||
case 3:
|
||||
if ($token->keyword === 'PARTITION') {
|
||||
++$list->idx;
|
||||
$this->partition = ArrayObj::parse($parser, $list);
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
// no break
|
||||
case 4:
|
||||
if ($token->keyword === 'CHARACTER SET') {
|
||||
++$list->idx;
|
||||
$this->charset_name = Expression::parse($parser, $list);
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
// no break
|
||||
case 5:
|
||||
if ($token->keyword === 'FIELDS' || $token->keyword === 'COLUMNS' || $token->keyword === 'LINES') {
|
||||
$this->parseFileOptions($parser, $list, $token->value);
|
||||
|
||||
return 6;
|
||||
}
|
||||
|
||||
// no break
|
||||
case 6:
|
||||
if ($token->keyword === 'IGNORE') {
|
||||
++$list->idx;
|
||||
|
||||
$this->ignore_number = Expression::parse($parser, $list);
|
||||
$nextToken = $list->getNextOfType(Token::TYPE_KEYWORD);
|
||||
|
||||
if (
|
||||
$nextToken->type === Token::TYPE_KEYWORD
|
||||
&& (($nextToken->keyword === 'LINES')
|
||||
|| ($nextToken->keyword === 'ROWS'))
|
||||
) {
|
||||
$this->lines_rows = $nextToken->token;
|
||||
}
|
||||
|
||||
return 7;
|
||||
}
|
||||
|
||||
// no break
|
||||
case 7:
|
||||
if ($token->keyword === 'SET') {
|
||||
++$list->idx;
|
||||
$this->set = SetOperation::parse($parser, $list);
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
// no break
|
||||
default:
|
||||
}
|
||||
|
||||
return $state;
|
||||
}
|
||||
}
|
||||
131
pma/vendor/phpmyadmin/sql-parser/src/Statements/LockStatement.php
vendored
Normal file
131
pma/vendor/phpmyadmin/sql-parser/src/Statements/LockStatement.php
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\LockExpression;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `LOCK` statement.
|
||||
*/
|
||||
class LockStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Tables with their Lock expressions.
|
||||
*
|
||||
* @var LockExpression[]
|
||||
*/
|
||||
public $locked = [];
|
||||
|
||||
/**
|
||||
* Whether it's a LOCK statement
|
||||
* if false, it's an UNLOCK statement
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $isLock = true;
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
if ($list->tokens[$list->idx]->value === 'UNLOCK') {
|
||||
// this is in fact an UNLOCK statement
|
||||
$this->isLock = false;
|
||||
}
|
||||
|
||||
++$list->idx; // Skipping `LOCK`.
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------- [ TABLES ] -----------------> 1
|
||||
* 1 -------------- [ lock_expr ] ----------------> 2
|
||||
* 2 ------------------ [ , ] --------------------> 1
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
/**
|
||||
* Previous parsed token
|
||||
*/
|
||||
$prevToken = null;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if ($token->keyword !== 'TABLES') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state === 1) {
|
||||
if (! $this->isLock) {
|
||||
// UNLOCK statement should not have any more tokens
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->locked[] = LockExpression::parse($parser, $list);
|
||||
$state = 2;
|
||||
} elseif ($state === 2) {
|
||||
if ($token->value === ',') {
|
||||
// move over to parsing next lock expression
|
||||
$state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$prevToken = $token;
|
||||
}
|
||||
|
||||
if ($state === 2 || $prevToken === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$parser->error('Unexpected end of LOCK statement.', $prevToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return trim(($this->isLock ? 'LOCK' : 'UNLOCK')
|
||||
. ' TABLES ' . LockExpression::build($this->locked));
|
||||
}
|
||||
}
|
||||
57
pma/vendor/phpmyadmin/sql-parser/src/Statements/MaintenanceStatement.php
vendored
Normal file
57
pma/vendor/phpmyadmin/sql-parser/src/Statements/MaintenanceStatement.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* Maintenance statement.
|
||||
*
|
||||
* They follow the syntax:
|
||||
* STMT [some options] tbl_name [, tbl_name] ... [some more options]
|
||||
*/
|
||||
class MaintenanceStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Tables maintained.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $tables;
|
||||
|
||||
/**
|
||||
* Function called after the token was processed.
|
||||
*
|
||||
* Parses the additional options from the end.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
* @param Token $token the token that is being parsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function after(Parser $parser, TokensList $list, Token $token)
|
||||
{
|
||||
// [some options] is going to be parsed first.
|
||||
//
|
||||
// There is a parser specified in `Parser::$KEYWORD_PARSERS`
|
||||
// which parses the name of the tables.
|
||||
//
|
||||
// Finally, we parse here [some more options] and that's all.
|
||||
++$list->idx;
|
||||
$this->options->merge(
|
||||
OptionsArray::parse(
|
||||
$parser,
|
||||
$list,
|
||||
static::$OPTIONS
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
56
pma/vendor/phpmyadmin/sql-parser/src/Statements/NotImplementedStatement.php
vendored
Normal file
56
pma/vendor/phpmyadmin/sql-parser/src/Statements/NotImplementedStatement.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* Not implemented (yet) statements.
|
||||
*
|
||||
* The `after` function makes the parser jump straight to the first delimiter.
|
||||
*/
|
||||
class NotImplementedStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* The part of the statement that can't be parsed.
|
||||
*
|
||||
* @var Token[]
|
||||
*/
|
||||
public $unknown = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
// Building the parsed part of the query (if any).
|
||||
$query = parent::build() . ' ';
|
||||
|
||||
// Rebuilding the unknown part from tokens.
|
||||
foreach ($this->unknown as $token) {
|
||||
$query .= $token->token;
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
if ($list->tokens[$list->idx]->type === Token::TYPE_DELIMITER) {
|
||||
break;
|
||||
}
|
||||
|
||||
$this->unknown[] = $list->tokens[$list->idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
37
pma/vendor/phpmyadmin/sql-parser/src/Statements/OptimizeStatement.php
vendored
Normal file
37
pma/vendor/phpmyadmin/sql-parser/src/Statements/OptimizeStatement.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
/**
|
||||
* `OPTIMIZE` statement.
|
||||
*
|
||||
* OPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE
|
||||
* tbl_name [, tbl_name] ...
|
||||
*/
|
||||
class OptimizeStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'NO_WRITE_TO_BINLOG' => 2,
|
||||
'LOCAL' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* Optimized tables.
|
||||
*
|
||||
* @var Expression[]|null
|
||||
*/
|
||||
public $tables;
|
||||
}
|
||||
145
pma/vendor/phpmyadmin/sql-parser/src/Statements/PurgeStatement.php
vendored
Normal file
145
pma/vendor/phpmyadmin/sql-parser/src/Statements/PurgeStatement.php
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function in_array;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `PURGE` statement.
|
||||
*
|
||||
* PURGE { BINARY | MASTER } LOGS
|
||||
* { TO 'log_name' | BEFORE datetime_expr }
|
||||
*/
|
||||
class PurgeStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* The type of logs
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $log_type;
|
||||
|
||||
/**
|
||||
* The end option of this query.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $end_option;
|
||||
|
||||
/**
|
||||
* The end expr of this query.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $end_expr;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'PURGE ' . $this->log_type . ' LOGS '
|
||||
. ($this->end_option !== null ? ($this->end_option . ' ' . $this->end_expr) : '');
|
||||
|
||||
return trim($ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `PURGE`.
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
$prevToken = null;
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
switch ($state) {
|
||||
case 0:
|
||||
// parse `{ BINARY | MASTER }`
|
||||
$this->log_type = self::parseExpectedKeyword($parser, $token, ['BINARY', 'MASTER']);
|
||||
break;
|
||||
case 1:
|
||||
// parse `LOGS`
|
||||
self::parseExpectedKeyword($parser, $token, ['LOGS']);
|
||||
break;
|
||||
case 2:
|
||||
// parse `{ TO | BEFORE }`
|
||||
$this->end_option = self::parseExpectedKeyword($parser, $token, ['TO', 'BEFORE']);
|
||||
break;
|
||||
case 3:
|
||||
// parse `expr`
|
||||
$this->end_expr = Expression::parse($parser, $list, []);
|
||||
break;
|
||||
default:
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$state++;
|
||||
$prevToken = $token;
|
||||
}
|
||||
|
||||
// Only one possible end state
|
||||
if ($state === 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
$parser->error('Unexpected token.', $prevToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse expected keyword (or throw relevant error)
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param Token $token token to be parsed
|
||||
* @param string[] $expectedKeywords array of possibly expected keywords at this point
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
private static function parseExpectedKeyword($parser, $token, $expectedKeywords)
|
||||
{
|
||||
if ($token->type === Token::TYPE_KEYWORD) {
|
||||
if (in_array($token->keyword, $expectedKeywords)) {
|
||||
return $token->keyword;
|
||||
}
|
||||
|
||||
$parser->error('Unexpected keyword', $token);
|
||||
} else {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
56
pma/vendor/phpmyadmin/sql-parser/src/Statements/RenameStatement.php
vendored
Normal file
56
pma/vendor/phpmyadmin/sql-parser/src/Statements/RenameStatement.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\RenameOperation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
/**
|
||||
* `RENAME` statement.
|
||||
*
|
||||
* RENAME TABLE tbl_name TO new_tbl_name
|
||||
* [, tbl_name2 TO new_tbl_name2] ...
|
||||
*/
|
||||
class RenameStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* The old and new names of the tables.
|
||||
*
|
||||
* @var RenameOperation[]|null
|
||||
*/
|
||||
public $renames;
|
||||
|
||||
/**
|
||||
* Function called before the token is processed.
|
||||
*
|
||||
* Skips the `TABLE` keyword after `RENAME`.
|
||||
*
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
* @param Token $token the token that is being parsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function before(Parser $parser, TokensList $list, Token $token)
|
||||
{
|
||||
if (($token->type !== Token::TYPE_KEYWORD) || ($token->keyword !== 'RENAME')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Checking if it is the beginning of the query.
|
||||
$list->getNextOfTypeAndValue(Token::TYPE_KEYWORD, 'TABLE');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return 'RENAME TABLE ' . RenameOperation::build($this->renames);
|
||||
}
|
||||
}
|
||||
32
pma/vendor/phpmyadmin/sql-parser/src/Statements/RepairStatement.php
vendored
Normal file
32
pma/vendor/phpmyadmin/sql-parser/src/Statements/RepairStatement.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
/**
|
||||
* `REPAIR` statement.
|
||||
*
|
||||
* REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE
|
||||
* tbl_name [, tbl_name] ...
|
||||
* [QUICK] [EXTENDED] [USE_FRM]
|
||||
*/
|
||||
class RepairStatement extends MaintenanceStatement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'NO_WRITE_TO_BINLOG' => 2,
|
||||
'LOCAL' => 3,
|
||||
|
||||
'QUICK' => 4,
|
||||
'EXTENDED' => 5,
|
||||
'USE_FRM' => 6,
|
||||
];
|
||||
}
|
||||
188
pma/vendor/phpmyadmin/sql-parser/src/Statements/ReplaceStatement.php
vendored
Normal file
188
pma/vendor/phpmyadmin/sql-parser/src/Statements/ReplaceStatement.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\Array2d;
|
||||
use PhpMyAdmin\SqlParser\Components\IntoKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\SetOperation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
use PhpMyAdmin\SqlParser\Token;
|
||||
use PhpMyAdmin\SqlParser\TokensList;
|
||||
|
||||
use function count;
|
||||
use function strlen;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `REPLACE` statement.
|
||||
*
|
||||
* REPLACE [LOW_PRIORITY | DELAYED]
|
||||
* [INTO] tbl_name [(col_name,...)]
|
||||
* {VALUES | VALUE} ({expr | DEFAULT},...),(...),...
|
||||
*
|
||||
* or
|
||||
*
|
||||
* REPLACE [LOW_PRIORITY | DELAYED]
|
||||
* [INTO] tbl_name
|
||||
* SET col_name={expr | DEFAULT}, ...
|
||||
*
|
||||
* or
|
||||
*
|
||||
* REPLACE [LOW_PRIORITY | DELAYED]
|
||||
* [INTO] tbl_name
|
||||
* [PARTITION (partition_name,...)]
|
||||
* [(col_name,...)]
|
||||
* SELECT ...
|
||||
*/
|
||||
class ReplaceStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `REPLACE` statements and their slot ID.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'LOW_PRIORITY' => 1,
|
||||
'DELAYED' => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* Tables used as target for this statement.
|
||||
*
|
||||
* @var IntoKeyword|null
|
||||
*/
|
||||
public $into;
|
||||
|
||||
/**
|
||||
* Values to be replaced.
|
||||
*
|
||||
* @var Array2d|null
|
||||
*/
|
||||
public $values;
|
||||
|
||||
/**
|
||||
* If SET clause is present
|
||||
* holds the SetOperation.
|
||||
*
|
||||
* @var SetOperation[]|null
|
||||
*/
|
||||
public $set;
|
||||
|
||||
/**
|
||||
* If SELECT clause is present
|
||||
* holds the SelectStatement.
|
||||
*
|
||||
* @var SelectStatement|null
|
||||
*/
|
||||
public $select;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'REPLACE ' . $this->options;
|
||||
$ret = trim($ret) . ' INTO ' . $this->into;
|
||||
|
||||
if ($this->values !== null && count($this->values) > 0) {
|
||||
$ret .= ' VALUES ' . Array2d::build($this->values);
|
||||
} elseif ($this->set !== null && count($this->set) > 0) {
|
||||
$ret .= ' SET ' . SetOperation::build($this->set);
|
||||
} elseif ($this->select !== null && strlen((string) $this->select) > 0) {
|
||||
$ret .= ' ' . $this->select->build();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Parser $parser the instance that requests parsing
|
||||
* @param TokensList $list the list of tokens to be parsed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function parse(Parser $parser, TokensList $list)
|
||||
{
|
||||
++$list->idx; // Skipping `REPLACE`.
|
||||
|
||||
// parse any options if provided
|
||||
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
|
||||
|
||||
++$list->idx;
|
||||
|
||||
/**
|
||||
* The state of the parser.
|
||||
*
|
||||
* Below are the states of the parser.
|
||||
*
|
||||
* 0 ---------------------------------[ INTO ]----------------------------------> 1
|
||||
*
|
||||
* 1 -------------------------[ VALUES/VALUE/SET/SELECT ]-----------------------> 2
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
$state = 0;
|
||||
|
||||
for (; $list->idx < $list->count; ++$list->idx) {
|
||||
/**
|
||||
* Token parsed at this moment.
|
||||
*/
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($state === 0) {
|
||||
if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'INTO') {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
++$list->idx;
|
||||
$this->into = IntoKeyword::parse(
|
||||
$parser,
|
||||
$list,
|
||||
['fromReplace' => true]
|
||||
);
|
||||
|
||||
$state = 1;
|
||||
} elseif ($state === 1) {
|
||||
if ($token->type !== Token::TYPE_KEYWORD) {
|
||||
$parser->error('Unexpected token.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token->keyword === 'VALUE' || $token->keyword === 'VALUES') {
|
||||
++$list->idx; // skip VALUES
|
||||
|
||||
$this->values = Array2d::parse($parser, $list);
|
||||
} elseif ($token->keyword === 'SET') {
|
||||
++$list->idx; // skip SET
|
||||
|
||||
$this->set = SetOperation::parse($parser, $list);
|
||||
} elseif ($token->keyword === 'SELECT') {
|
||||
$this->select = new SelectStatement($parser, $list);
|
||||
} else {
|
||||
$parser->error('Unexpected keyword.', $token);
|
||||
break;
|
||||
}
|
||||
|
||||
$state = 2;
|
||||
}
|
||||
}
|
||||
|
||||
--$list->idx;
|
||||
}
|
||||
}
|
||||
28
pma/vendor/phpmyadmin/sql-parser/src/Statements/RestoreStatement.php
vendored
Normal file
28
pma/vendor/phpmyadmin/sql-parser/src/Statements/RestoreStatement.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
/**
|
||||
* `RESTORE` statement.
|
||||
*
|
||||
* RESTORE TABLE tbl_name [, tbl_name] ... FROM '/path/to/backup/directory'
|
||||
*/
|
||||
class RestoreStatement extends MaintenanceStatement
|
||||
{
|
||||
/**
|
||||
* Options of this statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'TABLE' => 1,
|
||||
|
||||
'FROM' => [
|
||||
2,
|
||||
'var',
|
||||
],
|
||||
];
|
||||
}
|
||||
353
pma/vendor/phpmyadmin/sql-parser/src/Statements/SelectStatement.php
vendored
Normal file
353
pma/vendor/phpmyadmin/sql-parser/src/Statements/SelectStatement.php
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\ArrayObj;
|
||||
use PhpMyAdmin\SqlParser\Components\Condition;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\FunctionCall;
|
||||
use PhpMyAdmin\SqlParser\Components\GroupKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\IndexHint;
|
||||
use PhpMyAdmin\SqlParser\Components\IntoKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\JoinKeyword;
|
||||
use PhpMyAdmin\SqlParser\Components\Limit;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\OrderKeyword;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
/**
|
||||
* `SELECT` statement.
|
||||
*
|
||||
* SELECT
|
||||
* [ALL | DISTINCT | DISTINCTROW ]
|
||||
* [HIGH_PRIORITY]
|
||||
* [MAX_STATEMENT_TIME = N]
|
||||
* [STRAIGHT_JOIN]
|
||||
* [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
|
||||
* [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
|
||||
* select_expr [, select_expr ...]
|
||||
* [FROM table_references
|
||||
* [PARTITION partition_list]
|
||||
* [WHERE where_condition]
|
||||
* [GROUP BY {col_name | expr | position}
|
||||
* [ASC | DESC], ... [WITH ROLLUP]]
|
||||
* [HAVING where_condition]
|
||||
* [ORDER BY {col_name | expr | position}
|
||||
* [ASC | DESC], ...]
|
||||
* [LIMIT {[offset,] row_count | row_count OFFSET offset}]
|
||||
* [PROCEDURE procedure_name(argument_list)]
|
||||
* [INTO OUTFILE 'file_name'
|
||||
* [CHARACTER SET charset_name]
|
||||
* export_options
|
||||
* | INTO DUMPFILE 'file_name'
|
||||
* | INTO var_name [, var_name]]
|
||||
* [FOR UPDATE | LOCK IN SHARE MODE]]
|
||||
*/
|
||||
class SelectStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* Options for `SELECT` statements and their slot ID.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'ALL' => 1,
|
||||
'DISTINCT' => 1,
|
||||
'DISTINCTROW' => 1,
|
||||
'HIGH_PRIORITY' => 2,
|
||||
'MAX_STATEMENT_TIME' => [
|
||||
3,
|
||||
'var=',
|
||||
],
|
||||
'STRAIGHT_JOIN' => 4,
|
||||
'SQL_SMALL_RESULT' => 5,
|
||||
'SQL_BIG_RESULT' => 6,
|
||||
'SQL_BUFFER_RESULT' => 7,
|
||||
'SQL_CACHE' => 8,
|
||||
'SQL_NO_CACHE' => 8,
|
||||
'SQL_CALC_FOUND_ROWS' => 9,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $END_OPTIONS = [
|
||||
'FOR UPDATE' => 1,
|
||||
'LOCK IN SHARE MODE' => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* The clauses of this statement, in order.
|
||||
*
|
||||
* @see Statement::$CLAUSES
|
||||
*
|
||||
* @var array<string, array<int, int|string>>
|
||||
* @psalm-var array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public static $CLAUSES = [
|
||||
'SELECT' => [
|
||||
'SELECT',
|
||||
2,
|
||||
],
|
||||
// Used for options.
|
||||
'_OPTIONS' => [
|
||||
'_OPTIONS',
|
||||
1,
|
||||
],
|
||||
// Used for selected expressions.
|
||||
'_SELECT' => [
|
||||
'SELECT',
|
||||
1,
|
||||
],
|
||||
'INTO' => [
|
||||
'INTO',
|
||||
3,
|
||||
],
|
||||
'FROM' => [
|
||||
'FROM',
|
||||
3,
|
||||
],
|
||||
'FORCE' => [
|
||||
'FORCE',
|
||||
1,
|
||||
],
|
||||
'USE' => [
|
||||
'USE',
|
||||
1,
|
||||
],
|
||||
'IGNORE' => [
|
||||
'IGNORE',
|
||||
3,
|
||||
],
|
||||
'PARTITION' => [
|
||||
'PARTITION',
|
||||
3,
|
||||
],
|
||||
|
||||
'JOIN' => [
|
||||
'JOIN',
|
||||
1,
|
||||
],
|
||||
'FULL JOIN' => [
|
||||
'FULL JOIN',
|
||||
1,
|
||||
],
|
||||
'INNER JOIN' => [
|
||||
'INNER JOIN',
|
||||
1,
|
||||
],
|
||||
'LEFT JOIN' => [
|
||||
'LEFT JOIN',
|
||||
1,
|
||||
],
|
||||
'LEFT OUTER JOIN' => [
|
||||
'LEFT OUTER JOIN',
|
||||
1,
|
||||
],
|
||||
'RIGHT JOIN' => [
|
||||
'RIGHT JOIN',
|
||||
1,
|
||||
],
|
||||
'RIGHT OUTER JOIN' => [
|
||||
'RIGHT OUTER JOIN',
|
||||
1,
|
||||
],
|
||||
'NATURAL JOIN' => [
|
||||
'NATURAL JOIN',
|
||||
1,
|
||||
],
|
||||
'NATURAL LEFT JOIN' => [
|
||||
'NATURAL LEFT JOIN',
|
||||
1,
|
||||
],
|
||||
'NATURAL RIGHT JOIN' => [
|
||||
'NATURAL RIGHT JOIN',
|
||||
1,
|
||||
],
|
||||
'NATURAL LEFT OUTER JOIN' => [
|
||||
'NATURAL LEFT OUTER JOIN',
|
||||
1,
|
||||
],
|
||||
'NATURAL RIGHT OUTER JOIN' => [
|
||||
'NATURAL RIGHT JOIN',
|
||||
1,
|
||||
],
|
||||
|
||||
'WHERE' => [
|
||||
'WHERE',
|
||||
3,
|
||||
],
|
||||
'GROUP BY' => [
|
||||
'GROUP BY',
|
||||
3,
|
||||
],
|
||||
'HAVING' => [
|
||||
'HAVING',
|
||||
3,
|
||||
],
|
||||
'ORDER BY' => [
|
||||
'ORDER BY',
|
||||
3,
|
||||
],
|
||||
'LIMIT' => [
|
||||
'LIMIT',
|
||||
3,
|
||||
],
|
||||
'PROCEDURE' => [
|
||||
'PROCEDURE',
|
||||
3,
|
||||
],
|
||||
'UNION' => [
|
||||
'UNION',
|
||||
1,
|
||||
],
|
||||
'EXCEPT' => [
|
||||
'EXCEPT',
|
||||
1,
|
||||
],
|
||||
'INTERSECT' => [
|
||||
'INTERSECT',
|
||||
1,
|
||||
],
|
||||
'_END_OPTIONS' => [
|
||||
'_END_OPTIONS',
|
||||
1,
|
||||
],
|
||||
// These are available only when `UNION` is present.
|
||||
// 'ORDER BY' => ['ORDER BY', 3],
|
||||
// 'LIMIT' => ['LIMIT', 3],
|
||||
];
|
||||
|
||||
/**
|
||||
* Expressions that are being selected by this statement.
|
||||
*
|
||||
* @var Expression[]
|
||||
*/
|
||||
public $expr = [];
|
||||
|
||||
/**
|
||||
* Tables used as sources for this statement.
|
||||
*
|
||||
* @var Expression[]
|
||||
*/
|
||||
public $from = [];
|
||||
|
||||
/**
|
||||
* Index hints
|
||||
*
|
||||
* @var IndexHint[]|null
|
||||
*/
|
||||
public $index_hints;
|
||||
|
||||
/**
|
||||
* Partitions used as source for this statement.
|
||||
*
|
||||
* @var ArrayObj|null
|
||||
*/
|
||||
public $partition;
|
||||
|
||||
/**
|
||||
* Conditions used for filtering each row of the result set.
|
||||
*
|
||||
* @var Condition[]|null
|
||||
*/
|
||||
public $where;
|
||||
|
||||
/**
|
||||
* Conditions used for grouping the result set.
|
||||
*
|
||||
* @var GroupKeyword[]|null
|
||||
*/
|
||||
public $group;
|
||||
|
||||
/**
|
||||
* Conditions used for filtering the result set.
|
||||
*
|
||||
* @var Condition[]|null
|
||||
*/
|
||||
public $having;
|
||||
|
||||
/**
|
||||
* Specifies the order of the rows in the result set.
|
||||
*
|
||||
* @var OrderKeyword[]|null
|
||||
*/
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* Conditions used for limiting the size of the result set.
|
||||
*
|
||||
* @var Limit|null
|
||||
*/
|
||||
public $limit;
|
||||
|
||||
/**
|
||||
* Procedure that should process the data in the result set.
|
||||
*
|
||||
* @var FunctionCall|null
|
||||
*/
|
||||
public $procedure;
|
||||
|
||||
/**
|
||||
* Destination of this result set.
|
||||
*
|
||||
* @var IntoKeyword|null
|
||||
*/
|
||||
public $into;
|
||||
|
||||
/**
|
||||
* Joins.
|
||||
*
|
||||
* @var JoinKeyword[]|null
|
||||
*/
|
||||
public $join;
|
||||
|
||||
/**
|
||||
* Unions.
|
||||
*
|
||||
* @var SelectStatement[]
|
||||
*/
|
||||
public $union = [];
|
||||
|
||||
/**
|
||||
* The end options of this query.
|
||||
*
|
||||
* @see static::$END_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $end_options;
|
||||
|
||||
/**
|
||||
* Gets the clauses of this statement.
|
||||
*
|
||||
* @return array<string, array<int, int|string>>
|
||||
* @psalm-return array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public function getClauses()
|
||||
{
|
||||
// This is a cheap fix for `SELECT` statements that contain `UNION`.
|
||||
// The `ORDER BY` and `LIMIT` clauses should be at the end of the
|
||||
// statement.
|
||||
if (! empty($this->union)) {
|
||||
$clauses = static::$CLAUSES;
|
||||
unset($clauses['ORDER BY'], $clauses['LIMIT']);
|
||||
$clauses['ORDER BY'] = [
|
||||
'ORDER BY',
|
||||
3,
|
||||
];
|
||||
$clauses['LIMIT'] = [
|
||||
'LIMIT',
|
||||
3,
|
||||
];
|
||||
|
||||
return $clauses;
|
||||
}
|
||||
|
||||
return static::$CLAUSES;
|
||||
}
|
||||
}
|
||||
116
pma/vendor/phpmyadmin/sql-parser/src/Statements/SetStatement.php
vendored
Normal file
116
pma/vendor/phpmyadmin/sql-parser/src/Statements/SetStatement.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\SqlParser\Statements;
|
||||
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Components\SetOperation;
|
||||
use PhpMyAdmin\SqlParser\Statement;
|
||||
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
* `SET` statement.
|
||||
*/
|
||||
class SetStatement extends Statement
|
||||
{
|
||||
/**
|
||||
* The clauses of this statement, in order.
|
||||
*
|
||||
* @see Statement::$CLAUSES
|
||||
*
|
||||
* @var array<string, array<int, int|string>>
|
||||
* @psalm-var array<string, array{non-empty-string, (1|2|3)}>
|
||||
*/
|
||||
public static $CLAUSES = [
|
||||
'SET' => [
|
||||
'SET',
|
||||
3,
|
||||
],
|
||||
'_END_OPTIONS' => [
|
||||
'_END_OPTIONS',
|
||||
1,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Possible exceptions in SET statement.
|
||||
*
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $OPTIONS = [
|
||||
'CHARSET' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'CHARACTER SET' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'NAMES' => [
|
||||
3,
|
||||
'var',
|
||||
],
|
||||
'PASSWORD' => [
|
||||
3,
|
||||
'expr',
|
||||
],
|
||||
'SESSION' => 3,
|
||||
'GLOBAL' => 3,
|
||||
'PERSIST' => 3,
|
||||
'PERSIST_ONLY' => 3,
|
||||
'@@SESSION' => 3,
|
||||
'@@GLOBAL' => 3,
|
||||
'@@PERSIST' => 3,
|
||||
'@@PERSIST_ONLY' => 3,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<string, int|array<int, int|string>>
|
||||
* @psalm-var array<string, (positive-int|array{positive-int, ('var'|'var='|'expr'|'expr=')})>
|
||||
*/
|
||||
public static $END_OPTIONS = [
|
||||
'COLLATE' => [
|
||||
1,
|
||||
'var',
|
||||
],
|
||||
'DEFAULT' => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* Options used in current statement.
|
||||
*
|
||||
* @var OptionsArray[]|null
|
||||
*/
|
||||
public $options;
|
||||
|
||||
/**
|
||||
* The end options of this query.
|
||||
*
|
||||
* @see static::$END_OPTIONS
|
||||
*
|
||||
* @var OptionsArray|null
|
||||
*/
|
||||
public $end_options;
|
||||
|
||||
/**
|
||||
* The updated values.
|
||||
*
|
||||
* @var SetOperation[]|null
|
||||
*/
|
||||
public $set;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$ret = 'SET ' . OptionsArray::build($this->options)
|
||||
. ' ' . SetOperation::build($this->set)
|
||||
. ' ' . OptionsArray::build($this->end_options);
|
||||
|
||||
return trim($ret);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user