Server IP : 213.176.29.180 / Your IP : 18.217.14.208 Web Server : Apache System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : webtaragh ( 1001) PHP Version : 8.3.14 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/webtaragh/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
sql-parser/CONTRIBUTING.md 0000644 00000002203 14736103337 0011072 0 ustar 00 # Contributing to SQL Parser ## Reporting issues Our issue tracker is hosted at GitHub: https://github.com/phpmyadmin/sql-parser/issues Please search for existing issues before reporting new ones. ## Working with Git checkout The dependencies are managed by Composer, to get them all installed (or update on consequent runs) do: ``` composer update ``` ## Submitting patches Please submit your patches using GitHub pull requests, this allows us to review them and to run automated tests on the code. ## Coding standards We do follow PSR-1 and PSR-2 coding standards. You can use phpcbf to fix the code to match our expectations: ``` ./vendor/bin/phpcbf ``` ## Testsuite Our code comes with quite comprehensive testsuite, it is automatically executed on every commit and pull request, you can also run it locally: ``` ./vendor/bin/phpunit ``` The testsuite relies on fixtures of parser states, in case you need to regenerate some of these there are helper scripts in tools directory: ``` # Remove file you want to regenerate rm tests/data/parser/parse.out # Run the generator located in the tools directory ./tools/run_generators.sh ``` sql-parser/LICENSE.txt 0000644 00000043254 14736103337 0010477 0 ustar 00 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. sql-parser/tools/TestGenerator.php 0000644 00000016513 14736103337 0013311 0 ustar 00 <?php declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tools; use Exception; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use function count; use function file_exists; use function file_get_contents; use function file_put_contents; use function in_array; use function is_dir; use function mkdir; use function print_r; use function rtrim; use function scandir; use function serialize; use function sprintf; use function strpos; use function substr; require_once '../vendor/autoload.php'; /** * Used for test generation. */ class TestGenerator { /** * Generates a test's data. * * @param string $query the query to be analyzed * @param string $type test's type (may be `lexer` or `parser`) * * @return array */ public static function generate($query, $type = 'parser') { /** * Lexer used for tokenizing the query. * * @var Lexer */ $lexer = new Lexer($query); /** * Parsed used for analyzing the query. * A new instance of parser is generated only if the test requires. * * @var Parser */ $parser = $type === 'parser' ? new Parser($lexer->list) : null; /** * Lexer's errors. * * @var array */ $lexerErrors = []; /** * Parser's errors. * * @var array */ $parserErrors = []; // Both the lexer and the parser construct exception for errors. // Usually, exceptions contain a full stack trace and other details that // are not required. // The code below extracts only the relevant information. // Extracting lexer's errors. if (! empty($lexer->errors)) { foreach ($lexer->errors as $err) { $lexerErrors[] = [ $err->getMessage(), $err->ch, $err->pos, $err->getCode(), ]; } $lexer->errors = []; } // Extracting parser's errors. if (! empty($parser->errors)) { foreach ($parser->errors as $err) { $parserErrors[] = [ $err->getMessage(), $err->token, $err->getCode(), ]; } $parser->errors = []; } return [ 'query' => $query, 'lexer' => $lexer, 'parser' => $parser, 'errors' => [ 'lexer' => $lexerErrors, 'parser' => $parserErrors, ], ]; } /** * Builds a test. * * Reads the input file, generates the data and writes it back. * * @param string $type the type of this test * @param string $input the input file * @param string $output the output file * @param string $debug the debug file * @param bool $ansi activate quotes ANSI mode */ public static function build($type, $input, $output, $debug = null, $ansi = false) { // Support query types: `lexer` / `parser`. if (! in_array($type, ['lexer', 'parser'])) { throw new Exception('Unknown test type (expected `lexer` or `parser`).'); } /** * The query that is used to generate the test. * * @var string */ $query = file_get_contents($input); // There is no point in generating a test without a query. if (empty($query)) { throw new Exception('No input query specified.'); } if ($ansi === true) { // set ANSI_QUOTES for ansi tests Context::setMode('ANSI_QUOTES'); } $test = static::generate($query, $type); // unset mode, reset to default every time, to be sure Context::setMode(); // Writing test's data. file_put_contents($output, serialize($test)); // Dumping test's data in human readable format too (if required). if (! empty($debug)) { file_put_contents($debug, print_r($test, true)); } } /** * Generates recursively all tests preserving the directory structure. * * @param string $input the input directory * @param string $output the output directory * @param null|mixed $debug */ public static function buildAll($input, $output, $debug = null) { $files = scandir($input); foreach ($files as $file) { // Skipping current and parent directories. if (($file === '.') || ($file === '..')) { continue; } // Appending the filename to directories. $inputFile = $input . '/' . $file; $outputFile = $output . '/' . $file; $debugFile = $debug !== null ? $debug . '/' . $file : null; if (is_dir($inputFile)) { // Creating required directories to maintain the structure. // Ignoring errors if the folder structure exists already. if (! is_dir($outputFile)) { mkdir($outputFile); } if (($debug !== null) && (! is_dir($debugFile))) { mkdir($debugFile); } // Generating tests recursively. static::buildAll($inputFile, $outputFile, $debugFile); } elseif (substr($inputFile, -3) === '.in') { // Generating file names by replacing `.in` with `.out` and // `.debug`. $outputFile = substr($outputFile, 0, -3) . '.out'; if ($debug !== null) { $debugFile = substr($debugFile, 0, -3) . '.debug'; } // Building the test. if (! file_exists($outputFile)) { sprintf("Building test for %s...\n", $inputFile); static::build( strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser', $inputFile, $outputFile, $debugFile, strpos($inputFile, 'ansi') !== false ); } else { sprintf("Test for %s already built!\n", $inputFile); } } } } } // Test generator. // // Example of usage: // // php TestGenerator.php ../tests/data ../tests/data // // Input data must be in the `../tests/data` folder. // The output will be generated in the same `../tests/data` folder. if (count($argv) >= 3) { // Extracting directories' name from command line and trimming unnecessary // slashes at the end. $input = rtrim($argv[1], '/'); $output = rtrim($argv[2], '/'); $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); // Checking if all directories are valid. if (! is_dir($input)) { throw new Exception('The input directory does not exist.'); } elseif (! is_dir($output)) { throw new Exception('The output directory does not exist.'); } elseif (($debug !== null) && (! is_dir($debug))) { throw new Exception('The debug directory does not exist.'); } // Finally, building the tests. TestGenerator::buildAll($input, $output, $debug); } sql-parser/tools/run_generators.sh 0000644 00000000373 14736103337 0013400 0 ustar 00 #!/bin/bash export LC_ALL=C # # Runs the test and context generators. # BASE="$(dirname $0)" echo "Using base dir: $BASE" cd $BASE php ContextGenerator.php contexts/ ../src/Contexts php TestGenerator.php ../tests/data ../tests/data echo "Done." sql-parser/tools/update-po 0000644 00000002771 14736103337 0011634 0 ustar 00 #!/bin/sh # vim: expandtab sw=4 ts=4 sts=4: export LC_ALL=C # Exit on failure set -e # Update pot (template), ensure that advisor is at the end LOCS=`ls locale/*/LC_MESSAGES/sqlparser.po | sed 's@.*locale/\(.*\)/LC_MESSAGES/sqlparser\.po@\1@'` xgettext \ -d sqlparser \ --msgid-bugs-address=translators@phpmyadmin.net \ -o locale/sqlparser.pot \ --language=PHP \ --add-comments=l10n \ --add-location \ --debug \ --from-code=utf-8 \ --keyword=gettext --keyword=error \ --copyright-holder="phpMyAdmin devel team" \ `find -name '*.php' -not -path './tests/*' -not -path './locale/*' -not -path './build/*' -not -path './vendor/*' | sort --dictionary-order --ignore-case` ver=5 sed -i ' s/SOME DESCRIPTIVE TITLE/phpMyAdmin SQL parser translation/; s/PACKAGE/SQL parser/; s/(C) YEAR/(C) 2015 - '`date +%Y`'/; s/VERSION/'$ver'/; ' locale/sqlparser.pot # Update po files (translations) for loc in $LOCS ; do sed -i ' s/SOME DESCRIPTIVE TITLE/phpMyAdmin SQL parser translation/; s/PACKAGE/SQL parser/; s/(C) YEAR/(C) 2015 - '`date +%Y`'/; s/VERSION/'$ver'/; s/Project-Id-Version: \(phpMyAdmin\|SQL parser\) .*/Project-Id-Version: SQL parser '$ver'\\n"/; ' locale/$loc/LC_MESSAGES/sqlparser.po msgmerge --previous -U locale/$loc/LC_MESSAGES/sqlparser.po locale/sqlparser.pot done # Generate mo files as well ./tools/generate-mo # Commit changes git add locale git commit -s -m 'Update translations [CI skip]' sql-parser/tools/generate-mo 0000644 00000001032 14736103337 0012126 0 ustar 00 #!/bin/sh if [ x$1 = x--quiet ] ; then stats="" shift else stats="--statistics" fi compile() { if [ ! -z "$stats" ] ; then echo -n "$1: " fi msgfmt $stats --check -o ${1%.po}.mo $1 return $? } if [ ! -z "$1" ] ; then compile po/$1.po exit $? fi result=0 for x in locale/*/LC_MESSAGES/sqlparser.po ; do compile $x ret=$? if [ $ret != 0 ] ; then tput setf 4 >&2 echo Error when compiling $x >&2 tput sgr0 >&2 result=$ret fi done exit $result sql-parser/tools/sami-config.php 0000644 00000001116 14736103337 0012710 0 ustar 00 <?php /** * This file has been generated by phpmyadmin/scripts:/develdocs/build.sh * @see https://github.com/phpmyadmin/scripts/blob/master/develdocs/sami.php * @see https://github.com/phpmyadmin/scripts/blob/master/develdocs/build.sh */ use Sami\Sami; use Symfony\Component\Finder\Finder; $iterator = Finder::create() ->files() ->name("*.php") ->in("./src") ; return new Sami($iterator, [ "title" => "A validating SQL lexer and parser with a focus on MySQL dialect.", "build_dir" => "./doc/", "cache_dir" => "./tmp" ]); sql-parser/tools/contexts/_functionsMariaDb100200.txt 0000644 00000014114 14736103337 0016447 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) ANY_VALUE (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) ConvexHull (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) Distance (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) JSON_ARRAY (F) JSON_ARRAY_APPEND (F) JSON_ARRAY_INSERT (F) JSON_CONTAINS (F) JSON_CONTAINS_PATH (F) JSON_DEPTH (F) JSON_EXTRACT (F) JSON_INSERT (F) JSON_KEYS (F) JSON_LENGTH (F) JSON_MERGE (F) JSON_MERGE_PATCH (F) JSON_MERGE_PRESERVE (F) JSON_OBJECT (F) JSON_PRETTY (F) JSON_QUOTE (F) JSON_REMOVE (F) JSON_REPLACE (F) JSON_SEARCH (F) JSON_SET (F) JSON_STORAGE_FREE (F) JSON_STORAGE_SIZE (F) JSON_TYPE (F) JSON_UNQUOTE (F) JSON_VALID (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRCoveredBy (F) MBRCovers (F) MBRDisjoint (F) MBREqual (F) MBREquals (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_ALL_LOCKS (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsGeoJSON (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Buffer_Strategy (F) ST_Centroid (F) ST_Contains (F) ST_ConvexHull (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_Distance_Sphere (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeoHash (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromGeoJSON (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_IsValid (F) ST_LatFromGeoHash (F) ST_Length (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_LongFromGeoHash (F) ST_MakeEnvelope (F) ST_MLineFromText (F) ST_MLineFromWKB (F) ST_MPointFromText (F) ST_MPointFromWKB (F) ST_MPolyFromText (F) ST_MPolyFromWKB (F) ST_MultiLineStringFromText (F) ST_MultiLineStringFromWKB (F) ST_MultiPointFromText (F) ST_MultiPointFromWKB (F) ST_MultiPolygonFromText (F) ST_MultiPolygonFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromGeoHash (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_Simplify (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Validate (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_FOR_EXECUTED_GTID_SET (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/MySql50700.txt 0000644 00000014460 14736103337 0014062 0 ustar 00 ACCESSIBLE (R) ACCOUNT ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ALWAYS ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHANNEL CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED COMPRESSION CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FILE_BLOCK_SIZE FILTER FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOLLOWS FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GENERATED (R) GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) GROUP_REPLICATION HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_STATEMENT_TIME MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEVER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONBLOCKING NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONLY OPEN OPTIMIZE (R) OPTIMIZER_COSTS (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSE_GCOL_EXPR PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECEDES PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATE_DO_DB REPLICATE_DO_TABLE REPLICATE_IGNORE_DB REPLICATE_IGNORE_TABLE REPLICATE_REWRITE_DB REPLICATE_WILD_DO_TABLE REPLICATE_WILD_IGNORE_TABLE REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) STACKED START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STORED (R) STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALIDATION VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW VIRTUAL (R) WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WITHOUT WORK WRAPPER WRITE (R) X509 XA XID XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MariaDb100100.txt 0000644 00000014460 14736103337 0014362 0 ustar 00 ACCESSIBLE (R) ACCOUNT ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ALWAYS ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHANNEL CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED COMPRESSION CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FILE_BLOCK_SIZE FILTER FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOLLOWS FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GENERATED (R) GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) GROUP_REPLICATION HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_STATEMENT_TIME MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEVER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONBLOCKING NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONLY OPEN OPTIMIZE (R) OPTIMIZER_COSTS (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSE_GCOL_EXPR PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECEDES PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATE_DO_DB REPLICATE_DO_TABLE REPLICATE_IGNORE_DB REPLICATE_IGNORE_TABLE REPLICATE_REWRITE_DB REPLICATE_WILD_DO_TABLE REPLICATE_WILD_IGNORE_TABLE REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) STACKED START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STORED (R) STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALIDATION VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW VIRTUAL (R) WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WITHOUT WORK WRAPPER WRITE (R) X509 XA XID XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MariaDb100000.txt 0000644 00000013140 14736103337 0014353 0 ustar 00 ACCESSIBLE (R) ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTHORS AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONTRIBUTORS CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPLAIN (R) EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOR (R) FORCE (R) FOREIGN (R) FOUND FRAC_SECOND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GEOMETRY GEOMETRYCOLLECTION GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INNOBASE INNODB INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_CONNECT_RETRY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONE NOT (R) NULL (R) NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONE_SHOT OPEN OPTIMIZE (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGINS POINT POLYGON PORT PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNS REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) START STARTING (R) STARTS STATUS STOP STORAGE STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW WAIT WARNINGS WEEK WHEN (R) WHERE (R) WHILE (R) WITH (R) WORK WRAPPER WRITE (R) X509 XA XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MySql50100.txt 0000644 00000012700 14736103337 0014047 0 ustar 00 ACCESSIBLE (R) ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTHORS AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BDB BEFORE (R) BEGIN BERKELEYDB BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CHAIN CHANGE (R) CHANGED CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONTAINS CONTEXT CONTINUE (R) CONTRIBUTORS CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPLAIN (R) EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOR (R) FORCE (R) FOREIGN (R) FOUND FRAC_SECOND FROM (R) FULL FULLTEXT (R) FUNCTION GEOMETRY GEOMETRYCOLLECTION GET_FORMAT GLOBAL GOTO GRANT (R) GRANTS GROUP (R) HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INNOBASE INNODB INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LABEL LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_CONNECT_RETRY MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONE NOT (R) NULL (R) NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONE_SHOT OPEN OPTIMIZE (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PAGE_CHECKSUM PARSER PARTIAL PARTITION PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGINS POINT POLYGON PORT PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PURGE (R) QUARTER QUERY QUICK RAID0 RAID_CHUNKS RAID_CHUNKSIZE RAID_TYPE RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELEASE (R) RELOAD REMOVE RENAME (R) REORGANISE REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATION REQUIRE (R) RESET RESTORE RESTRICT (R) RESUME RETURN (R) RETURNS REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEDULER SCHEMA (R) SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNED SIMPLE SLAVE SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) START STARTING (R) STARTS STATUS STOP STORAGE STRAIGHT_JOIN (R) STRING STRIPED SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRANSACTIONAL TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW WAIT WARNINGS WEEK WHEN (R) WHERE (R) WHILE (R) WITH (R) WORK WRAPPER WRITE (R) X509 XA XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/_functionsMySql50600.txt 0000644 00000012320 14736103337 0016142 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ASYMMETRIC_DECRYPT (F) ASYMMETRIC_DERIVE (F) ASYMMETRIC_ENCRYPT (F) ASYMMETRIC_SIGN (F) ASYMMETRIC_VERIFY (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) COS (F) COT (F) COUNT (F) CRC32 (F) CREATE_ASYMMETRIC_PRIV_KEY (F) CREATE_ASYMMETRIC_PUB_KEY (F) CREATE_DH_PARAMETERS (F) CREATE_DIGEST (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRDisjoint (F) MBREqual (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQL_THREAD_WAIT_AFTER_GTIDS (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Centroid (F) ST_Contains (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/_functionsMariaDb100000.txt 0000644 00000007477 14736103337 0016463 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRDisjoint (F) MBREqual (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/MySql50500.txt 0000644 00000013133 14736103337 0014054 0 ustar 00 ACCESSIBLE (R) ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTHORS AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONTRIBUTORS CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPLAIN (R) EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOR (R) FORCE (R) FOREIGN (R) FOUND FRAC_SECOND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GEOMETRY GEOMETRYCOLLECTION GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INNOBASE INNODB INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_CONNECT_RETRY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONE NOT (R) NULL (R) NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONE_SHOT OPEN OPTIMIZE (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSER PARTIAL PARTITION PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGINS POINT POLYGON PORT PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNS REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) START STARTING (R) STARTS STATUS STOP STORAGE STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW WAIT WARNINGS WEEK WHEN (R) WHERE (R) WHILE (R) WITH (R) WORK WRAPPER WRITE (R) X509 XA XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MariaDb100200.txt 0000644 00000014503 14736103337 0014361 0 ustar 00 ACCESSIBLE (R) ACCOUNT ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ALWAYS ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHANNEL CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED COMPRESSION CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FILE_BLOCK_SIZE FILTER FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOLLOWS FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GENERATED (R) GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) GROUP_REPLICATION HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_STATEMENT_TIME MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEVER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONBLOCKING NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONLY OPEN OPTIMIZE (R) OPTIMIZER_COSTS (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSE_GCOL_EXPR PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECEDES PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER RECURSIVE (R) REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATE_DO_DB REPLICATE_DO_TABLE REPLICATE_IGNORE_DB REPLICATE_IGNORE_TABLE REPLICATE_REWRITE_DB REPLICATE_WILD_DO_TABLE REPLICATE_WILD_IGNORE_TABLE REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS (R) RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) STACKED START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STORED (R) STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALIDATION VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW VIRTUAL (R) WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WITHOUT WORK WRAPPER WRITE (R) X509 XA XID XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MariaDb100300.txt 0000644 00000014545 14736103337 0014370 0 ustar 00 ACCESSIBLE (R) ACCOUNT ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ALWAYS ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHANNEL CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED COMPRESSION CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCEPT (R) EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FILE_BLOCK_SIZE FILTER FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOLLOWS FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GENERATED (R) GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) GROUP_REPLICATION HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERSECT (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_STATEMENT_TIME MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEVER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONBLOCKING NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONLY OPEN OPTIMIZE (R) OPTIMIZER_COSTS (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSE_GCOL_EXPR PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECEDES PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER RECURSIVE (R) REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATE_DO_DB REPLICATE_DO_TABLE REPLICATE_IGNORE_DB REPLICATE_IGNORE_TABLE REPLICATE_REWRITE_DB REPLICATE_WILD_DO_TABLE REPLICATE_WILD_IGNORE_TABLE REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS (R) RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SEQUENCE SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) STACKED START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STORED (R) STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALIDATION VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW VIRTUAL (R) WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WITHOUT WORK WRAPPER WRITE (R) X509 XA XID XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/_functionsMySql80000.txt 0000644 00000014170 14736103337 0016144 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) ANY_VALUE (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIN_TO_UUID (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) ConvexHull (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) Distance (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IS_UUID (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) JSON_ARRAY (F) JSON_ARRAY_APPEND (F) JSON_ARRAY_INSERT (F) JSON_CONTAINS (F) JSON_CONTAINS_PATH (F) JSON_DEPTH (F) JSON_EXTRACT (F) JSON_INSERT (F) JSON_KEYS (F) JSON_LENGTH (F) JSON_MERGE (F) JSON_MERGE_PATCH (F) JSON_MERGE_PRESERVE (F) JSON_OBJECT (F) JSON_PRETTY (F) JSON_QUOTE (F) JSON_REMOVE (F) JSON_REPLACE (F) JSON_SEARCH (F) JSON_SET (F) JSON_STORAGE_FREE (F) JSON_STORAGE_SIZE (F) JSON_TYPE (F) JSON_UNQUOTE (F) JSON_VALID (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRCoveredBy (F) MBRCovers (F) MBRDisjoint (F) MBREqual (F) MBREquals (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_ALL_LOCKS (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsGeoJSON (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Buffer_Strategy (F) ST_Centroid (F) ST_Contains (F) ST_ConvexHull (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_Distance_Sphere (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeoHash (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromGeoJSON (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_IsValid (F) ST_LatFromGeoHash (F) ST_Length (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_LongFromGeoHash (F) ST_MakeEnvelope (F) ST_MLineFromText (F) ST_MLineFromWKB (F) ST_MPointFromText (F) ST_MPointFromWKB (F) ST_MPolyFromText (F) ST_MPolyFromWKB (F) ST_MultiLineStringFromText (F) ST_MultiLineStringFromWKB (F) ST_MultiPointFromText (F) ST_MultiPointFromWKB (F) ST_MultiPolygonFromText (F) ST_MultiPolygonFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromGeoHash (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_Simplify (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Validate (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) UUID_TO_BIN (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_FOR_EXECUTED_GTID_SET (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/_functionsMariaDb100100.txt 0000644 00000014114 14736103337 0016446 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) ANY_VALUE (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) ConvexHull (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) Distance (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) JSON_ARRAY (F) JSON_ARRAY_APPEND (F) JSON_ARRAY_INSERT (F) JSON_CONTAINS (F) JSON_CONTAINS_PATH (F) JSON_DEPTH (F) JSON_EXTRACT (F) JSON_INSERT (F) JSON_KEYS (F) JSON_LENGTH (F) JSON_MERGE (F) JSON_MERGE_PATCH (F) JSON_MERGE_PRESERVE (F) JSON_OBJECT (F) JSON_PRETTY (F) JSON_QUOTE (F) JSON_REMOVE (F) JSON_REPLACE (F) JSON_SEARCH (F) JSON_SET (F) JSON_STORAGE_FREE (F) JSON_STORAGE_SIZE (F) JSON_TYPE (F) JSON_UNQUOTE (F) JSON_VALID (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRCoveredBy (F) MBRCovers (F) MBRDisjoint (F) MBREqual (F) MBREquals (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_ALL_LOCKS (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsGeoJSON (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Buffer_Strategy (F) ST_Centroid (F) ST_Contains (F) ST_ConvexHull (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_Distance_Sphere (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeoHash (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromGeoJSON (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_IsValid (F) ST_LatFromGeoHash (F) ST_Length (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_LongFromGeoHash (F) ST_MakeEnvelope (F) ST_MLineFromText (F) ST_MLineFromWKB (F) ST_MPointFromText (F) ST_MPointFromWKB (F) ST_MPolyFromText (F) ST_MPolyFromWKB (F) ST_MultiLineStringFromText (F) ST_MultiLineStringFromWKB (F) ST_MultiPointFromText (F) ST_MultiPointFromWKB (F) ST_MultiPolygonFromText (F) ST_MultiPolygonFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromGeoHash (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_Simplify (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Validate (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_FOR_EXECUTED_GTID_SET (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/MySql50000.txt 0000644 00000011535 14736103337 0014053 0 ustar 00 ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AUTO_INCREMENT AVG AVG_ROW_LENGTH BACKUP BDB BEFORE (R) BEGIN BERKELEYDB BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CHAIN CHANGE (R) CHANGED CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLIENT CLOSE CODE COLLATE (R) COLLATION COLUMN (R) COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPRESSED CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) DATA DATABASE (R) DATABASES (R) DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIRECTORY DISABLE DISCARD DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENGINE ENGINES ENUM ERRORS ESCAPE ESCAPED (R) EVENTS EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPLAIN (R) EXTENDED FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOR (R) FORCE (R) FOREIGN (R) FOUND FRAC_SECOND FROM (R) FULL FULLTEXT (R) FUNCTION GEOMETRY GEOMETRYCOLLECTION GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INNER (R) INNOBASE INNODB INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LEVEL LIKE (R) LIMIT (R) LINES (R) LINESTRING LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_CONNECT_RETRY MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_KEY MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEW NEXT NO NO_WRITE_TO_BINLOG (R) NONE NOT (R) NULL (R) NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONE_SHOT OPEN OPTIMIZE (R) OPTION (R) OPTIONALLY (R) OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) PACK_KEYS PAGE PARTIAL PASSWORD PHASE POINT POLYGON PRECISION (R) PREPARE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PURGE (R) QUARTER QUERY QUICK RAID0 RAID_CHUNKS RAID_CHUNKSIZE RAID_TYPE READ (R) READS (R) REAL (R) RECOVER REDUNDANT REFERENCES (R) REGEXP (R) RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELEASE (R) RELOAD RENAME (R) REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATION REQUIRE (R) RESET RESTORE RESTRICT (R) RESUME RETURN (R) RETURNS REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_FORMAT ROWS RTREE SAVEPOINT SCHEMA (R) SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNED SIMPLE SLAVE SMALLINT (R) SNAPSHOT SOME SONAME (R) SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_FRAC_SECOND SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) START STARTING (R) STATUS STOP STORAGE STRAIGHT_JOIN (R) STRING STRIPED SUBJECT SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNICODE UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW WARNINGS WEEK WHEN (R) WHERE (R) WHILE (R) WITH (R) WORK WRITE (R) X509 XA XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/_functionsMySql50500.txt 0000644 00000007477 14736103337 0016162 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRDisjoint (F) MBREqual (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/_common.txt 0000644 00000003104 14736103337 0014041 0 ustar 00 BIT (D) AGAINST (F) AND CHAIN AND NO CHAIN ARRAY (D) BIGINT (D) BINARY (D) BINARY VARYING (D) BLOB (D) BOOLEAN (D) CHAR (D) CHARACTER (D) CHARACTER SET CHARSET CROSS JOIN DATA DIRECTORY DATE (D) DATETIME (D) DECIMAL (D) DEFAULT CHARACTER SET DEFAULT CHARSET DEFAULT COLLATE DOUBLE (D) ENCLOSED BY ENUM (D) ESCAPED BY FLOAT (D) FOR EACH ROW FOR UPDATE FOREIGN KEY (K) FULL JOIN FULL OUTER JOIN FULLTEXT (K) FULLTEXT INDEX (K) FULLTEXT KEY (K) GENERATED ALWAYS GEOMETRY (D) GEOMETRYCOLLECTION (D) GROUP BY (R) IF EXISTS IF NOT EXISTS INDEX (K) INDEX DIRECTORY INDEX KEY (K) INNER JOIN INT (D) INTEGER (D) INTERVAL (D) JSON (D) KEY (K) LOAD DATA LEFT JOIN LEFT OUTER JOIN LESS THAN LINEAR HASH LINEAR KEY LINESTRING (D) LOCK IN SHARE MODE LONGBLOB (D) LONGTEXT (D) MATCH (F) MEDIUMBLOB (D) MEDIUMINT (D) MEDIUMTEXT (D) MULTILINESTRING (D) MULTILINEPOINT (D) MULTILINEPOLYGON (D) MULTISET (D) NATURAL JOIN NATURAL LEFT JOIN NATURAL LEFT OUTER JOIN NATURAL RIGHT JOIN NATURAL RIGHT OUTER JOIN NO ACTION NO RELEASE NOT NULL NUMERIC (D) ON DELETE ON UPDATE OR REPLACE ORDER BY (R) PARTITION BY PARTITIONS POLYGON (D) POINT (D) PERSISTENT PRIMARY KEY (K) REAL (D) RIGHT JOIN RIGHT OUTER JOIN SELECT TRANSACTION SERIAL (D) SET (D) SET NULL SET PASSWORD SMALLINT (D) SPATIAL (K) SPATIAL INDEX (K) SPATIAL KEY (K) SQL SECURITY START TRANSACTION STARTING BY SUBPARTITION BY SUBPARTITIONS TERMINATED BY TEXT (D) TIME (D) TIMESTAMP (D) TINYBLOB (D) TINYINT (D) TINYTEXT (D) UNION ALL UNION DISTINCT UNIQUE (K) UNIQUE INDEX (K) UNIQUE KEY (K) VARBINARY (D) VARCHAR (D) VIRTUAL WITH CONSISTENT SNAPSHOT XML (D) YEAR (D) sql-parser/tools/contexts/_functionsMariaDb100300.txt 0000644 00000014114 14736103337 0016450 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) ANY_VALUE (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) ConvexHull (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) Distance (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) JSON_ARRAY (F) JSON_ARRAY_APPEND (F) JSON_ARRAY_INSERT (F) JSON_CONTAINS (F) JSON_CONTAINS_PATH (F) JSON_DEPTH (F) JSON_EXTRACT (F) JSON_INSERT (F) JSON_KEYS (F) JSON_LENGTH (F) JSON_MERGE (F) JSON_MERGE_PATCH (F) JSON_MERGE_PRESERVE (F) JSON_OBJECT (F) JSON_PRETTY (F) JSON_QUOTE (F) JSON_REMOVE (F) JSON_REPLACE (F) JSON_SEARCH (F) JSON_SET (F) JSON_STORAGE_FREE (F) JSON_STORAGE_SIZE (F) JSON_TYPE (F) JSON_UNQUOTE (F) JSON_VALID (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRCoveredBy (F) MBRCovers (F) MBRDisjoint (F) MBREqual (F) MBREquals (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_ALL_LOCKS (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsGeoJSON (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Buffer_Strategy (F) ST_Centroid (F) ST_Contains (F) ST_ConvexHull (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_Distance_Sphere (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeoHash (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromGeoJSON (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_IsValid (F) ST_LatFromGeoHash (F) ST_Length (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_LongFromGeoHash (F) ST_MakeEnvelope (F) ST_MLineFromText (F) ST_MLineFromWKB (F) ST_MPointFromText (F) ST_MPointFromWKB (F) ST_MPolyFromText (F) ST_MPolyFromWKB (F) ST_MultiLineStringFromText (F) ST_MultiLineStringFromWKB (F) ST_MultiPointFromText (F) ST_MultiPointFromWKB (F) ST_MultiPolygonFromText (F) ST_MultiPolygonFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromGeoHash (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_Simplify (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Validate (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_FOR_EXECUTED_GTID_SET (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/MySql50600.txt 0000644 00000013715 14736103337 0014063 0 ustar 00 ACCESSIBLE (R) ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTHORS AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONTRIBUTORS CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONE_SHOT ONLY OPEN OPTIMIZE (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WORK WRAPPER WRITE (R) X509 XA XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/MySql80000.txt 0000644 00000014505 14736103337 0014056 0 ustar 00 ACCESSIBLE (R) ACCOUNT ACTION ADD (R) AFTER AGAINST AGGREGATE ALGORITHM ALL (R) ALTER (R) ALWAYS ANALYSE ANALYZE (R) AND (R) ANY AS (R) ASC (R) ASCII ASENSITIVE (R) AT AUTO_INCREMENT AUTOEXTEND_SIZE AVG AVG_ROW_LENGTH BACKUP BEFORE (R) BEGIN BETWEEN (R) BIGINT (R) BINARY (R) BINLOG BIT BLOB (R) BLOCK BOOL BOOLEAN BOTH (R) BTREE BY (R) BYTE CACHE CALL (R) CASCADE (R) CASCADED CASE (R) CATALOG_NAME CHAIN CHANGE (R) CHANGED CHANNEL CHAR (R) CHARACTER (R) CHARSET CHECK (R) CHECKSUM CIPHER CLASS_ORIGIN CLIENT CLOSE COALESCE CODE COLLATE (R) COLLATION COLUMN (R) COLUMN_FORMAT COLUMN_NAME COLUMNS COMMENT COMMIT COMMITTED COMPACT COMPLETION COMPRESSED COMPRESSION CONCURRENT CONDITION (R) CONNECTION CONSISTENT CONSTRAINT (R) CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONTAINS CONTEXT CONTINUE (R) CONVERT (R) CPU CREATE (R) CROSS (R) CUBE CURRENT CURRENT_DATE (R) CURRENT_TIME (R) CURRENT_TIMESTAMP (R) CURRENT_USER (R) CURSOR (R) CURSOR_NAME DATA DATABASE (R) DATABASES (R) DATAFILE DATE DATETIME DAY DAY_HOUR (R) DAY_MICROSECOND (R) DAY_MINUTE (R) DAY_SECOND (R) DEALLOCATE DEC (R) DECIMAL (R) DECLARE (R) DEFAULT (R) DEFAULT_AUTH DEFINER DELAY_KEY_WRITE DELAYED (R) DELETE (R) DES_KEY_FILE DESC (R) DESCRIBE (R) DETERMINISTIC (R) DIAGNOSTICS DIRECTORY DISABLE DISCARD DISK DISTINCT (R) DISTINCTROW (R) DIV (R) DO DOUBLE (R) DROP (R) DUAL (R) DUMPFILE DUPLICATE DYNAMIC EACH (R) ELSE (R) ELSEIF (R) ENABLE ENCLOSED (R) END ENDS ENGINE ENGINES ENUM ERROR ERRORS ESCAPE ESCAPED (R) EVENT EVENTS EVERY EXCHANGE EXECUTE EXISTS (R) EXIT (R) EXPANSION EXPIRE EXPLAIN (R) EXPORT EXTENDED EXTENT_SIZE FALSE (R) FAST FAULTS FETCH (R) FIELDS FILE FILE_BLOCK_SIZE FILTER FIRST FIXED FLOAT (R) FLOAT4 (R) FLOAT8 (R) FLUSH FOLLOWS FOR (R) FORCE (R) FOREIGN (R) FORMAT FOUND FROM (R) FULL FULLTEXT (R) FUNCTION GENERAL GENERATED (R) GEOMETRY GEOMETRYCOLLECTION GET (R) GET_FORMAT GLOBAL GRANT (R) GRANTS GROUP (R) GROUP_REPLICATION HANDLER HASH HAVING (R) HELP HIGH_PRIORITY (R) HOST HOSTS HOUR HOUR_MICROSECOND (R) HOUR_MINUTE (R) HOUR_SECOND (R) IDENTIFIED IF (R) IGNORE (R) IGNORE_SERVER_IDS IMPORT IN (R) INDEX (R) INDEXES INFILE (R) INITIAL_SIZE INNER (R) INOUT (R) INSENSITIVE (R) INSERT (R) INSERT_METHOD INSTALL INT (R) INT1 (R) INT2 (R) INT3 (R) INT4 (R) INT8 (R) INTEGER (R) INTERVAL (R) INTO (R) INVOKER IO IO_AFTER_GTIDS (R) IO_BEFORE_GTIDS (R) IO_THREAD IPC IS (R) ISOLATION ISSUER ITERATE (R) JOIN (R) KEY (R) KEY_BLOCK_SIZE KEYS (R) KILL (R) LANGUAGE LAST LEADING (R) LEAVE (R) LEAVES LEFT (R) LESS LEVEL LIKE (R) LIMIT (R) LINEAR (R) LINES (R) LINESTRING LIST LOAD (R) LOCAL LOCALTIME (R) LOCALTIMESTAMP (R) LOCK (R) LOCKS LOGFILE LOGS LONG (R) LONGBLOB (R) LONGTEXT (R) LOOP (R) LOW_PRIORITY (R) MASTER MASTER_AUTO_POSITION MASTER_BIND (R) MASTER_CONNECT_RETRY MASTER_DELAY MASTER_HEARTBEAT_PERIOD MASTER_HOST MASTER_LOG_FILE MASTER_LOG_POS MASTER_PASSWORD MASTER_PORT MASTER_RETRY_COUNT MASTER_SERVER_ID MASTER_SSL MASTER_SSL_CA MASTER_SSL_CAPATH MASTER_SSL_CERT MASTER_SSL_CIPHER MASTER_SSL_CRL MASTER_SSL_CRLPATH MASTER_SSL_KEY MASTER_SSL_VERIFY_SERVER_CERT (R) MASTER_USER MATCH (R) MAX_CONNECTIONS_PER_HOUR MAX_QUERIES_PER_HOUR MAX_ROWS MAX_SIZE MAX_STATEMENT_TIME MAX_UPDATES_PER_HOUR MAX_USER_CONNECTIONS MAXVALUE (R) MEDIUM MEDIUMBLOB (R) MEDIUMINT (R) MEDIUMTEXT (R) MEMORY MERGE MESSAGE_TEXT MICROSECOND MIDDLEINT (R) MIGRATE MIN_ROWS MINUTE MINUTE_MICROSECOND (R) MINUTE_SECOND (R) MOD (R) MODE MODIFIES (R) MODIFY MONTH MULTILINESTRING MULTIPOINT MULTIPOLYGON MUTEX MYSQL_ERRNO NAME NAMES NATIONAL NATURAL (R) NCHAR NDB NDBCLUSTER NEVER NEW NEXT NO NO_WAIT NO_WRITE_TO_BINLOG (R) NODEGROUP NONBLOCKING NONE NOT (R) NULL (R) NUMBER NUMERIC (R) NVARCHAR OFFSET OLD_PASSWORD ON (R) ONE ONLY OPEN OPTIMIZE (R) OPTIMIZER_COSTS (R) OPTION (R) OPTIONALLY (R) OPTIONS OR (R) ORDER (R) OUT (R) OUTER (R) OUTFILE (R) OWNER PACK_KEYS PAGE PARSE_GCOL_EXPR PARSER PARTIAL PARTITION (R) PARTITIONING PARTITIONS PASSWORD PERSIST PERSIST_ONLY PHASE PLUGIN PLUGIN_DIR PLUGINS POINT POLYGON PORT PRECEDES PRECISION (R) PREPARE PRESERVE PREV PRIMARY (R) PRIVILEGES PROCEDURE (R) PROCESSLIST PROFILE PROFILES PROXY PURGE (R) QUARTER QUERY QUICK RANGE (R) READ (R) READ_ONLY READ_WRITE (R) READS (R) REAL (R) REBUILD RECOVER REDO_BUFFER_SIZE REDOFILE REDUNDANT REFERENCES (R) REGEXP (R) RELAY RELAY_LOG_FILE RELAY_LOG_POS RELAY_THREAD RELAYLOG RELEASE (R) RELOAD REMOVE RENAME (R) REORGANIZE REPAIR REPEAT (R) REPEATABLE REPLACE (R) REPLICATE_DO_DB REPLICATE_DO_TABLE REPLICATE_IGNORE_DB REPLICATE_IGNORE_TABLE REPLICATE_REWRITE_DB REPLICATE_WILD_DO_TABLE REPLICATE_WILD_IGNORE_TABLE REPLICATION REQUIRE (R) RESET RESIGNAL (R) RESTORE RESTRICT (R) RESUME RETURN (R) RETURNED_SQLSTATE RETURNS REVERSE REVOKE (R) RIGHT (R) RLIKE (R) ROLLBACK ROLLUP ROUTINE ROW ROW_COUNT ROW_FORMAT ROWS RTREE SAVEPOINT SCHEDULE SCHEMA (R) SCHEMA_NAME SCHEMAS (R) SECOND SECOND_MICROSECOND (R) SECURITY SELECT (R) SENSITIVE (R) SEPARATOR (R) SERIAL SERIALIZABLE SERVER SESSION SET (R) SHARE SHOW (R) SHUTDOWN SIGNAL (R) SIGNED SIMPLE SLAVE SLOW SMALLINT (R) SNAPSHOT SOCKET SOME SONAME SOUNDS SOURCE SPATIAL (R) SPECIFIC (R) SQL (R) SQL_AFTER_GTIDS SQL_AFTER_MTS_GAPS SQL_BEFORE_GTIDS SQL_BIG_RESULT (R) SQL_BUFFER_RESULT SQL_CACHE SQL_CALC_FOUND_ROWS (R) SQL_NO_CACHE SQL_SMALL_RESULT (R) SQL_THREAD SQL_TSI_DAY SQL_TSI_HOUR SQL_TSI_MINUTE SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_SECOND SQL_TSI_WEEK SQL_TSI_YEAR SQLEXCEPTION (R) SQLSTATE (R) SQLWARNING (R) SSL (R) STACKED START STARTING (R) STARTS STATS_AUTO_RECALC STATS_PERSISTENT STATS_SAMPLE_PAGES STATUS STOP STORAGE STORED (R) STRAIGHT_JOIN (R) STRING SUBCLASS_ORIGIN SUBJECT SUBPARTITION SUBPARTITIONS SUPER SUSPEND SWAPS SWITCHES TABLE (R) TABLE_CHECKSUM TABLE_NAME TABLES TABLESPACE TEMPORARY TEMPTABLE TERMINATED (R) TEXT THAN THEN (R) TIME TIMESTAMP TIMESTAMPADD TIMESTAMPDIFF TINYBLOB (R) TINYINT (R) TINYTEXT (R) TO (R) TRAILING (R) TRANSACTION TRIGGER (R) TRIGGERS TRUE (R) TRUNCATE TYPE TYPES UNCOMMITTED UNDEFINED UNDO (R) UNDO_BUFFER_SIZE UNDOFILE UNICODE UNINSTALL UNION (R) UNIQUE (R) UNKNOWN UNLOCK (R) UNSIGNED (R) UNTIL UPDATE (R) UPGRADE USAGE (R) USE (R) USE_FRM USER USER_RESOURCES USING (R) UTC_DATE (R) UTC_TIME (R) UTC_TIMESTAMP (R) VALIDATION VALUE VALUES (R) VARBINARY (R) VARCHAR (R) VARCHARACTER (R) VARIABLES VARYING (R) VIEW VIRTUAL (R) WAIT WARNINGS WEEK WEIGHT_STRING WHEN (R) WHERE (R) WHILE (R) WITH (R) WITHOUT WORK WRAPPER WRITE (R) X509 XA XID XML XOR (R) YEAR YEAR_MONTH (R) ZEROFILL (R) sql-parser/tools/contexts/_functionsMySql50100.txt 0000644 00000007315 14736103337 0016145 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECOD (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRDisjoint (F) MBREqual (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_DAYS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/_functionsMySql50700.txt 0000644 00000014114 14736103337 0016146 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) ANY_VALUE (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) AsWKB (F) AsWKT (F) ATAN (F) ATAN2 (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) Buffer (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR (F) CHAR_LENGTH (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT (F) CONCAT_WS (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT (F) CONVERT_TZ (F) ConvexHull (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) Distance (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) ExtractValue (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_BASE64 (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryCollectionFromText (F) GeometryCollectionFromWKB (F) GeometryFromText (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) GTID_SUBSET (F) GTID_SUBTRACT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET6_ATON (F) INET6_NTOA (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_IPV4 (F) IS_IPV4_COMPAT (F) IS_IPV4_MAPPED (F) IS_IPV6 (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) JSON_ARRAY (F) JSON_ARRAY_APPEND (F) JSON_ARRAY_INSERT (F) JSON_CONTAINS (F) JSON_CONTAINS_PATH (F) JSON_DEPTH (F) JSON_EXTRACT (F) JSON_INSERT (F) JSON_KEYS (F) JSON_LENGTH (F) JSON_MERGE (F) JSON_MERGE_PATCH (F) JSON_MERGE_PRESERVE (F) JSON_OBJECT (F) JSON_PRETTY (F) JSON_QUOTE (F) JSON_REMOVE (F) JSON_REPLACE (F) JSON_SEARCH (F) JSON_SET (F) JSON_STORAGE_FREE (F) JSON_STORAGE_SIZE (F) JSON_TYPE (F) JSON_UNQUOTE (F) JSON_VALID (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LineStringFromWKB (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG (F) LOG10 (F) LOG2 (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRCoveredBy (F) MBRCovers (F) MBRDisjoint (F) MBREqual (F) MBREquals (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiLineStringFromText (F) MultiLineStringFromWKB (F) MultiPoint (F) MultiPointFromText (F) MultiPointFromWKB (F) MultiPolygon (F) MultiPolygonFromText (F) MultiPolygonFromWKB (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) PolygonFromText (F) PolygonFromWKB (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RANDOM_BYTES (F) RELEASE_ALL_LOCKS (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA (F) SHA1 (F) SHA2 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) ST_Area (F) ST_AsBinary (F) ST_AsGeoJSON (F) ST_AsText (F) ST_AsWKB (F) ST_AsWKT (F) ST_Buffer (F) ST_Buffer_Strategy (F) ST_Centroid (F) ST_Contains (F) ST_ConvexHull (F) ST_Crosses (F) ST_Difference (F) ST_Dimension (F) ST_Disjoint (F) ST_Distance (F) ST_Distance_Sphere (F) ST_EndPoint (F) ST_Envelope (F) ST_Equals (F) ST_ExteriorRing (F) ST_GeoHash (F) ST_GeomCollFromText (F) ST_GeomCollFromTxt (F) ST_GeomCollFromWKB (F) ST_GeometryCollectionFromText (F) ST_GeometryCollectionFromWKB (F) ST_GeometryFromText (F) ST_GeometryN (F) ST_GeometryType (F) ST_GeomFromGeoJSON (F) ST_GeomFromText (F) ST_GeomFromWKB (F) ST_InteriorRingN (F) ST_Intersection (F) ST_Intersects (F) ST_IsClosed (F) ST_IsEmpty (F) ST_IsSimple (F) ST_IsValid (F) ST_LatFromGeoHash (F) ST_Length (F) ST_LineFromText (F) ST_LineFromWKB (F) ST_LineStringFromWKB (F) ST_LongFromGeoHash (F) ST_MakeEnvelope (F) ST_MLineFromText (F) ST_MLineFromWKB (F) ST_MPointFromText (F) ST_MPointFromWKB (F) ST_MPolyFromText (F) ST_MPolyFromWKB (F) ST_MultiLineStringFromText (F) ST_MultiLineStringFromWKB (F) ST_MultiPointFromText (F) ST_MultiPointFromWKB (F) ST_MultiPolygonFromText (F) ST_MultiPolygonFromWKB (F) ST_NumGeometries (F) ST_NumInteriorRings (F) ST_NumPoints (F) ST_Overlaps (F) ST_PointFromGeoHash (F) ST_PointFromText (F) ST_PointFromWKB (F) ST_PointN (F) ST_PolyFromText (F) ST_PolyFromWKB (F) ST_PolygonFromText (F) ST_PolygonFromWKB (F) ST_Simplify (F) ST_SRID (F) ST_StartPoint (F) ST_SymDifference (F) ST_Touches (F) ST_Union (F) ST_Validate (F) ST_Within (F) ST_X (F) ST_Y (F) StartPoint (F) STD (F) STDDEV (F) STDDEV_POP (F) STDDEV_SAMP (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING (F) SUBSTRING_INDEX (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_BASE64 (F) TO_DAYS (F) TO_SECONDS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UpdateXML (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) UUID_SHORT (F) VALIDATE_PASSWORD_STRENGTH (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WAIT_FOR_EXECUTED_GTID_SET (F) WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) WEIGHT_STRING (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/contexts/_functionsMySql50000.txt 0000644 00000006540 14736103337 0016143 0 ustar 00 ABS (F) ACOS (F) ADDDATE (F) ADDTIME (F) AES_DECRYPT (F) AES_ENCRYPT (F) Area (F) AsBinary (F) ASCII (F) ASIN (F) AsText (F) ATAN2 (F) ATAN (F) AVG (F) BENCHMARK (F) BIN (F) BINARY (F) BIT_AND (F) BIT_COUNT (F) BIT_LENGTH (F) BIT_OR (F) BIT_XOR (F) CAST (F) CEIL (F) CEILING (F) Centroid (F) CHAR_LENGTH (F) CHAR (F) CHARACTER_LENGTH (F) CHARSET (F) COALESCE (F) COERCIBILITY (F) COLLATION (F) COMPRESS (F) CONCAT_WS (F) CONCAT (F) CONNECTION_ID (F) Contains (F) CONV (F) CONVERT_TZ (F) CONVERT (F) COS (F) COT (F) COUNT (F) CRC32 (F) Crosses (F) CURDATE (F) CURRENT_DATE (F) CURRENT_TIME (F) CURRENT_TIMESTAMP (F) CURRENT_USER (F) CURTIME (F) DATABASE (F) DATE_ADD (F) DATE_FORMAT (F) DATE_SUB (F) DATE (F) DATEDIFF (F) DAY (F) DAYNAME (F) DAYOFMONTH (F) DAYOFWEEK (F) DAYOFYEAR (F) DECODE (F) DEFAULT (F) DEGREES (F) DES_DECRYPT (F) DES_ENCRYPT (F) Dimension (F) Disjoint (F) ELT (F) ENCODE (F) ENCRYPT (F) EndPoint (F) Envelope (F) Equals (F) EXP (F) EXPORT_SET (F) ExteriorRing (F) EXTRACT (F) FIELD (F) FIND_IN_SET (F) FLOOR (F) FORMAT (F) FOUND_ROWS (F) FROM_DAYS (F) FROM_UNIXTIME (F) GeomCollFromText (F) GeomCollFromWKB (F) GeometryCollection (F) GeometryN (F) GeometryType (F) GeomFromText (F) GeomFromWKB (F) GET_FORMAT (F) GET_LOCK (F) GLength (F) GREATEST (F) GROUP_CONCAT (F) HEX (F) HOUR (F) IF (F) IFNULL (F) IN (F) INET_ATON (F) INET_NTOA (F) INSERT (F) INSTR (F) InteriorRingN (F) Intersects (F) INTERVAL (F) IS_FREE_LOCK (F) IS_USED_LOCK (F) IsClosed (F) IsEmpty (F) ISNULL (F) IsSimple (F) LAST_INSERT_ID (F) LCASE (F) LEAST (F) LEFT (F) LENGTH (F) LineFromText (F) LineFromWKB (F) LineString (F) LN (F) LOAD_FILE (F) LOCALTIME (F) LOCALTIMESTAMP (F) LOCATE (F) LOG10 (F) LOG2 (F) LOG (F) LOWER (F) LPAD (F) LTRIM (F) MAKE_SET (F) MAKEDATE (F) MAKETIME (F) MASTER_POS_WAIT (F) MAX (F) MBRContains (F) MBRDisjoint (F) MBREqual (F) MBRIntersects (F) MBROverlaps (F) MBRTouches (F) MBRWithin (F) MD5 (F) MICROSECOND (F) MID (F) MIN (F) MINUTE (F) MLineFromText (F) MLineFromWKB (F) MOD (F) MONTH (F) MONTHNAME (F) MPointFromText (F) MPointFromWKB (F) MPolyFromText (F) MPolyFromWKB (F) MultiLineString (F) MultiPoint (F) MultiPolygon (F) NAME_CONST (F) NOT IN (F) NOW (F) NULLIF (F) NumGeometries (F) NumInteriorRings (F) NumPoints (F) OCT (F) OCTET_LENGTH (F) OLD_PASSWORD (F) ORD (F) Overlaps (F) PASSWORD (F) PERIOD_ADD (F) PERIOD_DIFF (F) PI (F) Point (F) PointFromText (F) PointFromWKB (F) PointN (F) PolyFromText (F) PolyFromWKB (F) Polygon (F) POSITION (F) POW (F) POWER (F) QUARTER (F) QUOTE (F) RADIANS (F) RAND (F) RELEASE_LOCK (F) REPEAT (F) REPLACE (F) REVERSE (F) RIGHT (F) ROUND (F) ROW_COUNT (F) RPAD (F) RTRIM (F) SCHEMA (F) SEC_TO_TIME (F) SECOND (F) SESSION_USER (F) SHA1 (F) SIGN (F) SIN (F) SLEEP (F) SOUNDEX (F) SPACE (F) SQRT (F) SRID (F) StartPoint (F) STD (F) STDDEV_POP (F) STDDEV_SAMP (F) STDDEV (F) STR_TO_DATE (F) STRCMP (F) SUBDATE (F) SUBSTR (F) SUBSTRING_INDEX (F) SUBSTRING (F) SUBTIME (F) SUM (F) SYSDATE (F) SYSTEM_USER (F) TAN (F) TIME_FORMAT (F) TIME_TO_SEC (F) TIME (F) TIMEDIFF (F) TIMESTAMP (F) TIMESTAMPADD (F) TIMESTAMPDIFF (F) TO_DAYS (F) Touches (F) TRIM (F) TRUNCATE (F) UCASE (F) UNCOMPRESS (F) UNCOMPRESSED_LENGTH (F) UNHEX (F) UNIX_TIMESTAMP (F) UPPER (F) USER (F) UTC_DATE (F) UTC_TIME (F) UTC_TIMESTAMP (F) UUID (F) VALUES (F) VAR_POP (F) VAR_SAMP (F) VARIANCE (F) VERSION (F) WEEK (F) WEEKDAY (F) WEEKOFYEAR (F) Within (F) X (F) Y (F) YEAR (F) YEARWEEK (F) sql-parser/tools/ContextGenerator.php 0000644 00000027370 14736103337 0014021 0 ustar 00 <?php declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Tools; use Exception; use function array_map; use function array_merge; use function array_slice; use function basename; use function count; use function dirname; use function file; use function file_put_contents; use function implode; use function is_dir; use function ksort; use function preg_match; use function round; use function rtrim; use function scandir; use function sort; use function sprintf; use function str_repeat; use function str_replace; use function str_split; use function strlen; use function strstr; use function strtoupper; use function substr; use function trim; use const FILE_IGNORE_NEW_LINES; use const FILE_SKIP_EMPTY_LINES; use const SORT_STRING; require_once __DIR__ . '/../vendor/autoload.php'; /** * Used for context generation. */ class ContextGenerator { /** * Labels and flags that may be used when defining keywords. * * @var array */ public static $LABELS_FLAGS = [ '(R)' => 2, // reserved '(D)' => 8, // data type '(K)' => 16, // keyword '(F)' => 32, // function name ]; /** * Documentation links for each context. * * @var array */ public static $LINKS = [ 'MySql50000' => 'https://dev.mysql.com/doc/refman/5.0/en/keywords.html', 'MySql50100' => 'https://dev.mysql.com/doc/refman/5.1/en/keywords.html', 'MySql50500' => 'https://dev.mysql.com/doc/refman/5.5/en/keywords.html', 'MySql50600' => 'https://dev.mysql.com/doc/refman/5.6/en/keywords.html', 'MySql50700' => 'https://dev.mysql.com/doc/refman/5.7/en/keywords.html', 'MySql80000' => 'https://dev.mysql.com/doc/refman/8.0/en/keywords.html', 'MariaDb100000' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/', 'MariaDb100100' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/', 'MariaDb100200' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/', 'MariaDb100300' => 'https://mariadb.com/kb/en/the-mariadb-library/reserved-words/', ]; /** * The template of a context. * * Parameters: * 1 - name * 2 - class * 3 - link * 4 - keywords array */ public const TEMPLATE = '<?php' . "\n" . '/**' . "\n" . ' * Context for %1$s.' . "\n" . ' *' . "\n" . ' * This file was auto-generated.' . "\n" . ' *' . "\n" . ' * @see %3$s' . "\n" . ' */' . "\n" . 'declare(strict_types=1);' . "\n" . '' . "\n" . 'namespace PhpMyAdmin\\SqlParser\\Contexts;' . "\n" . '' . "\n" . 'use PhpMyAdmin\\SqlParser\\Context;' . "\n" . 'use PhpMyAdmin\\SqlParser\\Token;' . "\n" . '' . "\n" . '/**' . "\n" . ' * Context for %1$s.' . "\n" . ' *' . "\n" . ' * @category Contexts' . "\n" . ' *' . "\n" . ' * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+' . "\n" . ' */' . "\n" . 'class %2$s extends Context' . "\n" . '{' . "\n" . ' /**' . "\n" . ' * List of keywords.' . "\n" . ' *' . "\n" . ' * The value associated to each keyword represents its flags.' . "\n" . ' *' . "\n" . ' * @see Token::FLAG_KEYWORD_RESERVED Token::FLAG_KEYWORD_COMPOSED' . "\n" . ' * Token::FLAG_KEYWORD_DATA_TYPE Token::FLAG_KEYWORD_KEY' . "\n" . ' * Token::FLAG_KEYWORD_FUNCTION' . "\n" . ' *' . "\n" . ' * @var array' . "\n" . ' */' . "\n" . ' public static $KEYWORDS = [' . "\n" . '%4$s' . ' ];' . "\n" . '}' . "\n"; /** * Sorts an array of words. * * @param array $arr * * @return array */ public static function sortWords(array &$arr) { ksort($arr); foreach ($arr as &$wordsByLen) { ksort($wordsByLen); foreach ($wordsByLen as &$words) { sort($words, SORT_STRING); } } return $arr; } /** * Reads a list of words and sorts it by type, length and keyword. * * @param string[] $files * * @return array */ public static function readWords(array $files) { $words = []; foreach ($files as $file) { $words = array_merge($words, file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); } $types = []; for ($i = 0, $count = count($words); $i !== $count; ++$i) { $type = 1; $value = trim($words[$i]); // Reserved, data types, keys, functions, etc. keywords. foreach (static::$LABELS_FLAGS as $label => $flags) { if (strstr($value, $label) !== false) { $type |= $flags; $value = trim(str_replace($label, '', $value)); } } // Composed keyword. if (strstr($value, ' ') !== false) { $type |= 2; // Reserved keyword. $type |= 4; // Composed keyword. } $len = strlen($words[$i]); if ($len === 0) { continue; } $value = strtoupper($value); if (! isset($types[$value])) { $types[$value] = $type; } else { $types[$value] |= $type; } } $ret = []; foreach ($types as $word => $type) { $len = strlen($word); if (! isset($ret[$type])) { $ret[$type] = []; } if (! isset($ret[$type][$len])) { $ret[$type][$len] = []; } $ret[$type][$len][] = $word; } return static::sortWords($ret); } /** * Prints an array of a words in PHP format. * * @param array $words the list of words to be formatted * @param int $spaces the number of spaces that starts every line * @param int $line the length of a line * * @return string */ public static function printWords($words, $spaces = 8, $line = 140) { $typesCount = count($words); $ret = ''; $j = 0; foreach ($words as $type => $wordsByType) { foreach ($wordsByType as $len => $wordsByLen) { $count = round(($line - $spaces) / ($len + 9)); // strlen("'' => 1, ") = 9 $i = 0; foreach ($wordsByLen as $word) { if ($i === 0) { $ret .= str_repeat(' ', $spaces); } $ret .= sprintf('\'%s\' => %s, ', $word, $type); if (++$i === $count || ++$i > $count) { $ret .= "\n"; $i = 0; } } if ($i !== 0) { $ret .= "\n"; } } if (++$j < $typesCount) { $ret .= "\n"; } } // Trim trailing spaces and return. return str_replace(" \n", "\n", $ret); } /** * Generates a context's class. * * @param array $options the options that are used in generating this context * * @return string */ public static function generate($options) { if (isset($options['keywords'])) { $options['keywords'] = static::printWords($options['keywords']); } return sprintf( self::TEMPLATE, $options['name'], $options['class'], $options['link'], $options['keywords'] ); } /** * Formats context name. * * @param string $name name to format * * @return string */ public static function formatName($name) { /* Split name and version */ $parts = []; if (preg_match('/([^[0-9]*)([0-9]*)/', $name, $parts) === false) { return $name; } /* Format name */ $base = $parts[1]; switch ($base) { case 'MySql': $base = 'MySQL'; break; case 'MariaDb': $base = 'MariaDB'; break; } /* Parse version to array */ $ver_str = $parts[2]; if (strlen($ver_str) % 2 === 1) { $ver_str = '0' . $ver_str; } $version = array_map('intval', str_split($ver_str, 2)); /* Remove trailing zero */ if ($version[count($version) - 1] === 0) { $version = array_slice($version, 0, count($version) - 1); } /* Create name */ return $base . ' ' . implode('.', $version); } /** * Builds a test. * * Reads the input file, generates the data and writes it back. * * @param string $input the input file * @param string $output the output directory */ public static function build($input, $output) { /** * The directory that contains the input file. * * Used to include common files. * * @var string */ $directory = dirname($input) . '/'; /** * The name of the file that contains the context. * * @var string */ $file = basename($input); /** * The name of the context. * * @var string */ $name = substr($file, 0, -4); /** * The name of the class that defines this context. * * @var string */ $class = 'Context' . $name; /** * The formatted name of this context. * * @var string */ $formattedName = static::formatName($name); file_put_contents( $output . '/' . $class . '.php', static::generate( [ 'name' => $formattedName, 'class' => $class, 'link' => static::$LINKS[$name], 'keywords' => static::readWords( [ $directory . '_common.txt', $directory . '_functions' . $file, $directory . $file, ] ), ] ) ); } /** * Generates recursively all tests preserving the directory structure. * * @param string $input the input directory * @param string $output the output directory */ public static function buildAll($input, $output) { $files = scandir($input); foreach ($files as $file) { // Skipping current and parent directories. if (($file[0] === '.') || ($file[0] === '_')) { continue; } // Building the context. sprintf("Building context for %s...\n", $file); static::build($input . '/' . $file, $output); } } } // Test generator. // // Example of usage: // // php ContextGenerator.php data data // // Input data must be in the `data` folder. // The output will be generated in the same `data` folder. if (count($argv) >= 3) { // Extracting directories' name from command line and trimming unnecessary // slashes at the end. $input = rtrim($argv[1], '/'); $output = rtrim($argv[2], '/'); // Checking if all directories are valid. if (! is_dir($input)) { throw new Exception('The input directory does not exist.'); } elseif (! is_dir($output)) { throw new Exception('The output directory does not exist.'); } // Finally, building the tests. ContextGenerator::buildAll($input, $output); } sql-parser/CODE_OF_CONDUCT.md 0000644 00000006427 14736103337 0011454 0 ustar 00 # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@phpmyadmin.net. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq sql-parser/codecov.yml 0000644 00000000066 14736103337 0011013 0 ustar 00 comment: layout: header, changes, diff coverage: {} sql-parser/bin/highlight-query 0000644 00000001256 14736103337 0012455 0 ustar 00 #!/usr/bin/env php <?php declare(strict_types=1); $files = [ __DIR__ . "/../vendor/autoload.php", __DIR__ . "/../../vendor/autoload.php", __DIR__ . "/../../../autoload.php", "vendor/autoload.php" ]; $found = false; foreach ($files as $file) { if (file_exists($file)) { require_once $file; $found = true; break; } } if (!$found) { die( "You need to set up the project dependencies using the following commands:" . PHP_EOL . "curl -sS https://getcomposer.org/installer | php" . PHP_EOL . "php composer.phar install" . PHP_EOL ); } $cli = new PhpMyAdmin\SqlParser\Utils\CLI(); exit($cli->runHighlight()); sql-parser/bin/tokenize-query 0000644 00000001255 14736103337 0012335 0 ustar 00 #!/usr/bin/env php <?php declare(strict_types=1); $files = [ __DIR__ . "/../vendor/autoload.php", __DIR__ . "/../../vendor/autoload.php", __DIR__ . "/../../../autoload.php", "vendor/autoload.php" ]; $found = false; foreach ($files as $file) { if (file_exists($file)) { require_once $file; $found = true; break; } } if (!$found) { die( "You need to set up the project dependencies using the following commands:" . PHP_EOL . "curl -sS https://getcomposer.org/installer | php" . PHP_EOL . "php composer.phar install" . PHP_EOL ); } $cli = new PhpMyAdmin\SqlParser\Utils\CLI(); exit($cli->runTokenize()); sql-parser/bin/lint-query 0000644 00000001251 14736103337 0011447 0 ustar 00 #!/usr/bin/env php <?php declare(strict_types=1); $files = [ __DIR__ . "/../vendor/autoload.php", __DIR__ . "/../../vendor/autoload.php", __DIR__ . "/../../../autoload.php", "vendor/autoload.php" ]; $found = false; foreach ($files as $file) { if (file_exists($file)) { require_once $file; $found = true; break; } } if (!$found) { die( "You need to set up the project dependencies using the following commands:" . PHP_EOL . "curl -sS https://getcomposer.org/installer | php" . PHP_EOL . "php composer.phar install" . PHP_EOL ); } $cli = new PhpMyAdmin\SqlParser\Utils\CLI(); exit($cli->runLint()); sql-parser/src/Statements/LockStatement.php 0000644 00000006645 14736103337 0015063 0 ustar 00 <?php /** * `LOCK` statement. */ 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 */ 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { if ($token->type === Token::TYPE_KEYWORD) { if ($token->keyword !== 'TABLES') { $parser->error('Unexpected keyword.', $token); break; } $state = 1; continue; } else { $parser->error('Unexpected token.', $token); break; } } elseif ($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) { $parser->error('Unexpected end of LOCK statement.', $prevToken); } } /** * @return string */ public function build() { return trim(($this->isLock ? 'LOCK' : 'UNLOCK') . ' TABLES ' . LockExpression::build($this->locked)); } } sql-parser/src/Statements/MaintenanceStatement.php 0000644 00000002736 14736103337 0016412 0 ustar 00 <?php /** * Maintenance statement. */ 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[] */ 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 */ 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 ) ); } } sql-parser/src/Statements/CreateStatement.php 0000644 00000053170 14736103337 0015371 0 ustar 00 <?php /** * `CREATE` statement. */ 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 */ 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=', ], '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 */ 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 */ 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', ], ]; /** * All function options. * * @var array */ public static $FUNC_OPTIONS = [ 'COMMENT' => [ 1, 'var=', ], 'LANGUAGE SQL' => 2, 'DETERMINISTIC' => 3, 'NOT DETERMINISTIC' => 3, 'CONTAINS SQL' => 4, 'NO SQL' => 4, 'READS SQL DATA' => 4, 'MODIFIES SQL DATA' => 4, 'SQL SECURITY DEFINER' => [ 5, 'var', ], ]; /** * All trigger options. * * @var array */ 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 */ 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 */ 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 */ public $fields; /** * If `CREATE TABLE ... SELECT`. * * Used by `CREATE TABLE` * * @var SelectStatement */ public $select; /** * If `CREATE TABLE ... LIKE`. * * Used by `CREATE TABLE` * * @var Expression */ public $like; /** * Expression used for partitioning. * * @var string */ public $partitionBy; /** * The number of partitions. * * @var int */ public $partitionsNum; /** * Expression used for subpartitioning. * * @var string */ public $subpartitionBy; /** * The number of subpartitions. * * @var int */ public $subpartitionsNum; /** * The partition of the new table. * * @var PartitionDefinition[] */ public $partitions; /** * If `CREATE TRIGGER` the name of the table. * * Used by `CREATE TRIGGER`. * * @var Expression */ public $table; /** * The return data type of this routine. * * Used by `CREATE FUNCTION`. * * @var DataType */ public $return; /** * The parameters of this routine. * * Used by `CREATE FUNCTION` and `CREATE PROCEDURE`. * * @var ParameterDefinition[] */ public $parameters; /** * The body of this function or procedure. For views, it is the select * statement that gets the. * * 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); } elseif ($this->options->has('TABLE')) { if ($this->select !== null) { return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $this->select->build(); } elseif ($this->like !== null) { return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' LIKE ' . Expression::build($this->like); } else { $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')) { return 'CREATE ' . OptionsArray::build($this->options) . ' ' . Expression::build($this->name) . ' ' . $fields . ' AS ' . 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 . ' ' . 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. * * @var Token */ $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 === 'AS') && ($list->tokens[$nextidx]->type === Token::TYPE_KEYWORD) && ($list->tokens[$nextidx]->value === 'SELECT')) { /* CREATE TABLE ... AS SELECT */ $list->idx = $nextidx; $this->select = new SelectStatement($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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping comments. if ($token->type === Token::TYPE_COMMENT) { continue; } 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')) { $prev_token = $token; $token = $list->getNextOfType(Token::TYPE_KEYWORD); if ($token === null || $token->keyword !== 'RETURNS') { $parser->error( 'A "RETURNS" keyword was expected.', $token ?? $prev_token ); } 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')) { $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 `AS` keyword. 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; } } } } sql-parser/src/Statements/ChecksumStatement.php 0000644 00000000702 14736103337 0015721 0 ustar 00 <?php /** * `CHECKSUM` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'QUICK' => 2, 'EXTENDED' => 3, ]; } sql-parser/src/Statements/LoadStatement.php 0000644 00000025773 14736103337 0015055 0 ustar 00 <?php /** * `LOAD` statement. */ 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 */ public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'CONCURRENT' => 1, 'LOCAL' => 2, ]; /** * FIELDS/COLUMNS Options for `LOAD DATA...INFILE` statements. * * @var array */ 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 */ public static $LINES_OPTIONS = [ 'STARTING BY' => [ 1, 'expr', ], 'TERMINATED BY' => [ 2, 'expr', ], ]; /** * File name being used to load data. * * @var Expression */ public $file_name; /** * Table used as destination for this statement. * * @var Expression */ public $table; /** * Partitions used as source for this statement. * * @var ArrayObj */ public $partition; /** * Character set used in this statement. * * @var Expression */ public $charset_name; /** * Options for FIELDS/COLUMNS keyword. * * @see static::$FIELDS_OPTIONS * * @var OptionsArray */ public $fields_options; /** * Whether to use `FIELDS` or `COLUMNS` while building. * * @var string */ public $fields_keyword; /** * Options for OPTIONS keyword. * * @see static::$LINES_OPTIONS * * @var OptionsArray */ public $lines_options; /** * Column names or user variables. * * @var Expression[] */ public $col_name_or_user_var; /** * SET clause's updated values(optional). * * @var SetOperation[] */ public $set; /** * Ignore 'number' LINES/ROWS. * * @var Expression */ public $ignore_number; /** * REPLACE/IGNORE Keyword. * * @var string */ public $replace_ignore; /** * LINES/ROWS Keyword. * * @var string */ 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'INFILE' ) { $parser->error('Unexpected keyword.', $token); break; } elseif ($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' ) { ++$list->idx; $this->table = Expression::parse($parser, $list, ['parseField' => 'table']); $state = 3; } else { $parser->error('Unexpected token.', $token); break; } } 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; } 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; } else { // parse line options $this->lines_options = OptionsArray::parse( $parser, $list, static::$LINES_OPTIONS ); } } 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); $state = 4; return $state; } // no break case 4: if ($token->keyword === 'CHARACTER SET') { ++$list->idx; $this->charset_name = Expression::parse($parser, $list); $state = 5; return $state; } // no break case 5: if ($token->keyword === 'FIELDS' || $token->keyword === 'COLUMNS' || $token->keyword === 'LINES' ) { $this->parseFileOptions($parser, $list, $token->value); $state = 6; return $state; } // 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; } $state = 7; return $state; } // no break case 7: if ($token->keyword === 'SET') { ++$list->idx; $this->set = SetOperation::parse($parser, $list); $state = 8; return $state; } // no break default: } return $state; } } sql-parser/src/Statements/NotImplementedStatement.php 0000644 00000002535 14736103337 0017111 0 ustar 00 <?php /** * Not implemented (yet) statements. */ 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]; } } } sql-parser/src/Statements/CheckStatement.php 0000644 00000001016 14736103337 0015173 0 ustar 00 <?php /** * `CHECK` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'FOR UPGRADE' => 2, 'QUICK' => 3, 'FAST' => 4, 'MEDIUM' => 5, 'EXTENDED' => 6, 'CHANGED' => 7, ]; } sql-parser/src/Statements/ExplainStatement.php 0000644 00000000307 14736103337 0015560 0 ustar 00 <?php /** * `EXPLAIN` statement. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; /** * `EXPLAIN` statement. */ class ExplainStatement extends NotImplementedStatement { } sql-parser/src/Statements/OptimizeStatement.php 0000644 00000001200 14736103337 0015751 0 ustar 00 <?php /** * `OPTIMIZE` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'NO_WRITE_TO_BINLOG' => 2, 'LOCAL' => 3, ]; /** * Optimized tables. * * @var Expression[] */ public $tables; } sql-parser/src/Statements/RepairStatement.php 0000644 00000001071 14736103337 0015401 0 ustar 00 <?php /** * `REPAIR` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'NO_WRITE_TO_BINLOG' => 2, 'LOCAL' => 3, 'QUICK' => 4, 'EXTENDED' => 5, 'USE_FRM' => 6, ]; } sql-parser/src/Statements/SelectStatement.php 0000644 00000016413 14736103337 0015404 0 ustar 00 <?php /** * `SELECT` statement. */ 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\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 */ 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, ]; public static $END_OPTIONS = [ 'FOR UPDATE' => 1, 'LOCK IN SHARE MODE' => 1, ]; /** * The clauses of this statement, in order. * * @see Statement::$CLAUSES * * @var array */ 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[] */ public $index_hints; /** * Partitions used as source for this statement. * * @var ArrayObj */ public $partition; /** * Conditions used for filtering each row of the result set. * * @var Condition[] */ public $where; /** * Conditions used for grouping the result set. * * @var OrderKeyword[] */ public $group; /** * Conditions used for filtering the result set. * * @var Condition[] */ public $having; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[] */ public $order; /** * Conditions used for limiting the size of the result set. * * @var Limit */ public $limit; /** * Procedure that should process the data in the result set. * * @var FunctionCall */ public $procedure; /** * Destination of this result set. * * @var IntoKeyword */ public $into; /** * Joins. * * @var JoinKeyword[] */ public $join; /** * Unions. * * @var SelectStatement[] */ public $union = []; /** * The end options of this query. * * @see static::$END_OPTIONS * * @var OptionsArray */ public $end_options; /** * Gets the clauses of this statement. * * @return array */ 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; } } sql-parser/src/Statements/InsertStatement.php 0000644 00000016442 14736103337 0015433 0 ustar 00 <?php /** * `INSERT` statement. */ 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 */ public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'DELAYED' => 2, 'HIGH_PRIORITY' => 3, 'IGNORE' => 4, ]; /** * Tables used as target for this statement. * * @var IntoKeyword */ public $into; /** * Values to be inserted. * * @var ArrayObj[]|null */ public $values; /** * If SET clause is present * holds the SetOperation. * * @var SetOperation[] */ public $set; /** * If SELECT clause is present * holds the SelectStatement. * * @var SelectStatement */ public $select; /** * If ON DUPLICATE KEY UPDATE clause is present * holds the SetOperation. * * @var SetOperation[] */ 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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) { 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; $miniState = 1; } else { $parser->error( 'Unexpected token.', $token ); break; } } 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; } } sql-parser/src/Statements/UpdateStatement.php 0000644 00000004435 14736103337 0015410 0 ustar 00 <?php /** * `UPDATE` statement. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; use PhpMyAdmin\SqlParser\Components\Condition; use PhpMyAdmin\SqlParser\Components\Expression; use PhpMyAdmin\SqlParser\Components\Limit; use PhpMyAdmin\SqlParser\Components\OrderKeyword; use PhpMyAdmin\SqlParser\Components\SetOperation; use PhpMyAdmin\SqlParser\Statement; /** * `UPDATE` statement. * * UPDATE [LOW_PRIORITY] [IGNORE] table_reference * SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... * [WHERE where_condition] * [ORDER BY ...] * [LIMIT row_count] * * or * * UPDATE [LOW_PRIORITY] [IGNORE] table_references * SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... * [WHERE where_condition] */ class UpdateStatement extends Statement { /** * Options for `UPDATE` statements and their slot ID. * * @var array */ public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'IGNORE' => 2, ]; /** * The clauses of this statement, in order. * * @see Statement::$CLAUSES * * @var array */ public static $CLAUSES = [ 'UPDATE' => [ 'UPDATE', 2, ], // Used for options. '_OPTIONS' => [ '_OPTIONS', 1, ], // Used for updated tables. '_UPDATE' => [ 'UPDATE', 1, ], 'SET' => [ 'SET', 3, ], 'WHERE' => [ 'WHERE', 3, ], 'ORDER BY' => [ 'ORDER BY', 3, ], 'LIMIT' => [ 'LIMIT', 3, ], ]; /** * Tables used as sources for this statement. * * @var Expression[] */ public $tables; /** * The updated values. * * @var SetOperation[] */ public $set; /** * Conditions used for filtering each row of the result set. * * @var Condition[] */ public $where; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[] */ public $order; /** * Conditions used for limiting the size of the result set. * * @var Limit */ public $limit; } sql-parser/src/Statements/SetStatement.php 0000644 00000003753 14736103337 0014723 0 ustar 00 <?php /** * `SET` statement. */ 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 */ public static $CLAUSES = [ 'SET' => [ 'SET', 3, ], '_END_OPTIONS' => [ '_END_OPTIONS', 1, ], ]; /** * Possible exceptions in SET statment. * * @var array */ 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, ]; public static $END_OPTIONS = [ 'COLLATE' => [ 1, 'var', ], 'DEFAULT' => 1, ]; /** * Options used in current statement. * * @var OptionsArray[] */ public $options; /** * The end options of this query. * * @see static::$END_OPTIONS * * @var OptionsArray */ public $end_options; /** * The updated values. * * @var SetOperation[] */ 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); } } sql-parser/src/Statements/PurgeStatement.php 0000644 00000007414 14736103337 0015250 0 ustar 00 <?php /** * `PURGE` statement. */ 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 */ public $log_type; /** * The end option of this query. * * @var String */ public $end_option; /** * The end expr of this query. * * @var String */ 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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) { $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 Array $expected_keywords array of possibly expected keywords at this point */ private static function parseExpectedKeyword($parser, $token, $expected_keywords) { if ($token->type === Token::TYPE_KEYWORD) { if (in_array($token->keyword, $expected_keywords)) { return $token->keyword; } else { $parser->error('Unexpected keyword', $token); } } else { $parser->error('Unexpected token.', $token); } return null; } } sql-parser/src/Statements/RenameStatement.php 0000644 00000002540 14736103337 0015370 0 ustar 00 <?php /** * `RENAME` statement. */ 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[] */ 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 */ public function before(Parser $parser, TokensList $list, Token $token) { if (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'RENAME')) { // 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); } } sql-parser/src/Statements/TransactionStatement.php 0000644 00000004453 14736103337 0016453 0 ustar 00 <?php /** * Transaction statement. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; use PhpMyAdmin\SqlParser\Components\OptionsArray; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statement; use PhpMyAdmin\SqlParser\TokensList; /** * Transaction statement. */ class TransactionStatement extends Statement { /** * START TRANSACTION and BEGIN. */ public const TYPE_BEGIN = 1; /** * COMMIT and ROLLBACK. */ public const TYPE_END = 2; /** * The type of this query. * * @var int */ public $type; /** * The list of statements in this transaction. * * @var Statement[] */ public $statements; /** * The ending transaction statement which may be a `COMMIT` or a `ROLLBACK`. * * @var TransactionStatement */ public $end; /** * Options for this query. * * @var array */ public static $OPTIONS = [ 'START TRANSACTION' => 1, 'BEGIN' => 1, 'COMMIT' => 1, 'ROLLBACK' => 1, 'WITH CONSISTENT SNAPSHOT' => 2, 'WORK' => 2, 'AND NO CHAIN' => 3, 'AND CHAIN' => 3, 'RELEASE' => 4, 'NO RELEASE' => 4, ]; /** * @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) { parent::parse($parser, $list); // Checks the type of this query. if ($this->options->has('START TRANSACTION') || $this->options->has('BEGIN') ) { $this->type = self::TYPE_BEGIN; } elseif ($this->options->has('COMMIT') || $this->options->has('ROLLBACK') ) { $this->type = self::TYPE_END; } } /** * @return string */ public function build() { $ret = OptionsArray::build($this->options); if ($this->type === self::TYPE_BEGIN) { foreach ($this->statements as $statement) { /* * @var SelectStatement $statement */ $ret .= ';' . $statement->build(); } $ret .= ';' . $this->end->build(); } return $ret; } } sql-parser/src/Statements/ShowStatement.php 0000644 00000002377 14736103337 0015111 0 ustar 00 <?php /** * `SHOW` statement. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; /** * `SHOW` statement. */ class ShowStatement extends NotImplementedStatement { /** * Options of this statement. * * @var array */ public static $OPTIONS = [ 'CREATE' => 1, 'AUTHORS' => 2, 'BINARY' => 2, 'BINLOG' => 2, 'CHARACTER' => 2, 'CODE' => 2, 'COLLATION' => 2, 'COLUMNS' => 2, 'CONTRIBUTORS' => 2, 'DATABASE' => 2, 'DATABASES' => 2, 'ENGINE' => 2, 'ENGINES' => 2, 'ERRORS' => 2, 'EVENT' => 2, 'EVENTS' => 2, 'FUNCTION' => 2, 'GRANTS' => 2, 'HOSTS' => 2, 'INDEX' => 2, 'INNODB' => 2, 'LOGS' => 2, 'MASTER' => 2, 'OPEN' => 2, 'PLUGINS' => 2, 'PRIVILEGES' => 2, 'PROCEDURE' => 2, 'PROCESSLIST' => 2, 'PROFILE' => 2, 'PROFILES' => 2, 'SCHEDULER' => 2, 'SET' => 2, 'SLAVE' => 2, 'STATUS' => 2, 'TABLE' => 2, 'TABLES' => 2, 'TRIGGER' => 2, 'TRIGGERS' => 2, 'VARIABLES' => 2, 'VIEW' => 2, 'WARNINGS' => 2, ]; } sql-parser/src/Statements/RestoreStatement.php 0000644 00000000734 14736103337 0015607 0 ustar 00 <?php /** * `RESTORE` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'FROM' => [ 2, 'var', ], ]; } sql-parser/src/Statements/AlterStatement.php 0000644 00000007267 14736103337 0015243 0 ustar 00 <?php /** * `ALTER` statement. */ 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 */ public $table; /** * Column affected by this statement. * * @var AlterOperation[] */ public $altered = []; /** * Options of this statement. * * @var array */ public static $OPTIONS = [ 'ONLINE' => 1, 'OFFLINE' => 1, 'IGNORE' => 2, 'DATABASE' => 3, 'EVENT' => 3, 'FUNCTION' => 3, 'PROCEDURE' => 3, 'SERVER' => 3, 'TABLE' => 3, 'TABLESPACE' => 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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; } $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); } } sql-parser/src/Statements/DropStatement.php 0000644 00000002630 14736103337 0015065 0 ustar 00 <?php /** * `DROP` statement. */ 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 */ 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 */ 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[] */ public $fields; /** * Table of the dropped index. * * @var Expression */ public $table; } sql-parser/src/Statements/BackupStatement.php 0000644 00000001016 14736103337 0015363 0 ustar 00 <?php /** * `BACKUP` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'NO_WRITE_TO_BINLOG' => 2, 'LOCAL' => 3, 'TO' => [ 4, 'var', ], ]; } sql-parser/src/Statements/CallStatement.php 0000644 00000001342 14736103337 0015033 0 ustar 00 <?php /** * `CALL` statement. */ 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 */ public $call; /** * Build statement for CALL. * * @return string */ public function build() { return 'CALL ' . $this->call->name . '(' . ($this->call->parameters ? implode(',', $this->call->parameters->raw) : '') . ')'; } } sql-parser/src/Statements/DeleteStatement.php 0000644 00000026635 14736103337 0015376 0 ustar 00 <?php /** * `DELETE` statement. */ 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 */ public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'QUICK' => 2, 'IGNORE' => 3, ]; /** * The clauses of this statement, in order. * * @see Statement::$CLAUSES * * @var array */ 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[] */ public $from; /** * Joins. * * @var JoinKeyword[] */ public $join; /** * Tables used as sources for this statement. * * @var Expression[] */ public $using; /** * Columns used in this statement. * * @var Expression[] */ public $columns; /** * Partitions used as source for this statement. * * @var ArrayObj */ public $partition; /** * Conditions used for filtering each row of the result set. * * @var Condition[] */ public $where; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[] */ public $order; /** * Conditions used for limiting the size of the result set. * * @var Limit */ 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. * * @var Token */ $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; } else { ++$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) { if ($token->keyword !== 'FROM') { $parser->error('Unexpected keyword.', $token); break; } else { ++$list->idx; // Skip 'FROM' $this->from = ExpressionArray::parse($parser, $list); $state = 2; } } else { $parser->error('Unexpected token.', $token); break; } } 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) { if ($token->keyword === 'WHERE') { ++$list->idx; // Skip 'WHERE' $this->where = Condition::parse($parser, $list); $state = 4; } else { $parser->error('Unexpected keyword.', $token); break; } } else { $parser->error('Unexpected token.', $token); break; } } 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') { ++$list->idx; // Skip 'LIMIT' $this->limit = Limit::parse($parser, $list); $state = 6; } else { $parser->error('Unexpected keyword.', $token); break; } } } } if ($state >= 2) { foreach ($this->from as $from_expr) { $from_expr->database = $from_expr->table; $from_expr->table = $from_expr->column; $from_expr->column = null; } } --$list->idx; } } sql-parser/src/Statements/ReplaceStatement.php 0000644 00000012326 14736103337 0015537 0 ustar 00 <?php /** * `REPLACE` statement. */ 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 */ public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'DELAYED' => 1, ]; /** * Tables used as target for this statement. * * @var IntoKeyword */ public $into; /** * Values to be replaced. * * @var Array2d */ public $values; /** * If SET clause is present * holds the SetOperation. * * @var SetOperation[] */ public $set; /** * If SELECT clause is present * holds the SelectStatement. * * @var SelectStatement */ 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 */ 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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) { 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; } else { $parser->error( 'Unexpected token.', $token ); break; } } } --$list->idx; } } sql-parser/src/Statements/TruncateStatement.php 0000644 00000001352 14736103337 0015746 0 ustar 00 <?php /** * `TRUNCATE` statement. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; use PhpMyAdmin\SqlParser\Components\Expression; use PhpMyAdmin\SqlParser\Statement; /** * `TRUNCATE` statement. */ class TruncateStatement extends Statement { /** * Options for `TRUNCATE` statements. * * @var array */ public static $OPTIONS = ['TABLE' => 1]; /** * The name of the truncated table. * * @var Expression */ public $table; /** * Special build method for truncate statement as Statement::build would return empty string. * * @return string */ public function build() { return 'TRUNCATE TABLE ' . $this->table . ';'; } } sql-parser/src/Statements/AnalyzeStatement.php 0000644 00000001173 14736103337 0015565 0 ustar 00 <?php /** * `ANALYZE` statement. */ 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 */ public static $OPTIONS = [ 'TABLE' => 1, 'NO_WRITE_TO_BINLOG' => 2, 'LOCAL' => 3, ]; /** * Analyzed tables. * * @var Expression[] */ public $tables; } sql-parser/src/Parser.php 0000644 00000051425 14736103337 0011407 0 ustar 00 <?php /** * Defines the parser of the library. * * This is one of the most important components, along with the lexer. */ 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; /** * 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 */ 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', // 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 */ 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 */ public $list; /** * List of statements parsed. * * @var Statement[] */ public $statements = []; /** * The number of opened brackets. * * @var int */ public $brackets = 0; /** * @param string|UtfString|TokensList $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) { $this->parse(); } } /** * Builds the parse trees. * @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. * * @var TokensList */ $list = &$this->list; for (; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment. * * @var Token */ $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; } // 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[$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 * * @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); } } sql-parser/src/UtfString.php 0000644 00000011456 14736103337 0012100 0 ustar 00 <?php /** * Implementation for UTF-8 strings. * * The subscript operator in PHP, when used with string will return a byte * and not a character. Because in UTF-8 strings a character may occupy more * than one byte, the subscript operator may return an invalid character. * * Because the lexer relies on the subscript operator this class had to be * implemented. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use ArrayAccess; use Exception; use function mb_check_encoding; use function mb_strlen; use function ord; /** * Implements array-like access for UTF-8 strings. * * In this library, this class should be used to parse UTF-8 queries. */ class UtfString implements ArrayAccess { /** * The raw, multi-byte string. * * @var string */ public $str = ''; /** * The index of current byte. * * For ASCII strings, the byte index is equal to the character index. * * @var int */ public $byteIdx = 0; /** * The index of current character. * * For non-ASCII strings, some characters occupy more than one byte and * the character index will have a lower value than the byte index. * * @var int */ public $charIdx = 0; /** * The length of the string (in bytes). * * @var int */ public $byteLen = 0; /** * The length of the string (in characters). * * @var int */ public $charLen = 0; /** * @param string $str the string */ public function __construct($str) { $this->str = $str; $this->byteIdx = 0; $this->charIdx = 0; $this->byteLen = mb_strlen($str, '8bit'); if (! mb_check_encoding($str, 'UTF-8')) { $this->charLen = 0; } else { $this->charLen = mb_strlen($str, 'UTF-8'); } } /** * Checks if the given offset exists. * * @param int $offset the offset to be checked * * @return bool */ public function offsetExists($offset) { return ($offset >= 0) && ($offset < $this->charLen); } /** * Gets the character at given offset. * * @param int $offset the offset to be returned * * @return string|null */ public function offsetGet($offset) { if (($offset < 0) || ($offset >= $this->charLen)) { return null; } $delta = $offset - $this->charIdx; if ($delta > 0) { // Fast forwarding. while ($delta-- > 0) { $this->byteIdx += static::getCharLength($this->str[$this->byteIdx]); ++$this->charIdx; } } elseif ($delta < 0) { // Rewinding. while ($delta++ < 0) { do { $byte = ord($this->str[--$this->byteIdx]); } while (($byte >= 128) && ($byte < 192)); --$this->charIdx; } } $bytesCount = static::getCharLength($this->str[$this->byteIdx]); $ret = ''; for ($i = 0; $bytesCount-- > 0; ++$i) { $ret .= $this->str[$this->byteIdx + $i]; } return $ret; } /** * Sets the value of a character. * * @param int $offset the offset to be set * @param string $value the value to be set * * @throws Exception not implemented. */ public function offsetSet($offset, $value) { throw new Exception('Not implemented.'); } /** * Unsets an index. * * @param int $offset the value to be unset * * @throws Exception not implemented. */ public function offsetUnset($offset) { throw new Exception('Not implemented.'); } /** * Gets the length of an UTF-8 character. * * According to RFC 3629, a UTF-8 character can have at most 4 bytes. * However, this implementation supports UTF-8 characters containing up to 6 * bytes. * * @see https://tools.ietf.org/html/rfc3629 * * @param string $byte the byte to be analyzed * * @return int */ public static function getCharLength($byte) { $byte = ord($byte); if ($byte < 128) { return 1; } elseif ($byte < 224) { return 2; } elseif ($byte < 240) { return 3; } elseif ($byte < 248) { return 4; } elseif ($byte < 252) { return 5; // unofficial } return 6; // unofficial } /** * Returns the length in characters of the string. * * @return int */ public function length() { return $this->charLen; } /** * Returns the contained string. * * @return string */ public function __toString() { return $this->str; } } sql-parser/src/Translator.php 0000644 00000003110 14736103337 0012270 0 ustar 00 <?php /** * Defines the localization helper infrastructure of the library. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use PhpMyAdmin\MoTranslator\Loader; use function class_exists; class Translator { /** * The MoTranslator loader object. * * @var Loader */ private static $loader; /** * The MoTranslator translator object. * * @var \PhpMyAdmin\MoTranslator\Translator */ private static $translator; /** * Loads transator. */ public static function load() { if (self::$loader === null) { // Create loader object self::$loader = new Loader(); // Set locale self::$loader->setlocale( self::$loader->detectlocale() ); // Set default text domain self::$loader->textdomain('sqlparser'); // Set path where to look for a domain self::$loader->bindtextdomain('sqlparser', __DIR__ . '/../locale/'); } if (self::$translator === null) { // Get translator self::$translator = self::$loader->getTranslator(); } } /** * Translates a string. * * @param string $msgid String to be translated * * @return string translated string (or original, if not found) */ public static function gettext($msgid) { if (! class_exists('\PhpMyAdmin\MoTranslator\Loader', true)) { return $msgid; } self::load(); return self::$translator->gettext($msgid); } } sql-parser/src/Lexer.php 0000644 00000077032 14736103337 0011234 0 ustar 00 <?php /** * Defines the lexer of the library. * * This is one of the most important components, along with the parser. * * Depends on context to extract lexemes. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use PhpMyAdmin\SqlParser\Exceptions\LexerException; use function define; use function defined; use function mb_strlen; use function sprintf; use function strlen; if (! defined('USE_UTF_STRINGS')) { // NOTE: In previous versions of PHP (5.5 and older) the default // internal encoding is "ISO-8859-1". // All `mb_` functions must specify the correct encoding, which is // 'UTF-8' in order to work properly. /* * Forces usage of `UtfString` if the string is multibyte. * `UtfString` may be slower, but it gives better results. * * @var bool */ define('USE_UTF_STRINGS', true); } /** * Performs lexical analysis over a SQL statement and splits it in multiple * tokens. * * The output of the lexer is affected by the context of the SQL statement. * * @see Context */ class Lexer extends Core { /** * A list of methods that are used in lexing the SQL query. * * @var array */ public static $PARSER_METHODS = [ // It is best to put the parsers in order of their complexity // (ascending) and their occurrence rate (descending). // // Conflicts: // // 1. `parseDelimiter`, `parseUnknown`, `parseKeyword`, `parseNumber` // They fight over delimiter. The delimiter may be a keyword, a // number or almost any character which makes the delimiter one of // the first tokens that must be parsed. // // 1. `parseNumber` and `parseOperator` // They fight over `+` and `-`. // // 2. `parseComment` and `parseOperator` // They fight over `/` (as in ```/*comment*/``` or ```a / b```) // // 3. `parseBool` and `parseKeyword` // They fight over `TRUE` and `FALSE`. // // 4. `parseKeyword` and `parseUnknown` // They fight over words. `parseUnknown` does not know about // keywords. 'parseDelimiter', 'parseWhitespace', 'parseNumber', 'parseComment', 'parseOperator', 'parseBool', 'parseString', 'parseSymbol', 'parseKeyword', 'parseLabel', 'parseUnknown', ]; /** * The string to be parsed. * * @var string|UtfString */ public $str = ''; /** * The length of `$str`. * * By storing its length, a lot of time is saved, because parsing methods * would call `strlen` everytime. * * @var int */ public $len = 0; /** * The index of the last parsed character. * * @var int */ public $last = 0; /** * Tokens extracted from given strings. * * @var TokensList */ public $list; /** * The default delimiter. This is used, by default, in all new instances. * * @var string */ public static $DEFAULT_DELIMITER = ';'; /** * Statements delimiter. * This may change during lexing. * * @var string */ public $delimiter; /** * The length of the delimiter. * * Because `parseDelimiter` can be called a lot, it would perform a lot of * calls to `strlen`, which might affect performance when the delimiter is * big. * * @var int */ public $delimiterLen; /** * Gets the tokens list parsed by a new instance of a lexer. * * @param string|UtfString $str the query to be lexed * @param bool $strict whether strict mode should be * enabled or not * @param string $delimiter the delimiter to be used * * @return TokensList */ public static function getTokens($str, $strict = false, $delimiter = null) { $lexer = new self($str, $strict, $delimiter); return $lexer->list; } /** * @param string|UtfString $str the query to be lexed * @param bool $strict whether strict mode should be * enabled or not * @param string $delimiter the delimiter to be used */ public function __construct($str, $strict = false, $delimiter = null) { // `strlen` is used instead of `mb_strlen` because the lexer needs to // parse each byte of the input. $len = $str instanceof UtfString ? $str->length() : strlen($str); // For multi-byte strings, a new instance of `UtfString` is // initialized (only if `UtfString` usage is forced. if (! $str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) { $str = new UtfString($str); } $this->str = $str; $this->len = $str instanceof UtfString ? $str->length() : $len; $this->strict = $strict; // Setting the delimiter. $this->setDelimiter( ! empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER ); $this->lex(); } /** * Sets the delimiter. * * @param string $delimiter the new delimiter */ public function setDelimiter($delimiter) { $this->delimiter = $delimiter; $this->delimiterLen = strlen($delimiter); } /** * Parses the string and extracts lexemes. */ public function lex() { // TODO: Sometimes, static::parse* functions make unnecessary calls to // is* functions. For a better performance, some rules can be deduced // from context. // For example, in `parseBool` there is no need to compare the token // every time with `true` and `false`. The first step would be to // compare with 'true' only and just after that add another letter from // context and compare again with `false`. // Another example is `parseComment`. $list = new TokensList(); /** * Last processed token. * * @var Token */ $lastToken = null; for ($this->last = 0, $lastIdx = 0; $this->last < $this->len; $lastIdx = ++$this->last) { /** * The new token. * * @var Token */ $token = null; foreach (static::$PARSER_METHODS as $method) { if ($token = $this->$method()) { break; } } if ($token === null) { // @assert($this->last === $lastIdx); $token = new Token($this->str[$this->last]); $this->error( 'Unexpected character.', $this->str[$this->last], $this->last ); } elseif ($lastToken !== null && $token->type === Token::TYPE_SYMBOL && $token->flags & Token::FLAG_SYMBOL_VARIABLE && ( $lastToken->type === Token::TYPE_STRING || ( $lastToken->type === Token::TYPE_SYMBOL && $lastToken->flags & Token::FLAG_SYMBOL_BACKTICK ) ) ) { // Handles ```... FROM 'user'@'%' ...```. $lastToken->token .= $token->token; $lastToken->type = Token::TYPE_SYMBOL; $lastToken->flags = Token::FLAG_SYMBOL_USER; $lastToken->value .= '@' . $token->value; continue; } elseif ($lastToken !== null && $token->type === Token::TYPE_KEYWORD && $lastToken->type === Token::TYPE_OPERATOR && $lastToken->value === '.' ) { // Handles ```... tbl.FROM ...```. In this case, FROM is not // a reserved word. $token->type = Token::TYPE_NONE; $token->flags = 0; $token->value = $token->token; } $token->position = $lastIdx; $list->tokens[$list->count++] = $token; // Handling delimiters. if ($token->type === Token::TYPE_NONE && $token->value === 'DELIMITER') { if ($this->last + 1 >= $this->len) { $this->error( 'Expected whitespace(s) before delimiter.', '', $this->last + 1 ); continue; } // Skipping last R (from `delimiteR`) and whitespaces between // the keyword `DELIMITER` and the actual delimiter. $pos = ++$this->last; if (($token = $this->parseWhitespace()) !== null) { $token->position = $pos; $list->tokens[$list->count++] = $token; } // Preparing the token that holds the new delimiter. if ($this->last + 1 >= $this->len) { $this->error( 'Expected delimiter.', '', $this->last + 1 ); continue; } $pos = $this->last + 1; // Parsing the delimiter. $this->delimiter = null; $delimiterLen = 0; while (++$this->last < $this->len && ! Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15 ) { $this->delimiter .= $this->str[$this->last]; ++$delimiterLen; } if (empty($this->delimiter)) { $this->error( 'Expected delimiter.', '', $this->last ); $this->delimiter = ';'; } --$this->last; // Saving the delimiter and its token. $this->delimiterLen = strlen($this->delimiter); $token = new Token($this->delimiter, Token::TYPE_DELIMITER); $token->position = $pos; $list->tokens[$list->count++] = $token; } $lastToken = $token; } // Adding a final delimiter to mark the ending. $list->tokens[$list->count++] = new Token(null, Token::TYPE_DELIMITER); // Saving the tokens list. $this->list = $list; $this->solveAmbiguityOnStarOperator(); } /** * Resolves the ambiguity when dealing with the "*" operator. * * In SQL statements, the "*" operator can be an arithmetic operator (like in 2*3) or an SQL wildcard (like in * SELECT a.* FROM ...). To solve this ambiguity, the solution is to find the next token, excluding whitespaces and * comments, right after the "*" position. The "*" is for sure an SQL wildcard if the next token found is any of: * - "FROM" (the FROM keyword like in "SELECT * FROM..."); * - "USING" (the USING keyword like in "DELETE table_name.* USING..."); * - "," (a comma separator like in "SELECT *, field FROM..."); * - ")" (a closing parenthesis like in "COUNT(*)"). * This methods will change the flag of the "*" tokens when any of those condition above is true. Otherwise, the * default flag (arithmetic) will be kept. * * @return void */ private function solveAmbiguityOnStarOperator() { $iBak = $this->list->idx; while (null !== ($starToken = $this->list->getNextOfTypeAndValue(Token::TYPE_OPERATOR, '*'))) { // ::getNext already gets rid of whitespaces and comments. if (($next = $this->list->getNext()) !== null) { if (($next->type === Token::TYPE_KEYWORD && in_array($next->value, ['FROM', 'USING'], true)) || ($next->type === Token::TYPE_OPERATOR && in_array($next->value, [',', ')'], true)) ) { $starToken->flags = Token::FLAG_OPERATOR_SQL; } } } $this->list->idx = $iBak; } /** * Creates a new error log. * * @param string $msg the error message * @param string $str the character that produced the error * @param int $pos the position of the character * @param int $code the code of the error * * @throws LexerException throws the exception, if strict mode is enabled. */ public function error($msg, $str = '', $pos = 0, $code = 0) { $error = new LexerException( Translator::gettext($msg), $str, $pos, $code ); parent::error($error); } /** * Parses a keyword. * * @return null|Token */ public function parseKeyword() { $token = ''; /** * Value to be returned. * * @var Token */ $ret = null; /** * The value of `$this->last` where `$token` ends in `$this->str`. * * @var int */ $iEnd = $this->last; /** * Whether last parsed character is a whitespace. * * @var bool */ $lastSpace = false; for ($j = 1; $j < Context::KEYWORD_MAX_LENGTH && $this->last < $this->len; ++$j, ++$this->last) { // Composed keywords shouldn't have more than one whitespace between // keywords. if (Context::isWhitespace($this->str[$this->last])) { if ($lastSpace) { --$j; // The size of the keyword didn't increase. continue; } $lastSpace = true; } else { $lastSpace = false; } $token .= $this->str[$this->last]; if (($this->last + 1 === $this->len || Context::isSeparator($this->str[$this->last + 1])) && $flags = Context::isKeyword($token) ) { $ret = new Token($token, Token::TYPE_KEYWORD, $flags); $iEnd = $this->last; // We don't break so we find longest keyword. // For example, `OR` and `ORDER` have a common prefix `OR`. // If we stopped at `OR`, the parsing would be invalid. } } $this->last = $iEnd; return $ret; } /** * Parses a label. * * @return null|Token */ public function parseLabel() { $token = ''; /** * Value to be returned. * * @var Token */ $ret = null; /** * The value of `$this->last` where `$token` ends in `$this->str`. * * @var int */ $iEnd = $this->last; for ($j = 1; $j < Context::LABEL_MAX_LENGTH && $this->last < $this->len; ++$j, ++$this->last) { if ($this->str[$this->last] === ':' && $j > 1) { // End of label $token .= $this->str[$this->last]; $ret = new Token($token, Token::TYPE_LABEL); $iEnd = $this->last; break; } elseif (Context::isWhitespace($this->str[$this->last]) && $j > 1) { // Whitespace between label and : // The size of the keyword didn't increase. --$j; } elseif (Context::isSeparator($this->str[$this->last])) { // Any other separator break; } $token .= $this->str[$this->last]; } $this->last = $iEnd; return $ret; } /** * Parses an operator. * * @return null|Token */ public function parseOperator() { $token = ''; /** * Value to be returned. * * @var Token */ $ret = null; /** * The value of `$this->last` where `$token` ends in `$this->str`. * * @var int */ $iEnd = $this->last; for ($j = 1; $j < Context::OPERATOR_MAX_LENGTH && $this->last < $this->len; ++$j, ++$this->last) { $token .= $this->str[$this->last]; if ($flags = Context::isOperator($token)) { $ret = new Token($token, Token::TYPE_OPERATOR, $flags); $iEnd = $this->last; } } $this->last = $iEnd; return $ret; } /** * Parses a whitespace. * * @return null|Token */ public function parseWhitespace() { $token = $this->str[$this->last]; if (! Context::isWhitespace($token)) { return null; } while (++$this->last < $this->len && Context::isWhitespace($this->str[$this->last])) { $token .= $this->str[$this->last]; } --$this->last; return new Token($token, Token::TYPE_WHITESPACE); } /** * Parses a comment. * * @return null|Token */ public function parseComment() { $iBak = $this->last; $token = $this->str[$this->last]; // Bash style comments. (#comment\n) if (Context::isComment($token)) { while (++$this->last < $this->len && $this->str[$this->last] !== "\n" ) { $token .= $this->str[$this->last]; } // Include trailing \n as whitespace token if ($this->last < $this->len) { --$this->last; } return new Token($token, Token::TYPE_COMMENT, Token::FLAG_COMMENT_BASH); } // C style comments. (/*comment*\/) if (++$this->last < $this->len) { $token .= $this->str[$this->last]; if (Context::isComment($token)) { // There might be a conflict with "*" operator here, when string is "*/*". // This can occurs in the following statements: // - "SELECT */* comment */ FROM ..." // - "SELECT 2*/* comment */3 AS `six`;" $next = $this->last+1; if (($next < $this->len) && $this->str[$next] === '*') { // Conflict in "*/*": first "*" was not for ending a comment. // Stop here and let other parsing method define the true behavior of that first star. $this->last = $iBak; return null; } $flags = Token::FLAG_COMMENT_C; // This comment already ended. It may be a part of a // previous MySQL specific command. if ($token === '*/') { return new Token($token, Token::TYPE_COMMENT, $flags); } // Checking if this is a MySQL-specific command. if ($this->last + 1 < $this->len && $this->str[$this->last + 1] === '!' ) { $flags |= Token::FLAG_COMMENT_MYSQL_CMD; $token .= $this->str[++$this->last]; while (++$this->last < $this->len && $this->str[$this->last] >= '0' && $this->str[$this->last] <= '9' ) { $token .= $this->str[$this->last]; } --$this->last; // We split this comment and parse only its beginning // here. return new Token($token, Token::TYPE_COMMENT, $flags); } // Parsing the comment. while (++$this->last < $this->len && ( $this->str[$this->last - 1] !== '*' || $this->str[$this->last] !== '/' ) ) { $token .= $this->str[$this->last]; } // Adding the ending. if ($this->last < $this->len) { $token .= $this->str[$this->last]; } return new Token($token, Token::TYPE_COMMENT, $flags); } } // SQL style comments. (-- comment\n) if (++$this->last < $this->len) { $token .= $this->str[$this->last]; $end = false; } else { --$this->last; $end = true; } if (Context::isComment($token, $end)) { // Checking if this comment did not end already (```--\n```). if ($this->str[$this->last] !== "\n") { while (++$this->last < $this->len && $this->str[$this->last] !== "\n" ) { $token .= $this->str[$this->last]; } } // Include trailing \n as whitespace token if ($this->last < $this->len) { --$this->last; } return new Token($token, Token::TYPE_COMMENT, Token::FLAG_COMMENT_SQL); } $this->last = $iBak; return null; } /** * Parses a boolean. * * @return null|Token */ public function parseBool() { if ($this->last + 3 >= $this->len) { // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are // required. return null; } $iBak = $this->last; $token = $this->str[$this->last] . $this->str[++$this->last] . $this->str[++$this->last] . $this->str[++$this->last]; // _TRUE_ or _FALS_e if (Context::isBool($token)) { return new Token($token, Token::TYPE_BOOL); } elseif (++$this->last < $this->len) { $token .= $this->str[$this->last]; // fals_E_ if (Context::isBool($token)) { return new Token($token, Token::TYPE_BOOL, 1); } } $this->last = $iBak; return null; } /** * Parses a number. * * @return null|Token */ public function parseNumber() { // A rudimentary state machine is being used to parse numbers due to // the various forms of their notation. // // Below are the states of the machines and the conditions to change // the state. // // 1 --------------------[ + or - ]-------------------> 1 // 1 -------------------[ 0x or 0X ]------------------> 2 // 1 --------------------[ 0 to 9 ]-------------------> 3 // 1 -----------------------[ . ]---------------------> 4 // 1 -----------------------[ b ]---------------------> 7 // // 2 --------------------[ 0 to F ]-------------------> 2 // // 3 --------------------[ 0 to 9 ]-------------------> 3 // 3 -----------------------[ . ]---------------------> 4 // 3 --------------------[ e or E ]-------------------> 5 // // 4 --------------------[ 0 to 9 ]-------------------> 4 // 4 --------------------[ e or E ]-------------------> 5 // // 5 ---------------[ + or - or 0 to 9 ]--------------> 6 // // 7 -----------------------[ ' ]---------------------> 8 // // 8 --------------------[ 0 or 1 ]-------------------> 8 // 8 -----------------------[ ' ]---------------------> 9 // // State 1 may be reached by negative numbers. // State 2 is reached only by hex numbers. // State 4 is reached only by float numbers. // State 5 is reached only by numbers in approximate form. // State 7 is reached only by numbers in bit representation. // // Valid final states are: 2, 3, 4 and 6. Any parsing that finished in a // state other than these is invalid. $iBak = $this->last; $token = ''; $flags = 0; $state = 1; for (; $this->last < $this->len; ++$this->last) { if ($state === 1) { if ($this->str[$this->last] === '-') { $flags |= Token::FLAG_NUMBER_NEGATIVE; } elseif ($this->last + 1 < $this->len && $this->str[$this->last] === '0' && ( $this->str[$this->last + 1] === 'x' || $this->str[$this->last + 1] === 'X' ) ) { $token .= $this->str[$this->last++]; $state = 2; } elseif ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') { $state = 3; } elseif ($this->str[$this->last] === '.') { $state = 4; } elseif ($this->str[$this->last] === 'b') { $state = 7; } elseif ($this->str[$this->last] !== '+') { // `+` is a valid character in a number. break; } } elseif ($state === 2) { $flags |= Token::FLAG_NUMBER_HEX; if (! ( ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') ) ) { break; } } elseif ($state === 3) { if ($this->str[$this->last] === '.') { $state = 4; } elseif ($this->str[$this->last] === 'e' || $this->str[$this->last] === 'E') { $state = 5; } elseif ($this->str[$this->last] < '0' || $this->str[$this->last] > '9') { // Just digits and `.`, `e` and `E` are valid characters. break; } } elseif ($state === 4) { $flags |= Token::FLAG_NUMBER_FLOAT; if ($this->str[$this->last] === 'e' || $this->str[$this->last] === 'E') { $state = 5; } elseif ($this->str[$this->last] < '0' || $this->str[$this->last] > '9') { // Just digits, `e` and `E` are valid characters. break; } } elseif ($state === 5) { $flags |= Token::FLAG_NUMBER_APPROXIMATE; if ($this->str[$this->last] === '+' || $this->str[$this->last] === '-' || ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') ) { $state = 6; } else { break; } } elseif ($state === 6) { if ($this->str[$this->last] < '0' || $this->str[$this->last] > '9') { // Just digits are valid characters. break; } } elseif ($state === 7) { $flags |= Token::FLAG_NUMBER_BINARY; if ($this->str[$this->last] === '\'') { $state = 8; } else { break; } } elseif ($state === 8) { if ($this->str[$this->last] === '\'') { $state = 9; } elseif ($this->str[$this->last] !== '0' && $this->str[$this->last] !== '1' ) { break; } } elseif ($state === 9) { break; } $token .= $this->str[$this->last]; } if ($state === 2 || $state === 3 || ($token !== '.' && $state === 4) || $state === 6 || $state === 9 ) { --$this->last; return new Token($token, Token::TYPE_NUMBER, $flags); } $this->last = $iBak; return null; } /** * Parses a string. * * @param string $quote additional starting symbol * * @return null|Token * @throws LexerException */ public function parseString($quote = '') { $token = $this->str[$this->last]; if (! ($flags = Context::isString($token)) && $token !== $quote) { return null; } $quote = $token; while (++$this->last < $this->len) { if ($this->last + 1 < $this->len && ( ($this->str[$this->last] === $quote && $this->str[$this->last + 1] === $quote) || ($this->str[$this->last] === '\\' && $quote !== '`') ) ) { $token .= $this->str[$this->last] . $this->str[++$this->last]; } else { if ($this->str[$this->last] === $quote) { break; } $token .= $this->str[$this->last]; } } if ($this->last >= $this->len || $this->str[$this->last] !== $quote) { $this->error( sprintf( Translator::gettext('Ending quote %1$s was expected.'), $quote ), '', $this->last ); } else { $token .= $this->str[$this->last]; } return new Token($token, Token::TYPE_STRING, $flags); } /** * Parses a symbol. * * @return null|Token * @throws LexerException */ public function parseSymbol() { $token = $this->str[$this->last]; if (! ($flags = Context::isSymbol($token))) { return null; } if ($flags & Token::FLAG_SYMBOL_VARIABLE) { if ($this->last + 1 < $this->len && $this->str[++$this->last] === '@') { // This is a system variable (e.g. `@@hostname`). $token .= $this->str[$this->last++]; $flags |= Token::FLAG_SYMBOL_SYSTEM; } } elseif ($flags & Token::FLAG_SYMBOL_PARAMETER) { if ($token !== '?' && $this->last + 1 < $this->len) { ++$this->last; } } else { $token = ''; } $str = null; if ($this->last < $this->len) { if (($str = $this->parseString('`')) === null) { if (($str = $this->parseUnknown()) === null) { $this->error( 'Variable name was expected.', $this->str[$this->last], $this->last ); } } } if ($str !== null) { $token .= $str->token; } return new Token($token, Token::TYPE_SYMBOL, $flags); } /** * Parses unknown parts of the query. * * @return null|Token */ public function parseUnknown() { $token = $this->str[$this->last]; if (Context::isSeparator($token)) { return null; } while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { $token .= $this->str[$this->last]; } --$this->last; return new Token($token); } /** * Parses the delimiter of the query. * * @return null|Token */ public function parseDelimiter() { $idx = 0; while ($idx < $this->delimiterLen && $this->last + $idx < $this->len) { if ($this->delimiter[$idx] !== $this->str[$this->last + $idx]) { return null; } ++$idx; } $this->last += $this->delimiterLen - 1; return new Token($this->delimiter, Token::TYPE_DELIMITER); } } sql-parser/src/Components/Key.php 0000644 00000012662 14736103337 0013030 0 ustar 00 <?php /** * Parses the definition of a key. */ 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. */ class Key extends Component { /** * All key options. * * @var array */ public static $KEY_OPTIONS = [ 'KEY_BLOCK_SIZE' => [ 1, 'var', ], 'USING' => [ 2, 'var', ], 'WITH PARSER' => [ 3, 'var', ], 'COMMENT' => [ 4, 'var=', ], ]; /** * The name of this key. * * @var string */ public $name; /** * Columns. * * @var array */ public $columns; /** * The type of this key. * * @var string */ public $type; /** * The options of this key. * * @var OptionsArray */ public $options; /** * @param string $name the name of the key * @param array $columns the columns covered by this key * @param string $type the type of this key * @param OptionsArray $options the options of this key */ 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 $options parameters for parsing * * @return Key */ public static function parse(Parser $parser, TokensList $list, array $options = []) { $ret = new static(); /** * Last parsed column. * * @var array */ $lastColumn = []; /** * The state of the parser. * * Below are the states of the parser. * * 0 ----------------------[ type ]-----------------------> 1 * * 1 ----------------------[ name ]-----------------------> 1 * 1 ---------------------[ columns ]---------------------> 2 * * 2 ---------------------[ options ]---------------------> 3 * * @var int */ $state = 0; for (; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { $ret->type = $token->value; $state = 1; } elseif ($state === 1) { if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { $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 = []; } } } 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; } } --$list->idx; return $ret; } /** * @param Key $component the component to be built * @param array $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) . ' '; } $columns = []; foreach ($component->columns as $column) { $tmp = Context::escape($column['name']); if (isset($column['length'])) { $tmp .= '(' . $column['length'] . ')'; } $columns[] = $tmp; } $ret .= '(' . implode(',', $columns) . ') ' . $component->options; return trim($ret); } } sql-parser/src/Components/GroupKeyword.php 0000644 00000006566 14736103337 0014747 0 ustar 00 <?php /** * `GROUP BY` keyword parser. */ 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. */ class GroupKeyword extends Component { 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $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); } } sql-parser/src/Components/PartitionDefinition.php 0000644 00000015675 14736103337 0016271 0 ustar 00 <?php /** * Parses the create definition of a partition. * * Used for parsing `CREATE TABLE` statement. */ 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. */ class PartitionDefinition extends Component { /** * All field options. * * @var array */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $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 ); } } sql-parser/src/Components/IndexHint.php 0000644 00000014445 14736103337 0014173 0 ustar 00 <?php /** * Parses an Index hint. */ 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. */ 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 array */ 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 array $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } switch ($state) { case 0: if ($token->type === Token::TYPE_KEYWORD) { if ($token->keyword === 'USE' || $token->keyword === 'IGNORE' || $token->keyword === 'FORCE') { $expr->type = $token->keyword; $state = 1; } else { break 2; } } 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 $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); } } sql-parser/src/Components/ParameterDefinition.php 0000644 00000011147 14736103337 0016226 0 ustar 00 <?php /** * The definition of a parameter of a function or procedure. */ 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. */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $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 ); } } sql-parser/src/Components/AlterOperation.php 0000644 00000022144 14736103337 0015224 0 ustar 00 <?php /** * Parses an alter operation. */ 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; /** * Parses an alter operation. */ class AlterOperation extends Component { /** * All database options. * * @var array */ 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 */ 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, 'CHECK' => 1, 'COALESCE' => 1, 'CONVERT' => 1, 'DISABLE' => 1, 'DISCARD' => 1, 'DROP' => 1, 'ENABLE' => 1, 'IMPORT' => 1, 'MODIFY' => 1, 'OPTIMIZE' => 1, 'ORDER' => 1, 'PARTITION' => 1, 'REBUILD' => 1, 'REMOVE' => 1, 'RENAME' => 1, 'REORGANIZE' => 1, 'REPAIR' => 1, 'UPGRADE' => 1, 'COLUMN' => 2, 'CONSTRAINT' => 2, 'DEFAULT' => 2, 'TO' => 2, 'BY' => 2, 'FOREIGN' => 2, 'FULLTEXT' => 2, 'KEY' => 2, 'KEYS' => 2, 'PARTITIONING' => 2, 'PRIMARY KEY' => 2, 'SPATIAL' => 2, 'TABLESPACE' => 2, 'INDEX' => 2, ]; /** * All view options. * * @var array */ public static $VIEW_OPTIONS = ['AS' => 1]; /** * Options of this operation. * * @var OptionsArray */ public $options; /** * The altered field. * * @var Expression */ public $field; /** * Unparsed tokens. * * @var Token[]|string */ public $unknown = []; /** * @param OptionsArray $options options of alter operation * @param Expression $field altered field * @param array $unknown unparsed tokens found at the end of operation */ public function __construct( $options = null, $field = null, $unknown = [] ) { $this->options = $options; $this->field = $field; $this->unknown = $unknown; } /** * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @return AlterOperation */ public static function parse(Parser $parser, TokensList $list, array $options = []) { $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 * * 2 -------------------------[ , ]-----------------------> 0 * * @var int */ $state = 0; for (; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping comments. if ($token->type === Token::TYPE_COMMENT) { continue; } // Skipping whitespaces. if ($token->type === Token::TYPE_WHITESPACE) { if ($state === 2) { // When parsing the unknown part, the whitespaces are // included to not break anything. $ret->unknown[] = $token; } continue; } if ($state === 0) { $ret->options = OptionsArray::parse($parser, $list, $options); if ($ret->options->has('AS')) { for (; $list->idx < $list->count; ++$list->idx) { if ($list->tokens[$list->idx]->type === Token::TYPE_DELIMITER) { break; } $ret->unknown[] = $list->tokens[$list->idx]; } break; } $state = 1; } elseif ($state === 1) { $ret->field = Expression::parse( $parser, $list, [ '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 ($token->type === Token::TYPE_OPERATOR) { if ($token->value === '(') { ++$brackets; } elseif ($token->value === ')') { --$brackets; } elseif (($token->value === ',') && ($brackets === 0)) { break; } } elseif (! empty(Parser::$STATEMENT_PARSERS[$token->value])) { // We have reached the end of ALTER operation and suddenly found // a start to new statement, but have not find a delimiter between them if (! ($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) { $parser->error( 'A new statement was found, but no delimiter between it and the previous one.', $token ); break; } } elseif ((array_key_exists($token->value, self::$DB_OPTIONS) || array_key_exists($token->value, self::$TABLE_OPTIONS)) && ! self::checkIfColumnDefinitionKeyword($token->value) ) { // This alter operation has finished, which means a comma // was missing before start of new alter operation $parser->error( 'Missing comma before start of a new alter operation.', $token ); break; } $ret->unknown[] = $token; } } if ($ret->options->isEmpty()) { $parser->error( 'Unrecognized alter operation.', $list->tokens[$list->idx] ); } --$list->idx; return $ret; } /** * @param AlterOperation $component the component to be built * @param array $options parameters for building * * @return string */ public static function build($component, array $options = []) { $ret = $component->options . ' '; if (isset($component->field) && ($component->field !== '')) { $ret .= $component->field . ' '; } $ret .= TokensList::build($component->unknown); return $ret; } /** * Check if token's value is one of the common keywords * between column and table alteration * * @param string $tokenValue Value of current token * * @return bool */ private static function checkIfColumnDefinitionKeyword($tokenValue) { $common_options = [ 'AUTO_INCREMENT', 'COMMENT', 'DEFAULT', 'CHARACTER SET', 'COLLATE', 'PRIMARY', 'UNIQUE', 'PRIMARY KEY', 'UNIQUE KEY', ]; // Since these options can be used for // both table as well as a specific column in the table return in_array($tokenValue, $common_options); } } sql-parser/src/Components/CaseExpression.php 0000644 00000023525 14736103337 0015233 0 ustar 00 <?php /** * Parses a reference to a CASE expression. */ 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. */ class CaseExpression extends Component { /** * The value to be compared. * * @var Expression */ public $value; /** * The conditions in WHEN clauses. * * @var array */ public $conditions = []; /** * The results matching with the WHEN clauses. * * @var array */ public $results = []; /** * The values to be compared against. * * @var array */ public $compare_values = []; /** * The result in ELSE section of expr. * * @var Expression */ public $else_result; /** * The alias of this CASE statement. * * @var string */ public $alias; /** * The sub-expression. * * @var string */ public $expr = ''; public function __construct() { } /** * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @return CaseExpression */ public static function parse(Parser $parser, TokensList $list, array $options = []) { $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. * * @var Token */ $token = $list->tokens[$list->idx]; // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT) ) { continue; } if ($state === 0) { if ($token->type === Token::TYPE_KEYWORD) { switch ($token->keyword) { case 'WHEN': ++$list->idx; // Skip 'WHEN' $new_condition = Condition::parse($parser, $list); $type = 1; $state = 1; $ret->conditions[] = $new_condition; break; case 'ELSE': ++$list->idx; // Skip 'ELSE' $ret->else_result = Expression::parse($parser, $list); $state = 0; // last clause of CASE expression break; case 'END': $state = 3; // end of CASE expression ++$list->idx; break 2; default: $parser->error('Unexpected keyword.', $token); break 2; } } else { $ret->value = Expression::parse($parser, $list); $type = 0; $state = 1; } } elseif ($state === 1) { if ($type === 0) { if ($token->type === Token::TYPE_KEYWORD) { switch ($token->keyword) { case 'WHEN': ++$list->idx; // Skip 'WHEN' $new_value = Expression::parse($parser, $list); $state = 2; $ret->compare_values[] = $new_value; break; case 'ELSE': ++$list->idx; // Skip 'ELSE' $ret->else_result = Expression::parse($parser, $list); $state = 0; // last clause of CASE expression break; case 'END': $state = 3; // end of CASE expression ++$list->idx; break 2; default: $parser->error('Unexpected keyword.', $token); break 2; } } } else { if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'THEN' ) { ++$list->idx; // Skip 'THEN' $new_result = Expression::parse($parser, $list); $state = 0; $ret->results[] = $new_result; } elseif ($token->type === Token::TYPE_KEYWORD) { $parser->error('Unexpected keyword.', $token); break; } } } elseif ($state === 2) { if ($type === 0) { if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'THEN' ) { ++$list->idx; // Skip 'THEN' $new_result = Expression::parse($parser, $list); $ret->results[] = $new_result; $state = 1; } elseif ($token->type === Token::TYPE_KEYWORD) { $parser->error('Unexpected keyword.', $token); break; } } } } if ($state !== 3) { $parser->error( 'Unexpected end of CASE expression', $list->tokens[$list->idx - 1] ); } else { // Parse for alias of CASE expression $asFound = false; for (; $list->idx < $list->count; ++$list->idx) { $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT) ) { continue; } // Handle optional AS keyword before alias if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'AS') { if ($asFound || ! empty($ret->alias)) { $parser->error('Potential duplicate alias of CASE expression.', $token); break; } $asFound = true; continue; } if ($asFound && $token->type === Token::TYPE_KEYWORD && ($token->flags & Token::FLAG_KEYWORD_RESERVED || $token->flags & Token::FLAG_KEYWORD_FUNCTION)) { $parser->error('An alias expected after AS but got ' . $token->value, $token); $asFound = false; break; } if ($asFound || $token->type === Token::TYPE_STRING || ($token->type === Token::TYPE_SYMBOL && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE) || $token->type === Token::TYPE_NONE ) { // An alias is expected (the keyword `AS` was previously found). if (! empty($ret->alias)) { $parser->error('An alias was previously found.', $token); break; } $ret->alias = $token->value; $asFound = false; continue; } break; } if ($asFound) { $parser->error('An alias was expected after AS.', $list->tokens[$list->idx - 1]); } $ret->expr = self::build($ret); } --$list->idx; return $ret; } /** * @param CaseExpression $component the component to be built * @param array $options parameters for building * * @return string */ public static function build($component, array $options = []) { $ret = 'CASE '; if (isset($component->value)) { // Syntax type 0 $ret .= $component->value . ' '; $val_cnt = count($component->compare_values); $res_cnt = count($component->results); for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) { $ret .= 'WHEN ' . $component->compare_values[$i] . ' '; $ret .= 'THEN ' . $component->results[$i] . ' '; } } else { // Syntax type 1 $val_cnt = count($component->conditions); $res_cnt = count($component->results); for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) { $ret .= 'WHEN ' . Condition::build($component->conditions[$i]) . ' '; $ret .= 'THEN ' . $component->results[$i] . ' '; } } if (isset($component->else_result)) { $ret .= 'ELSE ' . $component->else_result . ' '; } $ret .= 'END'; if ($component->alias) { $ret .= ' AS ' . Context::escape($component->alias); } return $ret; } } sql-parser/src/Components/Reference.php 0000644 00000007521 14736103337 0014174 0 ustar 00 <?php /** * `REFERENCES` keyword parser. */ 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. */ class Reference extends Component { /** * All references options. * * @var array */ 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 array */ public $columns; /** * The options of the referencing. * * @var OptionsArray */ public $options; /** * @param Expression $table the name of the table referenced * @param array $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $options parameters for building * * @return string */ public static function build($component, array $options = []) { return trim( $component->table . ' (' . implode(', ', Context::escape($component->columns)) . ') ' . $component->options ); } } sql-parser/src/Components/RenameOperation.php 0000644 00000011454 14736103337 0015366 0 ustar 00 <?php /** * `RENAME TABLE` keyword parser. */ 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. */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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') { $state = 2; } else { $parser->error( 'Keyword "TO" was expected.', $token ); break; } } 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 === ',')) { $ret[] = $expr; $expr = new static(); $state = 0; } else { break; } } } 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 $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; } } sql-parser/src/Components/UnionKeyword.php 0000644 00000001267 14736103337 0014734 0 ustar 00 <?php /** * `UNION` keyword builder. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; use PhpMyAdmin\SqlParser\Component; use function implode; /** * `UNION` keyword builder. */ class UnionKeyword extends Component { /** * @param array<UnionKeyword[]> $component the component to be built * @param array $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); } } sql-parser/src/Components/FunctionCall.php 0000644 00000005666 14736103337 0014667 0 ustar 00 <?php /** * Parses a function call. */ 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. */ class FunctionCall extends Component { /** * The name of this function. * * @var string */ public $name; /** * The list of parameters. * * @var ArrayObj */ public $parameters; /** * @param string $name the name of the function to be called * @param array|ArrayObj $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $options parameters for building * * @return string */ public static function build($component, array $options = []) { return $component->name . $component->parameters; } } sql-parser/src/Components/OrderKeyword.php 0000644 00000007012 14736103337 0014711 0 ustar 00 <?php /** * `ORDER BY` keyword parser. */ 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. */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $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; } } sql-parser/src/Components/Condition.php 0000644 00000013644 14736103337 0014227 0 ustar 00 <?php /** * `WHERE` keyword parser. */ 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. */ class Condition extends Component { /** * Logical operators that can be used to delimit expressions. * * @var array */ public static $DELIMITERS = [ '&&', '||', 'AND', 'OR', 'XOR', ]; /** * List of allowed reserved keywords in conditions. * * @var array */ 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, 'XOR' => 1, ]; /** * Identifiers recognized. * * @var array */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if ($token->type === Token::TYPE_COMMENT) { continue; } // Replacing all whitespaces (new lines, tabs, etc.) with a single // space character. if ($token->type === Token::TYPE_WHITESPACE) { $expr->expr .= ' '; continue; } // Conditions are delimited by logical operators. if (in_array($token->value, static::$DELIMITERS, true)) { if ($betweenBefore && ($token->value === 'AND')) { // The syntax of keyword `BETWEEN` is hard-coded. $betweenBefore = false; } else { // The expression ended. $expr->expr = trim($expr->expr); if (! empty($expr->expr)) { $ret[] = $expr; } // Adding the operator. $expr = new 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) ) { if (! in_array($token->value, $expr->identifiers)) { $expr->identifiers[] = $token->value; } } } // Last iteration was not processed. $expr->expr = trim($expr->expr); if (! empty($expr->expr)) { $ret[] = $expr; } --$list->idx; return $ret; } /** * @param Condition[] $component the component to be built * @param array $options parameters for building * * @return string */ public static function build($component, array $options = []) { if (is_array($component)) { return implode(' ', $component); } return $component->expr; } } sql-parser/src/Components/ArrayObj.php 0000644 00000011710 14736103337 0014002 0 ustar 00 <?php /** * Parses an array. */ 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. */ class ArrayObj extends Component { /** * The array that contains the unprocessed value of each token. * * @var array */ public $raw = []; /** * The array that contains the processed value of each token. * * @var array */ public $values = []; /** * @param array $raw the unprocessed values * @param array $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT) ) { $lastRaw .= $token->token; $lastValue = trim($lastValue) . ' '; continue; } if (($brackets === 0) && (($token->type !== Token::TYPE_OPERATOR) || ($token->value !== '(')) ) { $parser->error('An opening bracket was expected.', $token); break; } if ($token->type === Token::TYPE_OPERATOR) { if ($token->value === '(') { if (++$brackets === 1) { // 1 is the base level. continue; } } elseif ($token->value === ')') { if (--$brackets === 0) { // Array ended. break; } } elseif ($token->value === ',') { if ($brackets === 1) { $isCommaLast = true; if (empty($options['type'])) { $ret->raw[] = trim($lastRaw); $ret->values[] = trim($lastValue); $lastRaw = $lastValue = ''; } } continue; } } if (empty($options['type'])) { $lastRaw .= $token->token; $lastValue .= $token->value; } else { $ret[] = $options['type']::parse( $parser, $list, empty($options['typeOptions']) ? [] : $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 $options parameters for building * * @return string */ public static function build($component, array $options = []) { if (is_array($component)) { return implode(', ', $component); } elseif (! empty($component->raw)) { return '(' . implode(', ', $component->raw) . ')'; } return '(' . implode(', ', $component->values) . ')'; } } sql-parser/src/Components/OptionsArray.php 0000644 00000030226 14736103337 0014726 0 ustar 00 <?php /** * Parses a list of options. */ 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. */ class OptionsArray extends Component { /** * ArrayObj of selected options. * * @var array */ public $options = []; /** * @param array $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 $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. * * @var array */ $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping comments. if ($token->type === Token::TYPE_COMMENT) { continue; } // Skipping 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])) { $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++; } } else { // There is no option to be processed. break; } } 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) { if ($lastOption[1] === 'expr' || $lastOption[1] === 'expr=') { $ret->options[$lastOptionId]['expr'] = Expression::parse( $parser, $list, empty($lastOption[2]) ? [] : $lastOption[2] ); $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 $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|OptionsArray $options the options to be merged */ 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); } } sql-parser/src/Components/CreateDefinition.php 0000644 00000025110 14736103337 0015504 0 ustar 00 <?php /** * Parses the create definition of a column or a key. * * Used for parsing `CREATE TABLE` statement. */ 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. */ class CreateDefinition extends Component { /** * All field options. * * @var array */ 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], ], // 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 */ public $name; /** * Whether this field is a constraint or not. * * @var bool */ public $isConstraint; /** * The data type of thew new column. * * @var DataType */ public $type; /** * The key. * * @var Key */ public $key; /** * The table that is referenced. * * @var Reference */ public $references; /** * The options of this field. * * @var OptionsArray */ public $options; /** * @param string $name the name of the field * @param OptionsArray $options the options of this field * @param DataType|Key $type the data type of this field or the key * @param bool $isConstraint whether this field is a constraint or not * @param Reference $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { $state = 1; } else { $parser->error( 'An opening bracket was expected.', $token ); break; } } 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 $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); } } sql-parser/src/Components/ExpressionArray.php 0000644 00000007564 14736103337 0015443 0 ustar 00 <?php /** * Parses a list of expressions delimited by a comma. */ 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; /** * Parses a list of expressions delimited by a comma. */ 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 $options parameters for parsing * * @return Expression[] * @throws \PhpMyAdmin\SqlParser\Exceptions\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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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') ) { // 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 === ',') { $state = 0; } else { break; } } } 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 $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); } } sql-parser/src/Components/SetOperation.php 0000644 00000010243 14736103337 0014705 0 ustar 00 <?php /** * `SET` keyword parser. */ 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. */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } // No keyword is expected. if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($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 $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; } } sql-parser/src/Components/LockExpression.php 0000644 00000013313 14736103337 0015242 0 ustar 00 <?php /** * Parses a reference to a LOCK expression. */ 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. */ 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 $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. * * @var Token */ $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 $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; } 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. * * @var Token */ $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') { $lockType .= ' ' . $token->keyword; $state = 3; } else { $parser->error('Unexpected keyword.', $token); break; } } elseif ($state === 2) { if ($token->keyword === 'WRITE') { $lockType .= ' ' . $token->keyword; $state = 3; // parsing over } else { $parser->error('Unexpected keyword.', $token); break; } } $prevToken = $token; } // Only two possible end states if ($state !== 1 && $state !== 3) { $parser->error('Unexpected end of Lock expression.', $prevToken); } return $lockType; } } sql-parser/src/Components/DataType.php 0000644 00000011101 14736103337 0013776 0 ustar 00 <?php /** * Parses a data type. */ 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. */ class DataType extends Component { /** * All data type options. * * @var array */ 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 array */ public $parameters = []; /** * The options of this data type. * * @var OptionsArray */ public $options; /** * @param string $name the name of this data type * @param array $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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { $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 $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); } } sql-parser/src/Components/Array2d.php 0000644 00000007074 14736103337 0013605 0 ustar 00 <?php /** * `VALUES` keyword parser. */ 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. */ class Array2d extends Component { /** * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @return ArrayObj[] */ public static function parse(Parser $parser, TokensList $list, array $options = []) { $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } // No keyword is expected. if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED)) { break; } if ($state === 0) { if ($token->value === '(') { $arr = ArrayObj::parse($parser, $list, $options); $arrCount = count($arr->values); if ($count === -1) { $count = $arrCount; } elseif ($arrCount !== $count) { $parser->error( sprintf( Translator::gettext('%1$d values were expected, but found %2$d.'), $count, $arrCount ), $token ); } $ret[] = $arr; $state = 1; } else { break; } } elseif ($state === 1) { if ($token->value === ',') { $state = 0; } else { break; } } } if ($state === 0) { $parser->error( 'An opening bracket followed by a set of values was expected.', $list->tokens[$list->idx] ); } --$list->idx; return $ret; } /** * @param ArrayObj[] $component the component to be built * @param array $options parameters for building * * @return string */ public static function build($component, array $options = []) { return ArrayObj::build($component); } } sql-parser/src/Components/Limit.php 0000644 00000006161 14736103337 0013353 0 ustar 00 <?php /** * `LIMIT` keyword parser. */ 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. */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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 $options parameters for building * * @return string */ public static function build($component, array $options = []) { return $component->offset . ', ' . $component->rowCount; } } sql-parser/src/Components/Expression.php 0000644 00000035775 14736103337 0014451 0 ustar 00 <?php /** * Parses a reference to an expression (column, table or database name, function * call, mathematical expression, etc.). */ 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 strlen; use function trim; /** * Parses a reference to an expression (column, table or database name, function * call, mathematical expression, etc.). */ class Expression extends Component { /** * List of allowed reserved keywords in expressions. * * @var array */ private static $ALLOWED_KEYWORDS = [ 'AS' => 1, 'DUAL' => 1, 'NULL' => 1, 'REGEXP' => 1, 'CASE' => 1, 'DIV' => 1, 'AND' => 1, 'OR' => 1, 'XOR' => 1, 'NOT' => 1, 'MOD' => 1, ]; /** * The name of this database. * * @var string */ public $database; /** * The name of this table. * * @var string */ public $table; /** * The name of the column. * * @var string */ public $column; /** * The sub-expression. * * @var string */ public $expr = ''; /** * The alias of this expression. * * @var string */ public $alias; /** * The name of the function. * * @var mixed */ public $function; /** * The type of subquery. * * @var string */ 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 $database The name of the database or the the expression. * the the expression. * @param string $table The name of the table or the alias of the expression. * the alias of the expression. * @param string $column the name of the column * @param string $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 $options parameters for parsing * * @return Expression|null * @throws \PhpMyAdmin\SqlParser\Exceptions\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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT) ) { 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; } elseif ($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; } else { --$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 (/* (empty($ret->alias)) && */ ($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 { $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 $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; } } sql-parser/src/Components/JoinKeyword.php 0000644 00000014460 14736103337 0014542 0 ustar 00 <?php /** * `JOIN` keyword parser. */ 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. */ class JoinKeyword extends Component { /** * Types of join. * * @var array */ 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 $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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } if ($state === 0) { if (($token->type === Token::TYPE_KEYWORD) && ! empty(static::$JOINS[$token->keyword]) ) { $expr->type = static::$JOINS[$token->keyword]; $state = 1; } else { break; } } 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]) ) { $ret[] = $expr; $expr = new static(); $expr->type = static::$JOINS[$token->keyword]; $state = 1; } else { /* Next clause is starting */ break 2; } 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 $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); } } sql-parser/src/Components/IntoKeyword.php 0000644 00000017702 14736103337 0014556 0 ustar 00 <?php /** * `INTO` keyword parser. */ 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. */ class IntoKeyword extends Component { /** * FIELDS/COLUMNS Options for `SELECT...INTO` statements. * * @var array */ 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 */ public static $LINES_OPTIONS = [ 'STARTING BY' => [ 1, 'expr', ], 'TERMINATED BY' => [ 2, 'expr', ], ]; /** * Type of target (OUTFILE or SYMBOL). * * @var string */ public $type; /** * The destination, which can be a table or a file. * * @var string|Expression */ public $dest; /** * The name of the columns. * * @var array */ public $columns; /** * The values to be selected into (SELECT .. INTO @var1). * * @var Expression[] */ public $values; /** * Options for FIELDS/COLUMNS keyword. * * @see static::$FIELDS_OPTIONS * * @var OptionsArray */ public $fields_options; /** * Whether to use `FIELDS` or `COLUMNS` while building. * * @var bool */ public $fields_keyword; /** * Options for OPTIONS keyword. * * @see static::$LINES_OPTIONS * * @var OptionsArray */ public $lines_options; /** * @param string $type type of destination (may be OUTFILE) * @param string|Expression $dest actual destination * @param array $columns column list of destination * @param array $values selected fields * @param OptionsArray $fields_options options for FIELDS/COLUMNS keyword * @param bool $fields_keyword options for OPTIONS keyword */ public function __construct( $type = null, $dest = null, $columns = null, $values = null, $fields_options = null, $fields_keyword = null ) { $this->type = $type; $this->dest = $dest; $this->columns = $columns; $this->values = $values; $this->fields_options = $fields_options; $this->fields_keyword = $fields_keyword; } /** * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @return 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. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) { continue; } 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; } 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 $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; } elseif (isset($component->values)) { return ExpressionArray::build($component->values); } $ret = 'OUTFILE "' . $component->dest . '"'; $fields_options_str = OptionsArray::build($component->fields_options); if (trim($fields_options_str) !== '') { $ret .= $component->fields_keyword ? ' FIELDS' : ' COLUMNS'; $ret .= ' ' . $fields_options_str; } $lines_options_str = OptionsArray::build($component->lines_options, ['expr' => true]); if (trim($lines_options_str) !== '') { $ret .= ' LINES ' . $lines_options_str; } return $ret; } } sql-parser/src/Contexts/ContextMySql50100.php 0000644 00000042470 14736103337 0014762 0 ustar 00 <?php /** * Context for MySQL 5.1. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/5.1/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 5.1. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMariaDb100300.php 0000644 00000054020 14736103337 0015264 0 ustar 00 <?php /** * Context for MariaDB 10.3. * * This file was auto-generated. * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MariaDB 10.3. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, '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, '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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMySql50500.php 0000644 00000043136 14736103337 0014766 0 ustar 00 <?php /** * Context for MySQL 5.5. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/5.5/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 5.5. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMySql50700.php 0000644 00000053673 14736103337 0014777 0 ustar 00 <?php /** * Context for MySQL 5.7. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/5.7/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 5.7. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMariaDb100200.php 0000644 00000053736 14736103337 0015300 0 ustar 00 <?php /** * Context for MariaDB 10.2. * * This file was auto-generated. * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MariaDB 10.2. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, '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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMySql80000.php 0000644 00000054043 14736103337 0014763 0 ustar 00 <?php /** * Context for MySQL 8.0. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/8.0/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 8.0. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, '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, '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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMariaDb100100.php 0000644 00000053714 14736103337 0015273 0 ustar 00 <?php /** * Context for MariaDB 10.1. * * This file was auto-generated. * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MariaDB 10.1. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMariaDb100000.php 0000644 00000043157 14736103337 0015272 0 ustar 00 <?php /** * Context for MariaDB 10.0. * * This file was auto-generated. * * @see https://mariadb.com/kb/en/the-mariadb-library/reserved-words/ */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MariaDB 10.0. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMySql50000.php 0000644 00000037300 14736103337 0014755 0 ustar 00 <?php /** * Context for MySQL 5.0. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/5.0/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 5.0. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Contexts/ContextMySql50600.php 0000644 00000050217 14736103337 0014765 0 ustar 00 <?php /** * Context for MySQL 5.6. * * This file was auto-generated. * * @see https://dev.mysql.com/doc/refman/5.6/en/keywords.html */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Contexts; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Token; /** * Context for MySQL 5.6. * * @category Contexts * * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ 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 */ 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, 'EXISTS' => 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, '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, '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, '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, '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, '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, 'MULTIPOINT' => 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, 'MULTIPOLYGON' => 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, '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, 'MULTILINESTRING' => 41, 'GEOMETRYCOLLECTION' => 41, 'CHAR' => 43, 'BINARY' => 43, 'INTERVAL' => 43, ]; } sql-parser/src/Statement.php 0000644 00000043400 14736103337 0012111 0 ustar 00 <?php /** * 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. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use PhpMyAdmin\SqlParser\Components\FunctionCall; use PhpMyAdmin\SqlParser\Components\OptionsArray; use function array_flip; use function array_keys; use function count; use function in_array; use function stripos; use function trim; /** * Abstract statement definition. */ abstract class Statement { /** * 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 */ 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 */ public static $CLAUSES = []; public static $END_OPTIONS = []; /** * The options of this query. * * @see static::$OPTIONS * * @var OptionsArray */ public $options; /** * The index of the first token used in this statement. * * @var int */ public $first; /** * The index of the last token used in this statement. * * @var int */ public $last; /** * @param Parser $parser the instance that requests parsing * @param TokensList $list the list of tokens to be parsed */ public function __construct(Parser $parser = null, TokensList $list = null) { if (($parser !== null) && ($list !== null)) { $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. * * @var array */ $built = []; /** * Statement's clauses. * * @var array */ $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) { $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 * @throws Exceptions\ParserException */ public function parse(Parser $parser, TokensList $list) { /** * Array containing all list of clauses parsed. * This is used to check for duplicates. * * @var array */ $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. * * @var bool */ $parsedOptions = empty(static::$OPTIONS); for (; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment. * * @var Token */ $token = $list->tokens[$list->idx]; // End of statement. if ($token->type === Token::TYPE_DELIMITER) { break; } // 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. * * @var array */ $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. $token_value = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value; if (! empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { $class = Parser::$KEYWORD_PARSERS[$token_value]['class']; $field = Parser::$KEYWORD_PARSERS[$token_value]['field']; if (! empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { $options = Parser::$KEYWORD_PARSERS[$token_value]['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 ) { --$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 */ 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 */ public function after(Parser $parser, TokensList $list, Token $token) { } /** * Gets the clauses of this statement. * * @return array */ 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; } } sql-parser/src/Component.php 0000644 00000004064 14736103337 0012112 0 ustar 00 <?php /** * Defines a component that is later extended to parse specialized components or * keywords. * * There is a small difference between *Component and *Keyword classes: usually, * *Component parsers can be reused in multiple situations and *Keyword parsers * count on the *Component classes to do their job. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use Exception; /** * A component (of a statement) is a part of a statement that is common to * multiple query types. */ abstract class Component { /** * Parses the tokens contained in the given list in the context of the given * parser. * * @param Parser $parser the parser that serves as context * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @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 $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); } } sql-parser/src/TokensList.php 0000644 00000010632 14736103337 0012245 0 ustar 00 <?php /** * Defines an array of tokens and utility functions to iterate through it. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use ArrayAccess; use function count; use function is_array; use function is_string; /** * A structure representing a list of tokens. */ class TokensList implements ArrayAccess { /** * The array of tokens. * * @var array */ public $tokens = []; /** * The count of tokens. * * @var int */ public $count = 0; /** * The index of the next token to be returned. * * @var int */ public $idx = 0; /** * @param array $tokens the initial array of tokens * @param int $count the count of tokens in the initial array */ public function __construct(array $tokens = [], $count = -1) { if (! empty($tokens)) { $this->tokens = $tokens; if ($count === -1) { $this->count = count($tokens); } } } /** * Builds an array of tokens by merging their raw value. * * @param string|Token[]|TokensList $list the tokens to be built * * @return string */ public static function build($list) { if (is_string($list)) { return $list; } if ($list instanceof self) { $list = $list->tokens; } $ret = ''; if (is_array($list)) { foreach ($list as $tok) { $ret .= $tok->token; } } return $ret; } /** * Adds a new token. * * @param Token $token token to be added in list */ public function add(Token $token) { $this->tokens[$this->count++] = $token; } /** * Gets the next token. Skips any irrelevant token (whitespaces and * comments). * * @return Token|null */ public function getNext() { for (; $this->idx < $this->count; ++$this->idx) { if (($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE) && ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT) ) { return $this->tokens[$this->idx++]; } } return null; } /** * Gets the next token. * * @param int $type the type * * @return Token|null */ public function getNextOfType($type) { for (; $this->idx < $this->count; ++$this->idx) { if ($this->tokens[$this->idx]->type === $type) { return $this->tokens[$this->idx++]; } } return null; } /** * Gets the next token. * * @param int $type the type of the token * @param string $value the value of the token * * @return Token|null */ public function getNextOfTypeAndValue($type, $value) { for (; $this->idx < $this->count; ++$this->idx) { if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value) ) { return $this->tokens[$this->idx++]; } } return null; } /** * Sets an value inside the container. * * @param int $offset the offset to be set * @param Token $value the token to be saved */ public function offsetSet($offset, $value) { if ($offset === null) { $this->tokens[$this->count++] = $value; } else { $this->tokens[$offset] = $value; } } /** * Gets a value from the container. * * @param int $offset the offset to be returned * * @return Token */ public function offsetGet($offset) { return $offset < $this->count ? $this->tokens[$offset] : null; } /** * Checks if an offset was previously set. * * @param int $offset the offset to be checked * * @return bool */ public function offsetExists($offset) { return $offset < $this->count; } /** * Unsets the value of an offset. * * @param int $offset the offset to be unset */ public function offsetUnset($offset) { unset($this->tokens[$offset]); --$this->count; for ($i = $offset; $i < $this->count; ++$i) { $this->tokens[$i] = $this->tokens[$i + 1]; } unset($this->tokens[$this->count]); } } sql-parser/src/Core.php 0000644 00000001753 14736103337 0011042 0 ustar 00 <?php /** * Defines the core helper infrastructure of the library. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use Exception; 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 * * @throws Exception throws the exception, if strict mode is enabled. */ public function error($error) { if ($this->strict) { throw $error; } $this->errors[] = $error; } } sql-parser/src/Utils/Error.php 0000644 00000005502 14736103337 0012337 0 ustar 00 <?php /** * Error related utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Exceptions\LexerException; use PhpMyAdmin\SqlParser\Exceptions\ParserException; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use function htmlspecialchars; use function sprintf; /** * Error related utilities. */ class Error { /** * Gets the errors of a lexer and a parser. * * @param array $objs objects from where the errors will be extracted * * @return array Each element of the array represents an error. * `$err[0]` holds the error message. * `$err[1]` holds the error code. * `$err[2]` holds the string that caused the issue. * `$err[3]` holds the position of the string. * (i.e. `[$msg, $code, $str, $pos]`) */ public static function get($objs) { $ret = []; foreach ($objs as $obj) { if ($obj instanceof Lexer) { /** @var LexerException $err */ foreach ($obj->errors as $err) { $ret[] = [ $err->getMessage(), $err->getCode(), $err->ch, $err->pos, ]; } } elseif ($obj instanceof Parser) { /** @var ParserException $err */ foreach ($obj->errors as $err) { $ret[] = [ $err->getMessage(), $err->getCode(), $err->token->token, $err->token->position, ]; } } } return $ret; } /** * Formats the specified errors. * * @param array $errors the errors to be formatted * @param string $format The format of an error. * '$1$d' is replaced by the position of this error. * '$2$s' is replaced by the error message. * '$3$d' is replaced by the error code. * '$4$s' is replaced by the string that caused the * issue. * '$5$d' is replaced by the position of the string. * * @return array */ public static function format( $errors, $format = '#%1$d: %2$s (near "%4$s" at position %5$d)' ) { $ret = []; $i = 0; foreach ($errors as $key => $err) { $ret[$key] = sprintf( $format, ++$i, $err[0], $err[1], htmlspecialchars((string) $err[2]), $err[3] ); } return $ret; } } sql-parser/src/Utils/Formatter.php 0000644 00000053752 14736103337 0013223 0 ustar 00 <?php /** * Utilities that are used for formatting queries. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Components\JoinKeyword; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\SqlParser\TokensList; use function array_merge; use function array_pop; use function end; use function htmlspecialchars; use function in_array; use function mb_strlen; use function str_repeat; use function str_replace; use function strpos; use function strtoupper; use const ENT_NOQUOTES; use const PHP_SAPI; /** * Utilities that are used for formatting queries. */ class Formatter { /** * The formatting options. * * @var array */ public $options; /** * Clauses that are usually short. * * These clauses share the line with the next clause. * * E.g. if INSERT was not here, the formatter would produce: * * INSERT * INTO foo * VALUES(0, 0, 0),(1, 1, 1); * * Instead of: * * INSERT INTO foo * VALUES(0, 0, 0),(1, 1, 1) * * @var array */ public static $SHORT_CLAUSES = [ 'CREATE' => true, 'INSERT' => true, ]; /** * Clauses that must be inlined. * * These clauses usually are short and it's nicer to have them inline. * * @var array */ public static $INLINE_CLAUSES = [ 'CREATE' => true, 'INTO' => true, 'LIMIT' => true, 'PARTITION BY' => true, 'PARTITION' => true, 'PROCEDURE' => true, 'SUBPARTITION BY' => true, 'VALUES' => true, ]; /** * @param array $options the formatting options */ public function __construct(array $options = []) { $this->options = $this->getMergedOptions($options); } /** * The specified formatting options are merged with the default values. * * @param array $options * * @return array */ private function getMergedOptions(array $options) { $options = array_merge( $this->getDefaultOptions(), $options ); if (isset($options['formats'])) { $options['formats'] = self::mergeFormats($this->getDefaultFormats(), $options['formats']); } else { $options['formats'] = $this->getDefaultFormats(); } if ($options['line_ending'] === null) { $options['line_ending'] = $options['type'] === 'html' ? '<br/>' : "\n"; } if ($options['indentation'] === null) { $options['indentation'] = $options['type'] === 'html' ? ' ' : ' '; } // `parts_newline` requires `clause_newline` $options['parts_newline'] &= $options['clause_newline']; return $options; } /** * The default formatting options. * * @return array */ protected function getDefaultOptions() { return [ /* * The format of the result. * * @var string The type ('text', 'cli' or 'html') */ 'type' => PHP_SAPI === 'cli' ? 'cli' : 'text', /* * The line ending used. * By default, for text this is "\n" and for HTML this is "<br/>". * * @var string */ 'line_ending' => null, /* * The string used for indentation. * * @var string */ 'indentation' => null, /* * Whether comments should be removed or not. * * @var bool */ 'remove_comments' => false, /* * Whether each clause should be on a new line. * * @var bool */ 'clause_newline' => true, /* * Whether each part should be on a new line. * Parts are delimited by brackets and commas. * * @var bool */ 'parts_newline' => true, /* * Whether each part of each clause should be indented. * * @var bool */ 'indent_parts' => true, ]; } /** * The styles used for HTML formatting. * [$type, $flags, $span, $callback]. * * @return array */ protected function getDefaultFormats() { return [ [ 'type' => Token::TYPE_KEYWORD, 'flags' => Token::FLAG_KEYWORD_RESERVED, 'html' => 'class="sql-reserved"', 'cli' => "\x1b[35m", 'function' => 'strtoupper', ], [ 'type' => Token::TYPE_KEYWORD, 'flags' => 0, 'html' => 'class="sql-keyword"', 'cli' => "\x1b[95m", 'function' => 'strtoupper', ], [ 'type' => Token::TYPE_COMMENT, 'flags' => 0, 'html' => 'class="sql-comment"', 'cli' => "\x1b[37m", 'function' => '', ], [ 'type' => Token::TYPE_BOOL, 'flags' => 0, 'html' => 'class="sql-atom"', 'cli' => "\x1b[36m", 'function' => 'strtoupper', ], [ 'type' => Token::TYPE_NUMBER, 'flags' => 0, 'html' => 'class="sql-number"', 'cli' => "\x1b[92m", 'function' => 'strtolower', ], [ 'type' => Token::TYPE_STRING, 'flags' => 0, 'html' => 'class="sql-string"', 'cli' => "\x1b[91m", 'function' => '', ], [ 'type' => Token::TYPE_SYMBOL, 'flags' => Token::FLAG_SYMBOL_PARAMETER, 'html' => 'class="sql-parameter"', 'cli' => "\x1b[31m", 'function' => '', ], [ 'type' => Token::TYPE_SYMBOL, 'flags' => 0, 'html' => 'class="sql-variable"', 'cli' => "\x1b[36m", 'function' => '', ], ]; } private static function mergeFormats(array $formats, array $newFormats) { $added = []; $integers = [ 'flags', 'type', ]; $strings = [ 'html', 'cli', 'function', ]; /* Sanitize the array so that we do not have to care later */ foreach ($newFormats as $j => $new) { foreach ($integers as $name) { if (! isset($new[$name])) { $newFormats[$j][$name] = 0; } } foreach ($strings as $name) { if (! isset($new[$name])) { $newFormats[$j][$name] = ''; } } } /* Process changes to existing formats */ foreach ($formats as $i => $original) { foreach ($newFormats as $j => $new) { if ($new['type'] === $original['type'] && $original['flags'] === $new['flags'] ) { $formats[$i] = $new; $added[] = $j; } } } /* Add not already handled formats */ foreach ($newFormats as $j => $new) { if (! in_array($j, $added)) { $formats[] = $new; } } return $formats; } /** * Formats the given list of tokens. * * @param TokensList $list the list of tokens * * @return string */ public function formatList($list) { /** * The query to be returned. * * @var string */ $ret = ''; /** * The indentation level. * * @var int */ $indent = 0; /** * Whether the line ended. * * @var bool */ $lineEnded = false; /** * Whether current group is short (no linebreaks). * * @var bool */ $shortGroup = false; /** * The name of the last clause. * * @var string */ $lastClause = ''; /** * A stack that keeps track of the indentation level every time a new * block is found. * * @var array */ $blocksIndentation = []; /** * A stack that keeps track of the line endings every time a new block * is found. * * @var array */ $blocksLineEndings = []; /** * Whether clause's options were formatted. * * @var bool */ $formattedOptions = false; /** * Previously parsed token. * * @var Token|null */ $prev = null; // In order to be able to format the queries correctly, the next token // must be taken into consideration. The loop below uses two pointers, // `$prev` and `$curr` which store two consecutive tokens. // Actually, at every iteration the previous token is being used. for ($list->idx = 0; $list->idx < $list->count; ++$list->idx) { /** * Token parsed at this moment. * * @var Token */ $curr = $list->tokens[$list->idx]; if ($list->idx + 1 < $list->count) { $next = $list->tokens[$list->idx + 1]; } else { $next = null; } if ($curr->type === Token::TYPE_WHITESPACE) { // Keep linebreaks before and after comments if (strpos($curr->token, "\n") !== false && ( ($prev !== null && $prev->type === Token::TYPE_COMMENT) || ($next !== null && $next->type === Token::TYPE_COMMENT) ) ) { $lineEnded = true; } // Whitespaces are skipped because the formatter adds its own. continue; } if ($curr->type === Token::TYPE_COMMENT && $this->options['remove_comments']) { // Skip Comments if option `remove_comments` is enabled continue; } // Checking if pointers were initialized. if ($prev !== null) { // Checking if a new clause started. if (static::isClause($prev) !== false) { $lastClause = $prev->value; $formattedOptions = false; } // The options of a clause should stay on the same line and everything that follows. if ($this->options['parts_newline'] && ! $formattedOptions && empty(self::$INLINE_CLAUSES[$lastClause]) && ( $curr->type !== Token::TYPE_KEYWORD || ( $curr->type === Token::TYPE_KEYWORD && $curr->flags & Token::FLAG_KEYWORD_FUNCTION ) ) ) { $formattedOptions = true; $lineEnded = true; ++$indent; } // Checking if this clause ended. if ($isClause = static::isClause($curr)) { if (($isClause === 2 || $this->options['clause_newline']) && empty(self::$SHORT_CLAUSES[$lastClause]) ) { $lineEnded = true; if ($this->options['parts_newline'] && $indent > 0) { --$indent; } } } // Inline JOINs if (($prev->type === Token::TYPE_KEYWORD && isset(JoinKeyword::$JOINS[$prev->value])) || (in_array($curr->value, ['ON', 'USING'], true) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 2]->value])) || isset($list->tokens[$list->idx - 4], JoinKeyword::$JOINS[$list->tokens[$list->idx - 4]->value]) || isset($list->tokens[$list->idx - 6], JoinKeyword::$JOINS[$list->tokens[$list->idx - 6]->value]) ) { $lineEnded = false; } // Indenting BEGIN ... END blocks. if ($prev->type === Token::TYPE_KEYWORD && $prev->keyword === 'BEGIN') { $lineEnded = true; $blocksIndentation[] = $indent; ++$indent; } elseif ($curr->type === Token::TYPE_KEYWORD && $curr->keyword === 'END') { $lineEnded = true; $indent = array_pop($blocksIndentation); } // Formatting fragments delimited by comma. if ($prev->type === Token::TYPE_OPERATOR && $prev->value === ',') { // Fragments delimited by a comma are broken into multiple // pieces only if the clause is not inlined or this fragment // is between brackets that are on new line. if (end($blocksLineEndings) === true || ( empty(self::$INLINE_CLAUSES[$lastClause]) && ! $shortGroup && $this->options['parts_newline'] ) ) { $lineEnded = true; } } // Handling brackets. // Brackets are indented only if the length of the fragment between // them is longer than 30 characters. if ($prev->type === Token::TYPE_OPERATOR && $prev->value === '(') { $blocksIndentation[] = $indent; $shortGroup = true; if (static::getGroupLength($list) > 30) { ++$indent; $lineEnded = true; $shortGroup = false; } $blocksLineEndings[] = $lineEnded; } elseif ($curr->type === Token::TYPE_OPERATOR && $curr->value === ')') { $indent = array_pop($blocksIndentation); $lineEnded |= array_pop($blocksLineEndings); $shortGroup = false; } // Adding the token. $ret .= $this->toString($prev); // Finishing the line. if ($lineEnded) { $ret .= $this->options['line_ending'] . str_repeat($this->options['indentation'], (int) $indent); $lineEnded = false; } else { // If the line ended there is no point in adding whitespaces. // Also, some tokens do not have spaces before or after them. if (// A space after delimiters that are longer than 2 characters. $prev->keyword === 'DELIMITER' || ! ( ($prev->type === Token::TYPE_OPERATOR && ($prev->value === '.' || $prev->value === '(')) // No space after . ( || ($curr->type === Token::TYPE_OPERATOR && ($curr->value === '.' || $curr->value === ',' || $curr->value === '(' || $curr->value === ')')) // No space before . , ( ) || $curr->type === Token::TYPE_DELIMITER && mb_strlen((string) $curr->value, 'UTF-8') < 2 ) ) { $ret .= ' '; } } } // Iteration finished, consider current token as previous. $prev = $curr; } if ($this->options['type'] === 'cli') { return $ret . "\x1b[0m"; } return $ret; } public function escapeConsole($string) { return str_replace( [ "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F", ], [ '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', '\x1E', '\x1F', ], $string ); } /** * Tries to print the query and returns the result. * * @param Token $token the token to be printed * * @return string */ public function toString($token) { $text = $token->token; static $prev; foreach ($this->options['formats'] as $format) { if ($token->type === $format['type'] && ($token->flags & $format['flags']) === $format['flags'] ) { // Running transformation function. if (! empty($format['function'])) { $func = $format['function']; $text = $func($text); } // Formatting HTML. if ($this->options['type'] === 'html') { return '<span ' . $format['html'] . '>' . htmlspecialchars($text, ENT_NOQUOTES) . '</span>'; } elseif ($this->options['type'] === 'cli') { if ($prev !== $format['cli']) { $prev = $format['cli']; return $format['cli'] . $this->escapeConsole($text); } return $this->escapeConsole($text); } break; } } if ($this->options['type'] === 'cli') { if ($prev !== "\x1b[39m") { $prev = "\x1b[39m"; return "\x1b[39m" . $this->escapeConsole($text); } return $this->escapeConsole($text); } elseif ($this->options['type'] === 'html') { return htmlspecialchars($text, ENT_NOQUOTES); } return $text; } /** * Formats a query. * * @param string $query The query to be formatted * @param array $options the formatting options * * @return string the formatted string */ public static function format($query, array $options = []) { $lexer = new Lexer($query); $formatter = new self($options); return $formatter->formatList($lexer->list); } /** * Computes the length of a group. * * A group is delimited by a pair of brackets. * * @param TokensList $list the list of tokens * * @return int */ public static function getGroupLength($list) { /** * The number of opening brackets found. * This counter starts at one because by the time this function called, * the list already advanced one position and the opening bracket was * already parsed. * * @var int */ $count = 1; /** * The length of this group. * * @var int */ $length = 0; for ($idx = $list->idx; $idx < $list->count; ++$idx) { // Counting the brackets. if ($list->tokens[$idx]->type === Token::TYPE_OPERATOR) { if ($list->tokens[$idx]->value === '(') { ++$count; } elseif ($list->tokens[$idx]->value === ')') { --$count; if ($count === 0) { break; } } } // Keeping track of this group's length. $length += mb_strlen((string) $list->tokens[$idx]->value, 'UTF-8'); } return $length; } /** * Checks if a token is a statement or a clause inside a statement. * * @param Token $token the token to be checked * * @return int|bool */ public static function isClause($token) { if (($token->type === Token::TYPE_KEYWORD && isset(Parser::$STATEMENT_PARSERS[$token->keyword])) || ($token->type === Token::TYPE_NONE && strtoupper($token->token) === 'DELIMITER') ) { return 2; } elseif ($token->type === Token::TYPE_KEYWORD && isset(Parser::$KEYWORD_PARSERS[$token->keyword]) ) { return 1; } return false; } } sql-parser/src/Utils/CLI.php 0000644 00000013424 14736103337 0011657 0 ustar 00 <?php /** * CLI interface. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Context; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use function count; use function getopt; use function implode; use function in_array; use function rtrim; use function stream_get_contents; use function stream_set_blocking; use function var_export; use const STDIN; /** * CLI interface. */ class CLI { public function mergeLongOpts(&$params, &$longopts) { foreach ($longopts as $value) { $value = rtrim($value, ':'); if (isset($params[$value])) { $params[$value[0]] = $params[$value]; } } } public function usageHighlight() { echo "Usage: highlight-query --query SQL [--format html|cli|text] [--ansi]\n"; echo " cat file.sql | highlight-query\n"; } public function getopt($opt, $long) { return getopt($opt, $long); } public function parseHighlight() { $longopts = [ 'help', 'query:', 'format:', 'ansi', ]; $params = $this->getopt( 'hq:f:a', $longopts ); if ($params === false) { return false; } $this->mergeLongOpts($params, $longopts); if (! isset($params['f'])) { $params['f'] = 'cli'; } if (! in_array($params['f'], ['html', 'cli', 'text'])) { echo "ERROR: Invalid value for format!\n"; return false; } return $params; } public function runHighlight() { $params = $this->parseHighlight(); if ($params === false) { return 1; } if (isset($params['h'])) { $this->usageHighlight(); return 0; } if (! isset($params['q'])) { if ($stdIn = $this->readStdin()) { $params['q'] = $stdIn; } } if (isset($params['a'])) { Context::setMode('ANSI_QUOTES'); } if (isset($params['q'])) { echo Formatter::format( $params['q'], ['type' => $params['f']] ); echo "\n"; return 0; } echo "ERROR: Missing parameters!\n"; $this->usageHighlight(); return 1; } public function usageLint() { echo "Usage: lint-query --query SQL [--ansi]\n"; echo " cat file.sql | lint-query\n"; } public function parseLint() { $longopts = [ 'help', 'query:', 'context:', 'ansi', ]; $params = $this->getopt( 'hq:c:a', $longopts ); $this->mergeLongOpts($params, $longopts); return $params; } public function runLint() { $params = $this->parseLint(); if ($params === false) { return 1; } if (isset($params['h'])) { $this->usageLint(); return 0; } if (isset($params['c'])) { Context::load($params['c']); } if (! isset($params['q'])) { if ($stdIn = $this->readStdin()) { $params['q'] = $stdIn; } } if (isset($params['a'])) { Context::setMode('ANSI_QUOTES'); } if (isset($params['q'])) { $lexer = new Lexer($params['q'], false); $parser = new Parser($lexer->list); $errors = Error::get([$lexer, $parser]); if (count($errors) === 0) { return 0; } $output = Error::format($errors); echo implode("\n", $output); echo "\n"; return 10; } echo "ERROR: Missing parameters!\n"; $this->usageLint(); return 1; } public function usageTokenize() { echo "Usage: tokenize-query --query SQL [--ansi]\n"; echo " cat file.sql | tokenize-query\n"; } public function parseTokenize() { $longopts = [ 'help', 'query:', 'ansi', ]; $params = $this->getopt( 'hq:a', $longopts ); $this->mergeLongOpts($params, $longopts); return $params; } public function runTokenize() { $params = $this->parseTokenize(); if ($params === false) { return 1; } if (isset($params['h'])) { $this->usageTokenize(); return 0; } if (! isset($params['q'])) { if ($stdIn = $this->readStdin()) { $params['q'] = $stdIn; } } if (isset($params['a'])) { Context::setMode('ANSI_QUOTES'); } if (isset($params['q'])) { $lexer = new Lexer($params['q'], false); foreach ($lexer->list->tokens as $idx => $token) { echo '[TOKEN ', $idx, "]\n"; echo 'Type = ', $token->type, "\n"; echo 'Flags = ', $token->flags, "\n"; echo 'Value = '; var_export($token->value); echo "\n"; echo 'Token = '; var_export($token->token); echo "\n"; echo "\n"; } return 0; } echo "ERROR: Missing parameters!\n"; $this->usageTokenize(); return 1; } public function readStdin() { stream_set_blocking(STDIN, false); $stdin = stream_get_contents(STDIN); // restore-default block-mode setting stream_set_blocking(STDIN, true); return $stdin; } } sql-parser/src/Utils/Table.php 0000644 00000007247 14736103337 0012305 0 ustar 00 <?php /** * Table utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Statements\CreateStatement; use function is_array; use function str_replace; /** * Table utilities. */ class Table { /** * Gets the foreign keys of the table. * * @param CreateStatement $statement the statement to be processed * * @return array */ public static function getForeignKeys($statement) { if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE')) ) { return []; } $ret = []; foreach ($statement->fields as $field) { if (empty($field->key) || ($field->key->type !== 'FOREIGN KEY')) { continue; } $columns = []; foreach ($field->key->columns as $column) { $columns[] = $column['name']; } $tmp = [ 'constraint' => $field->name, 'index_list' => $columns, ]; if (! empty($field->references)) { $tmp['ref_db_name'] = $field->references->table->database; $tmp['ref_table_name'] = $field->references->table->table; $tmp['ref_index_list'] = $field->references->columns; if ($opt = $field->references->options->has('ON UPDATE')) { $tmp['on_update'] = str_replace(' ', '_', $opt); } if ($opt = $field->references->options->has('ON DELETE')) { $tmp['on_delete'] = str_replace(' ', '_', $opt); } // if (($opt = $field->references->options->has('MATCH'))) { // $tmp['match'] = str_replace(' ', '_', $opt); // } } $ret[] = $tmp; } return $ret; } /** * Gets fields of the table. * * @param CreateStatement $statement the statement to be processed * * @return array */ public static function getFields($statement) { if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE')) ) { return []; } $ret = []; foreach ($statement->fields as $field) { // Skipping keys. if (empty($field->type)) { continue; } $ret[$field->name] = [ 'type' => $field->type->name, 'timestamp_not_null' => false, ]; if ($field->options) { if ($field->type->name === 'TIMESTAMP') { if ($field->options->has('NOT NULL')) { $ret[$field->name]['timestamp_not_null'] = true; } } if ($option = $field->options->has('DEFAULT')) { $ret[$field->name]['default_value'] = $option; if ($option === 'CURRENT_TIMESTAMP') { $ret[$field->name]['default_current_timestamp'] = true; } } if ($option = $field->options->has('ON UPDATE')) { if ($option === 'CURRENT_TIMESTAMP') { $ret[$field->name]['on_update_current_timestamp'] = true; } } if ($option = $field->options->has('AS')) { $ret[$field->name]['generated'] = true; $ret[$field->name]['expr'] = $option; } } } return $ret; } } sql-parser/src/Utils/Misc.php 0000644 00000005630 14736103337 0012143 0 ustar 00 <?php /** * Miscellaneous utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Components\Expression; use PhpMyAdmin\SqlParser\Statements\SelectStatement; /** * Miscellaneous utilities. */ class Misc { /** * Gets a list of all aliases and their original names. * * @param SelectStatement $statement the statement to be processed * @param string $database the name of the database * * @return array */ public static function getAliases($statement, $database) { if (! ($statement instanceof SelectStatement) || empty($statement->expr) || empty($statement->from) ) { return []; } $retval = []; $tables = []; /** * Expressions that may contain aliases. * These are extracted from `FROM` and `JOIN` keywords. * * @var Expression[] */ $expressions = $statement->from; // Adding expressions from JOIN. if (! empty($statement->join)) { foreach ($statement->join as $join) { $expressions[] = $join->expr; } } foreach ($expressions as $expr) { if (! isset($expr->table) || ($expr->table === '')) { continue; } $thisDb = isset($expr->database) && ($expr->database !== '') ? $expr->database : $database; if (! isset($retval[$thisDb])) { $retval[$thisDb] = [ 'alias' => null, 'tables' => [], ]; } if (! isset($retval[$thisDb]['tables'][$expr->table])) { $retval[$thisDb]['tables'][$expr->table] = [ 'alias' => isset($expr->alias) && ($expr->alias !== '') ? $expr->alias : null, 'columns' => [], ]; } if (! isset($tables[$thisDb])) { $tables[$thisDb] = []; } $tables[$thisDb][$expr->alias] = $expr->table; } foreach ($statement->expr as $expr) { if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '') ) { continue; } $thisDb = isset($expr->database) && ($expr->database !== '') ? $expr->database : $database; if (isset($expr->table) && ($expr->table !== '')) { $thisTable = $tables[$thisDb][$expr->table] ?? $expr->table; $retval[$thisDb]['tables'][$thisTable]['columns'][$expr->column] = $expr->alias; } else { foreach ($retval[$thisDb]['tables'] as &$table) { $table['columns'][$expr->column] = $expr->alias; } } } return $retval; } } sql-parser/src/Utils/Query.php 0000644 00000063626 14736103337 0012366 0 ustar 00 <?php /** * Statement utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Components\Expression; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statement; use PhpMyAdmin\SqlParser\Statements\AlterStatement; use PhpMyAdmin\SqlParser\Statements\AnalyzeStatement; use PhpMyAdmin\SqlParser\Statements\CallStatement; use PhpMyAdmin\SqlParser\Statements\CheckStatement; use PhpMyAdmin\SqlParser\Statements\ChecksumStatement; use PhpMyAdmin\SqlParser\Statements\CreateStatement; use PhpMyAdmin\SqlParser\Statements\DeleteStatement; use PhpMyAdmin\SqlParser\Statements\DropStatement; use PhpMyAdmin\SqlParser\Statements\ExplainStatement; use PhpMyAdmin\SqlParser\Statements\InsertStatement; use PhpMyAdmin\SqlParser\Statements\LoadStatement; use PhpMyAdmin\SqlParser\Statements\OptimizeStatement; use PhpMyAdmin\SqlParser\Statements\RenameStatement; use PhpMyAdmin\SqlParser\Statements\RepairStatement; use PhpMyAdmin\SqlParser\Statements\ReplaceStatement; use PhpMyAdmin\SqlParser\Statements\SelectStatement; use PhpMyAdmin\SqlParser\Statements\SetStatement; use PhpMyAdmin\SqlParser\Statements\ShowStatement; use PhpMyAdmin\SqlParser\Statements\TruncateStatement; use PhpMyAdmin\SqlParser\Statements\UpdateStatement; use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\SqlParser\TokensList; use function array_flip; use function array_keys; use function count; use function in_array; use function is_string; use function trim; /** * Statement utilities. */ class Query { /** * Functions that set the flag `is_func`. * * @var array */ public static $FUNCTIONS = [ 'SUM', 'AVG', 'STD', 'STDDEV', 'MIN', 'MAX', 'BIT_OR', 'BIT_AND', ]; public static $ALLFLAGS = [ /* * select ... DISTINCT ... */ 'distinct' => false, /* * drop ... DATABASE ... */ 'drop_database' => false, /* * ... GROUP BY ... */ 'group' => false, /* * ... HAVING ... */ 'having' => false, /* * INSERT ... * or * REPLACE ... * or * DELETE ... */ 'is_affected' => false, /* * select ... PROCEDURE ANALYSE( ... ) ... */ 'is_analyse' => false, /* * select COUNT( ... ) ... */ 'is_count' => false, /* * DELETE ... */ 'is_delete' => false, // @deprecated; use `querytype` /* * EXPLAIN ... */ 'is_explain' => false, // @deprecated; use `querytype` /* * select ... INTO OUTFILE ... */ 'is_export' => false, /* * select FUNC( ... ) ... */ 'is_func' => false, /* * select ... GROUP BY ... * or * select ... HAVING ... */ 'is_group' => false, /* * INSERT ... * or * REPLACE ... * or * LOAD DATA ... */ 'is_insert' => false, /* * ANALYZE ... * or * CHECK ... * or * CHECKSUM ... * or * OPTIMIZE ... * or * REPAIR ... */ 'is_maint' => false, /* * CALL ... */ 'is_procedure' => false, /* * REPLACE ... */ 'is_replace' => false, // @deprecated; use `querytype` /* * SELECT ... */ 'is_select' => false, // @deprecated; use `querytype` /* * SHOW ... */ 'is_show' => false, // @deprecated; use `querytype` /* * Contains a subquery. */ 'is_subquery' => false, /* * ... JOIN ... */ 'join' => false, /* * ... LIMIT ... */ 'limit' => false, /* * TODO */ 'offset' => false, /* * ... ORDER ... */ 'order' => false, /* * The type of the query (which is usually the first keyword of * the statement). */ 'querytype' => false, /* * Whether a page reload is required. */ 'reload' => false, /* * SELECT ... FROM ... */ 'select_from' => false, /* * ... UNION ... */ 'union' => false, ]; /** * Gets an array with flags select statement has. * * @param SelectStatement $statement the statement to be processed * @param array $flags flags set so far * * @return array */ private static function getFlagsSelect($statement, $flags) { $flags['querytype'] = 'SELECT'; $flags['is_select'] = true; if (! empty($statement->from)) { $flags['select_from'] = true; } if ($statement->options->has('DISTINCT')) { $flags['distinct'] = true; } if (! empty($statement->group) || ! empty($statement->having)) { $flags['is_group'] = true; } if (! empty($statement->into) && ($statement->into->type === 'OUTFILE') ) { $flags['is_export'] = true; } $expressions = $statement->expr; if (! empty($statement->join)) { foreach ($statement->join as $join) { $expressions[] = $join->expr; } } foreach ($expressions as $expr) { if (! empty($expr->function)) { if ($expr->function === 'COUNT') { $flags['is_count'] = true; } elseif (in_array($expr->function, static::$FUNCTIONS)) { $flags['is_func'] = true; } } if (! empty($expr->subquery)) { $flags['is_subquery'] = true; } } if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE') ) { $flags['is_analyse'] = true; } if (! empty($statement->group)) { $flags['group'] = true; } if (! empty($statement->having)) { $flags['having'] = true; } if (! empty($statement->union)) { $flags['union'] = true; } if (! empty($statement->join)) { $flags['join'] = true; } return $flags; } /** * Gets an array with flags this statement has. * * @param Statement|null $statement the statement to be processed * @param bool $all if `false`, false values will not be included * * @return array */ public static function getFlags($statement, $all = false) { $flags = ['querytype' => false]; if ($all) { $flags = self::$ALLFLAGS; } if ($statement instanceof AlterStatement) { $flags['querytype'] = 'ALTER'; $flags['reload'] = true; } elseif ($statement instanceof CreateStatement) { $flags['querytype'] = 'CREATE'; $flags['reload'] = true; } elseif ($statement instanceof AnalyzeStatement) { $flags['querytype'] = 'ANALYZE'; $flags['is_maint'] = true; } elseif ($statement instanceof CheckStatement) { $flags['querytype'] = 'CHECK'; $flags['is_maint'] = true; } elseif ($statement instanceof ChecksumStatement) { $flags['querytype'] = 'CHECKSUM'; $flags['is_maint'] = true; } elseif ($statement instanceof OptimizeStatement) { $flags['querytype'] = 'OPTIMIZE'; $flags['is_maint'] = true; } elseif ($statement instanceof RepairStatement) { $flags['querytype'] = 'REPAIR'; $flags['is_maint'] = true; } elseif ($statement instanceof CallStatement) { $flags['querytype'] = 'CALL'; $flags['is_procedure'] = true; } elseif ($statement instanceof DeleteStatement) { $flags['querytype'] = 'DELETE'; $flags['is_delete'] = true; $flags['is_affected'] = true; } elseif ($statement instanceof DropStatement) { $flags['querytype'] = 'DROP'; $flags['reload'] = true; if ($statement->options->has('DATABASE') || $statement->options->has('SCHEMA') ) { $flags['drop_database'] = true; } } elseif ($statement instanceof ExplainStatement) { $flags['querytype'] = 'EXPLAIN'; $flags['is_explain'] = true; } elseif ($statement instanceof InsertStatement) { $flags['querytype'] = 'INSERT'; $flags['is_affected'] = true; $flags['is_insert'] = true; } elseif ($statement instanceof LoadStatement) { $flags['querytype'] = 'LOAD'; $flags['is_affected'] = true; $flags['is_insert'] = true; } elseif ($statement instanceof ReplaceStatement) { $flags['querytype'] = 'REPLACE'; $flags['is_affected'] = true; $flags['is_replace'] = true; $flags['is_insert'] = true; } elseif ($statement instanceof SelectStatement) { $flags = self::getFlagsSelect($statement, $flags); } elseif ($statement instanceof ShowStatement) { $flags['querytype'] = 'SHOW'; $flags['is_show'] = true; } elseif ($statement instanceof UpdateStatement) { $flags['querytype'] = 'UPDATE'; $flags['is_affected'] = true; } elseif ($statement instanceof SetStatement) { $flags['querytype'] = 'SET'; } if (($statement instanceof SelectStatement) || ($statement instanceof UpdateStatement) || ($statement instanceof DeleteStatement) ) { if (! empty($statement->limit)) { $flags['limit'] = true; } if (! empty($statement->order)) { $flags['order'] = true; } } return $flags; } /** * Parses a query and gets all information about it. * * @param string $query the query to be parsed * * @return array The array returned is the one returned by * `static::getFlags()`, with the following keys added: * - parser - the parser used to analyze the query; * - statement - the first statement resulted from parsing; * - select_tables - the real name of the tables selected; * if there are no table names in the `SELECT` * expressions, the table names are fetched from the * `FROM` expressions * - select_expr - selected expressions */ public static function getAll($query) { $parser = new Parser($query); if (empty($parser->statements[0])) { return static::getFlags(null, true); } $statement = $parser->statements[0]; $ret = static::getFlags($statement, true); $ret['parser'] = $parser; $ret['statement'] = $statement; if ($statement instanceof SelectStatement) { $ret['select_tables'] = []; $ret['select_expr'] = []; // Finding tables' aliases and their associated real names. $tableAliases = []; foreach ($statement->from as $expr) { if (isset($expr->table, $expr->alias) && ($expr->table !== '') && ($expr->alias !== '') ) { $tableAliases[$expr->alias] = [ $expr->table, $expr->database ?? null, ]; } } // Trying to find selected tables only from the select expression. // Sometimes, this is not possible because the tables aren't defined // explicitly (e.g. SELECT * FROM film, SELECT film_id FROM film). foreach ($statement->expr as $expr) { if (isset($expr->table) && ($expr->table !== '')) { if (isset($tableAliases[$expr->table])) { $arr = $tableAliases[$expr->table]; } else { $arr = [ $expr->table, isset($expr->database) && ($expr->database !== '') ? $expr->database : null, ]; } if (! in_array($arr, $ret['select_tables'])) { $ret['select_tables'][] = $arr; } } else { $ret['select_expr'][] = $expr->expr; } } // If no tables names were found in the SELECT clause or if there // are expressions like * or COUNT(*), etc. tables names should be // extracted from the FROM clause. if (empty($ret['select_tables'])) { foreach ($statement->from as $expr) { if (isset($expr->table) && ($expr->table !== '')) { $arr = [ $expr->table, isset($expr->database) && ($expr->database !== '') ? $expr->database : null, ]; if (! in_array($arr, $ret['select_tables'])) { $ret['select_tables'][] = $arr; } } } } } return $ret; } /** * Gets a list of all tables used in this statement. * * @param Statement $statement statement to be scanned * * @return array */ public static function getTables($statement) { $expressions = []; if (($statement instanceof InsertStatement) || ($statement instanceof ReplaceStatement) ) { $expressions = [$statement->into->dest]; } elseif ($statement instanceof UpdateStatement) { $expressions = $statement->tables; } elseif (($statement instanceof SelectStatement) || ($statement instanceof DeleteStatement) ) { $expressions = $statement->from; } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement) ) { $expressions = [$statement->table]; } elseif ($statement instanceof DropStatement) { if (! $statement->options->has('TABLE')) { // No tables are dropped. return []; } $expressions = $statement->fields; } elseif ($statement instanceof RenameStatement) { foreach ($statement->renames as $rename) { $expressions[] = $rename->old; } } $ret = []; foreach ($expressions as $expr) { if (! empty($expr->table)) { $expr->expr = null; // Force rebuild. $expr->alias = null; // Aliases are not required. $ret[] = Expression::build($expr); } } return $ret; } /** * Gets a specific clause. * * @param Statement $statement the parsed query that has to be modified * @param TokensList $list the list of tokens * @param string $clause the clause to be returned * @param int|string $type The type of the search. * If int, * -1 for everything that was before * 0 only for the clause * 1 for everything after * If string, the name of the first clause that * should not be included. * @param bool $skipFirst whether to skip the first keyword in clause * * @return string */ public static function getClause($statement, $list, $clause, $type = 0, $skipFirst = true) { /** * The index of the current clause. * * @var int */ $currIdx = 0; /** * The count of brackets. * We keep track of them so we won't insert the clause in a subquery. * * @var int */ $brackets = 0; /** * The string to be returned. * * @var string */ $ret = ''; /** * The clauses of this type of statement and their index. * * @var array */ $clauses = array_flip(array_keys($statement->getClauses())); /** * Lexer used for lexing the clause. * * @var Lexer */ $lexer = new Lexer($clause); /** * The type of this clause. * * @var string */ $clauseType = $lexer->list->getNextOfType(Token::TYPE_KEYWORD)->keyword; /** * The index of this clause. * * @var int */ $clauseIdx = $clauses[$clauseType] ?? -1; $firstClauseIdx = $clauseIdx; $lastClauseIdx = $clauseIdx; // Determining the behavior of this function. if ($type === -1) { $firstClauseIdx = -1; // Something small enough. $lastClauseIdx = $clauseIdx - 1; } elseif ($type === 1) { $firstClauseIdx = $clauseIdx + 1; $lastClauseIdx = 10000; // Something big enough. } elseif (is_string($type) && isset($clauses[$type])) { if ($clauses[$type] > $clauseIdx) { $firstClauseIdx = $clauseIdx + 1; $lastClauseIdx = $clauses[$type] - 1; } else { $firstClauseIdx = $clauses[$type] + 1; $lastClauseIdx = $clauseIdx - 1; } } // This option is unavailable for multiple clauses. if ($type !== 0) { $skipFirst = false; } for ($i = $statement->first; $i <= $statement->last; ++$i) { $token = $list->tokens[$i]; if ($token->type === Token::TYPE_COMMENT) { continue; } if ($token->type === Token::TYPE_OPERATOR) { if ($token->value === '(') { ++$brackets; } elseif ($token->value === ')') { --$brackets; } } if ($brackets === 0) { // Checking if the section was changed. if (($token->type === Token::TYPE_KEYWORD) && isset($clauses[$token->keyword]) && ($clauses[$token->keyword] >= $currIdx) ) { $currIdx = $clauses[$token->keyword]; if ($skipFirst && ($currIdx === $clauseIdx)) { // This token is skipped (not added to the old // clause) because it will be replaced. continue; } } } if (($firstClauseIdx <= $currIdx) && ($currIdx <= $lastClauseIdx)) { $ret .= $token->token; } } return trim($ret); } /** * Builds a query by rebuilding the statement from the tokens list supplied * and replaces a clause. * * It is a very basic version of a query builder. * * @param Statement $statement the parsed query that has to be modified * @param TokensList $list the list of tokens * @param string $old The type of the clause that should be * replaced. This can be an entire clause. * @param string $new The new clause. If this parameter is omitted * it is considered to be equal with `$old`. * @param bool $onlyType whether only the type of the clause should * be replaced or the entire clause * * @return string */ public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false) { // TODO: Update the tokens list and the statement. if ($new === null) { $new = $old; } if ($onlyType) { return static::getClause($statement, $list, $old, -1, false) . ' ' . $new . ' ' . static::getClause($statement, $list, $old, 0) . ' ' . static::getClause($statement, $list, $old, 1, false); } return static::getClause($statement, $list, $old, -1, false) . ' ' . $new . ' ' . static::getClause($statement, $list, $old, 1, false); } /** * Builds a query by rebuilding the statement from the tokens list supplied * and replaces multiple clauses. * * @param Statement $statement the parsed query that has to be modified * @param TokensList $list the list of tokens * @param array $ops Clauses to be replaced. Contains multiple * arrays having two values: [$old, $new]. * Clauses must be sorted. * * @return string */ public static function replaceClauses($statement, $list, array $ops) { $count = count($ops); // Nothing to do. if ($count === 0) { return ''; } /** * Value to be returned. * * @var string */ $ret = ''; // If there is only one clause, `replaceClause()` should be used. if ($count === 1) { return static::replaceClause( $statement, $list, $ops[0][0], $ops[0][1] ); } // Adding everything before first replacement. $ret .= static::getClause($statement, $list, $ops[0][0], -1) . ' '; // Doing replacements. foreach ($ops as $i => $clause) { $ret .= $clause[1] . ' '; // Adding everything between this and next replacement. if ($i + 1 !== $count) { $ret .= static::getClause($statement, $list, $clause[0], $ops[$i + 1][0]) . ' '; } } // Adding everything after the last replacement. return $ret . static::getClause($statement, $list, $ops[$count - 1][0], 1); } /** * Gets the first full statement in the query. * * @param string $query the query to be analyzed * @param string $delimiter the delimiter to be used * * @return array array containing the first full query, the * remaining part of the query and the last * delimiter */ public static function getFirstStatement($query, $delimiter = null) { $lexer = new Lexer($query, false, $delimiter); $list = $lexer->list; /** * Whether a full statement was found. * * @var bool */ $fullStatement = false; /** * The first full statement. * * @var string */ $statement = ''; for ($list->idx = 0; $list->idx < $list->count; ++$list->idx) { $token = $list->tokens[$list->idx]; if ($token->type === Token::TYPE_COMMENT) { continue; } $statement .= $token->token; if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) { $delimiter = $token->token; $fullStatement = true; break; } } // No statement was found so we return the entire query as being the // remaining part. if (! $fullStatement) { return [ null, $query, $delimiter, ]; } // At least one query was found so we have to build the rest of the // remaining query. $query = ''; for (++$list->idx; $list->idx < $list->count; ++$list->idx) { $query .= $list->tokens[$list->idx]->token; } return [ trim($statement), $query, $delimiter, ]; } /** * Gets a starting offset of a specific clause. * * @param Statement $statement the parsed query that has to be modified * @param TokensList $list the list of tokens * @param string $clause the clause to be returned * * @return int */ public static function getClauseStartOffset($statement, $list, $clause) { /** * The count of brackets. * We keep track of them so we won't insert the clause in a subquery. * * @var int */ $brackets = 0; /** * The clauses of this type of statement and their index. * * @var array */ $clauses = array_flip(array_keys($statement->getClauses())); for ($i = $statement->first; $i <= $statement->last; ++$i) { $token = $list->tokens[$i]; if ($token->type === Token::TYPE_COMMENT) { continue; } if ($token->type === Token::TYPE_OPERATOR) { if ($token->value === '(') { ++$brackets; } elseif ($token->value === ')') { --$brackets; } } if ($brackets === 0) { if (($token->type === Token::TYPE_KEYWORD) && isset($clauses[$token->keyword]) && ($clause === $token->keyword) ) { return $i; } elseif ($token->keyword === 'UNION') { return -1; } } } return -1; } } sql-parser/src/Utils/Routine.php 0000644 00000007002 14736103337 0012670 0 ustar 00 <?php /** * Routine utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Components\DataType; use PhpMyAdmin\SqlParser\Components\ParameterDefinition; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\CreateStatement; use function implode; use function is_string; /** * Routine utilities. */ class Routine { /** * Parses a parameter of a routine. * * @param string $param parameter's definition * * @return array */ public static function getReturnType($param) { $lexer = new Lexer($param); // A dummy parser is used for error reporting. $type = DataType::parse(new Parser(), $lexer->list); if ($type === null) { return [ '', '', '', '', '', ]; } $options = []; foreach ($type->options->options as $opt) { $options[] = is_string($opt) ? $opt : $opt['value']; } return [ '', '', $type->name, implode(',', $type->parameters), implode(' ', $options), ]; } /** * Parses a parameter of a routine. * * @param string $param parameter's definition * * @return array */ public static function getParameter($param) { $lexer = new Lexer('(' . $param . ')'); // A dummy parser is used for error reporting. $param = ParameterDefinition::parse(new Parser(), $lexer->list); if (empty($param[0])) { return [ '', '', '', '', '', ]; } $param = $param[0]; $options = []; foreach ($param->type->options->options as $opt) { $options[] = is_string($opt) ? $opt : $opt['value']; } return [ empty($param->inOut) ? '' : $param->inOut, $param->name, $param->type->name, implode(',', $param->type->parameters), implode(' ', $options), ]; } /** * Gets the parameters of a routine from the parse tree. * * @param CreateStatement $statement the statement to be processed * * @return array */ public static function getParameters($statement) { $retval = [ 'num' => 0, 'dir' => [], 'name' => [], 'type' => [], 'length' => [], 'length_arr' => [], 'opts' => [], ]; if (! empty($statement->parameters)) { $idx = 0; foreach ($statement->parameters as $param) { $retval['dir'][$idx] = $param->inOut; $retval['name'][$idx] = $param->name; $retval['type'][$idx] = $param->type->name; $retval['length'][$idx] = implode(',', $param->type->parameters); $retval['length_arr'][$idx] = $param->type->parameters; $retval['opts'][$idx] = []; foreach ($param->type->options->options as $opt) { $retval['opts'][$idx][] = is_string($opt) ? $opt : $opt['value']; } $retval['opts'][$idx] = implode(' ', $retval['opts'][$idx]); ++$idx; } $retval['num'] = $idx; } return $retval; } } sql-parser/src/Utils/Tokens.php 0000644 00000007737 14736103337 0012525 0 ustar 00 <?php /** * Token utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Lexer; use PhpMyAdmin\SqlParser\Token; use PhpMyAdmin\SqlParser\TokensList; use function count; use function strcasecmp; /** * Token utilities. */ class Tokens { /** * Checks if a pattern is a match for the specified token. * * @param Token $token the token to be matched * @param array $pattern the pattern to be matches * * @return bool */ public static function match(Token $token, array $pattern) { // Token. if (isset($pattern['token']) && ($pattern['token'] !== $token->token) ) { return false; } // Value. if (isset($pattern['value']) && ($pattern['value'] !== $token->value) ) { return false; } if (isset($pattern['value_str']) && strcasecmp($pattern['value_str'], (string) $token->value) ) { return false; } // Type. if (isset($pattern['type']) && ($pattern['type'] !== $token->type) ) { return false; } // Flags. return ! isset($pattern['flags']) || (! (($pattern['flags'] & $token->flags) === 0)); } public static function replaceTokens($list, array $find, array $replace) { /** * Whether the first parameter is a list. * * @var bool */ $isList = $list instanceof TokensList; // Parsing the tokens. if (! $isList) { $list = Lexer::getTokens($list); } /** * The list to be returned. * * @var array */ $newList = []; /** * The length of the find pattern is calculated only once. * * @var int */ $findCount = count($find); /** * The starting index of the pattern. * * @var int */ $i = 0; while ($i < $list->count) { // A sequence may not start with a comment. if ($list->tokens[$i]->type === Token::TYPE_COMMENT) { $newList[] = $list->tokens[$i]; ++$i; continue; } /** * The index used to parse `$list->tokens`. * * This index might be running faster than `$k` because some tokens * are skipped. * * @var int */ $j = $i; /** * The index used to parse `$find`. * * This index might be running slower than `$j` because some tokens * are skipped. * * @var int */ $k = 0; // Checking if the next tokens match the pattern described. while (($j < $list->count) && ($k < $findCount)) { // Comments are being skipped. if ($list->tokens[$j]->type === Token::TYPE_COMMENT) { ++$j; } if (! static::match($list->tokens[$j], $find[$k])) { // This token does not match the pattern. break; } // Going to next token and segment of find pattern. ++$j; ++$k; } // Checking if the sequence was found. if ($k === $findCount) { // Inserting new tokens. foreach ($replace as $token) { $newList[] = $token; } // Skipping next `$findCount` tokens. $i = $j; } else { // Adding the same token. $newList[] = $list->tokens[$i]; ++$i; } } return $isList ? new TokensList($newList) : TokensList::build($newList); } } sql-parser/src/Utils/BufferedQuery.php 0000644 00000032714 14736103337 0014023 0 ustar 00 <?php /** * Buffered query utilities. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Utils; use PhpMyAdmin\SqlParser\Context; use function array_merge; use function strlen; use function substr; use function trim; /** * Buffer query utilities. * * Implements a specialized lexer used to extract statements from large inputs * that are being buffered. After each statement has been extracted, a lexer or * a parser may be used. */ class BufferedQuery { // Constants that describe the current status of the parser. // A string is being parsed. public const STATUS_STRING = 16; // 0001 0000 public const STATUS_STRING_SINGLE_QUOTES = 17; // 0001 0001 public const STATUS_STRING_DOUBLE_QUOTES = 18; // 0001 0010 public const STATUS_STRING_BACKTICK = 20; // 0001 0100 // A comment is being parsed. public const STATUS_COMMENT = 32; // 0010 0000 public const STATUS_COMMENT_BASH = 33; // 0010 0001 public const STATUS_COMMENT_C = 34; // 0010 0010 public const STATUS_COMMENT_SQL = 36; // 0010 0100 /** * The query that is being processed. * * This field can be modified just by appending to it! * * @var string */ public $query = ''; /** * The options of this parser. * * @var array */ public $options = []; /** * The last delimiter used. * * @var string */ public $delimiter; /** * The length of the delimiter. * * @var int */ public $delimiterLen; /** * The current status of the parser. * * @var int */ public $status; /** * The last incomplete query that was extracted. * * @var string */ public $current = ''; /** * @param string $query the query to be parsed * @param array $options the options of this parser */ public function __construct($query = '', array $options = []) { // Merges specified options with defaults. $this->options = array_merge( [ /* * The starting delimiter. * * @var string */ 'delimiter' => ';', /* * Whether `DELIMITER` statements should be parsed. * * @var bool */ 'parse_delimiter' => false, /* * Whether a delimiter should be added at the end of the * statement. * * @var bool */ 'add_delimiter' => false, ], $options ); $this->query = $query; $this->setDelimiter($this->options['delimiter']); } /** * Sets the delimiter. * * Used to update the length of it too. * * @param string $delimiter */ public function setDelimiter($delimiter) { $this->delimiter = $delimiter; $this->delimiterLen = strlen($delimiter); } /** * Extracts a statement from the buffer. * * @param bool $end whether the end of the buffer was reached * * @return string|false */ public function extract($end = false) { /** * The last parsed position. * * This is statically defined because it is not used outside anywhere * outside this method and there is probably a (minor) performance * improvement to it. * * @var int */ static $i = 0; if (empty($this->query)) { return false; } /** * The length of the buffer. * * @var int */ $len = strlen($this->query); /** * The last index of the string that is going to be parsed. * * There must be a few characters left in the buffer so the parser can * avoid confusing some symbols that may have multiple meanings. * * For example, if the buffer ends in `-` that may be an operator or the * beginning of a comment. * * Another example if the buffer ends in `DELIMITE`. The parser is going * to require a few more characters because that may be a part of the * `DELIMITER` keyword or just a column named `DELIMITE`. * * Those extra characters are required only if there is more data * expected (the end of the buffer was not reached). * * @var int */ $loopLen = $end ? $len : $len - 16; for (; $i < $loopLen; ++$i) { /* * Handling backslash. * * Even if the next character is a special character that should be * treated differently, because of the preceding backslash, it will * be ignored. */ if ((($this->status & self::STATUS_COMMENT) === 0) && ($this->query[$i] === '\\')) { $this->current .= $this->query[$i] . $this->query[++$i]; continue; } /* * Handling special parses statuses. */ if ($this->status === self::STATUS_STRING_SINGLE_QUOTES) { // Single-quoted strings like 'foo'. if ($this->query[$i] === '\'') { $this->status = 0; } $this->current .= $this->query[$i]; continue; } elseif ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) { // Double-quoted strings like "bar". if ($this->query[$i] === '"') { $this->status = 0; } $this->current .= $this->query[$i]; continue; } elseif ($this->status === self::STATUS_STRING_BACKTICK) { if ($this->query[$i] === '`') { $this->status = 0; } $this->current .= $this->query[$i]; continue; } elseif (($this->status === self::STATUS_COMMENT_BASH) || ($this->status === self::STATUS_COMMENT_SQL) ) { // Bash-like (#) or SQL-like (-- ) comments end in new line. if ($this->query[$i] === "\n") { $this->status = 0; } $this->current .= $this->query[$i]; continue; } elseif ($this->status === self::STATUS_COMMENT_C) { // C-like comments end in */. if (($this->query[$i - 1] === '*') && ($this->query[$i] === '/')) { $this->status = 0; } $this->current .= $this->query[$i]; continue; } /* * Checking if a string started. */ if ($this->query[$i] === '\'') { $this->status = self::STATUS_STRING_SINGLE_QUOTES; $this->current .= $this->query[$i]; continue; } elseif ($this->query[$i] === '"') { $this->status = self::STATUS_STRING_DOUBLE_QUOTES; $this->current .= $this->query[$i]; continue; } elseif ($this->query[$i] === '`') { $this->status = self::STATUS_STRING_BACKTICK; $this->current .= $this->query[$i]; continue; } /* * Checking if a comment started. */ if ($this->query[$i] === '#') { $this->status = self::STATUS_COMMENT_BASH; $this->current .= $this->query[$i]; continue; } elseif ($i + 2 < $len) { if (($this->query[$i] === '-') && ($this->query[$i + 1] === '-') && Context::isWhitespace($this->query[$i + 2])) { $this->status = self::STATUS_COMMENT_SQL; $this->current .= $this->query[$i]; continue; } elseif (($this->query[$i] === '/') && ($this->query[$i + 1] === '*') && ($this->query[$i + 2] !== '!')) { $this->status = self::STATUS_COMMENT_C; $this->current .= $this->query[$i]; continue; } } /* * Handling `DELIMITER` statement. * * The code below basically checks for * `strtoupper(substr($this->query, $i, 9)) === 'DELIMITER'` * * This optimization makes the code about 3 times faster. * * `DELIMITER` is not being considered a keyword. The only context * it has a special meaning is when it is the beginning of a * statement. This is the reason for the last condition. */ if (($i + 9 < $len) && (($this->query[$i] === 'D') || ($this->query[$i] === 'd')) && (($this->query[$i + 1] === 'E') || ($this->query[$i + 1] === 'e')) && (($this->query[$i + 2] === 'L') || ($this->query[$i + 2] === 'l')) && (($this->query[$i + 3] === 'I') || ($this->query[$i + 3] === 'i')) && (($this->query[$i + 4] === 'M') || ($this->query[$i + 4] === 'm')) && (($this->query[$i + 5] === 'I') || ($this->query[$i + 5] === 'i')) && (($this->query[$i + 6] === 'T') || ($this->query[$i + 6] === 't')) && (($this->query[$i + 7] === 'E') || ($this->query[$i + 7] === 'e')) && (($this->query[$i + 8] === 'R') || ($this->query[$i + 8] === 'r')) && Context::isWhitespace($this->query[$i + 9]) ) { // Saving the current index to be able to revert any parsing // done in this block. $iBak = $i; $i += 9; // Skipping `DELIMITER`. // Skipping whitespaces. while (($i < $len) && Context::isWhitespace($this->query[$i])) { ++$i; } // Parsing the delimiter. $delimiter = ''; while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) { $delimiter .= $this->query[$i++]; } // Checking if the delimiter definition ended. if (($delimiter !== '') && (($i < $len) && Context::isWhitespace($this->query[$i]) || (($i === $len) && $end)) ) { // Saving the delimiter. $this->setDelimiter($delimiter); // Whether this statement should be returned or not. $ret = ''; if (! empty($this->options['parse_delimiter'])) { // Appending the `DELIMITER` statement that was just // found to the current statement. $ret = trim( $this->current . ' ' . substr($this->query, $iBak, $i - $iBak) ); } // Removing the statement that was just extracted from the // query. $this->query = substr($this->query, $i); $i = 0; // Resetting the current statement. $this->current = ''; return $ret; } // Incomplete statement. Reverting $i = $iBak; return false; } /* * Checking if the current statement finished. * * The first letter of the delimiter is being checked as an * optimization. This code is almost as fast as the one above. * * There is no point in checking if two strings match if not even * the first letter matches. */ if (($this->query[$i] === $this->delimiter[0]) && (($this->delimiterLen === 1) || (substr($this->query, $i, $this->delimiterLen) === $this->delimiter)) ) { // Saving the statement that just ended. $ret = $this->current; // If needed, adds a delimiter at the end of the statement. if (! empty($this->options['add_delimiter'])) { $ret .= $this->delimiter; } // Removing the statement that was just extracted from the // query. $this->query = substr($this->query, $i + $this->delimiterLen); $i = 0; // Resetting the current statement. $this->current = ''; // Returning the statement. return trim($ret); } /* * Appending current character to current statement. */ $this->current .= $this->query[$i]; } if ($end && ($i === $len)) { // If the end of the buffer was reached, the buffer is emptied and // the current statement that was extracted is returned. $ret = $this->current; // Emptying the buffer. $this->query = ''; $i = 0; // Resetting the current statement. $this->current = ''; // Returning the statement. return trim($ret); } return ''; } } sql-parser/src/Token.php 0000644 00000022504 14736103337 0011227 0 ustar 00 <?php /** * Defines a token along with a set of types and flags and utility functions. * * An array of tokens will result after parsing the query. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use function hexdec; use function mb_strlen; use function mb_substr; use function str_replace; use function stripcslashes; use function strtoupper; /** * A structure representing a lexeme that explicitly indicates its * categorization for the purpose of parsing. */ class Token { // Types of tokens (a vague description of a token's purpose). /** * This type is used when the token is invalid or its type cannot be * determined because of the ambiguous context. Further analysis might be * required to detect its type. */ public const TYPE_NONE = 0; /** * SQL specific keywords: SELECT, UPDATE, INSERT, etc. */ public const TYPE_KEYWORD = 1; /** * Any type of legal operator. * * Arithmetic operators: +, -, *, /, etc. * Logical operators: ===, <>, !==, etc. * Bitwise operators: &, |, ^, etc. * Assignment operators: =, +=, -=, etc. * SQL specific operators: . (e.g. .. WHERE database.table ..), * * (e.g. SELECT * FROM ..) */ public const TYPE_OPERATOR = 2; /** * Spaces, tabs, new lines, etc. */ public const TYPE_WHITESPACE = 3; /** * Any type of legal comment. * * Bash (#), C (/* *\/) or SQL (--) comments: * * -- SQL-comment * * #Bash-like comment * * /*C-like comment*\/ * * or: * * /*C-like * comment*\/ * * Backslashes were added to respect PHP's comments syntax. */ public const TYPE_COMMENT = 4; /** * Boolean values: true or false. */ public const TYPE_BOOL = 5; /** * Numbers: 4, 0x8, 15.16, 23e42, etc. */ public const TYPE_NUMBER = 6; /** * Literal strings: 'string', "test". * Some of these strings are actually symbols. */ public const TYPE_STRING = 7; /** * Database, table names, variables, etc. * For example: ```SELECT `foo`, `bar` FROM `database`.`table`;```. */ public const TYPE_SYMBOL = 8; /** * Delimits an unknown string. * For example: ```SELECT * FROM test;```, `test` is a delimiter. */ public const TYPE_DELIMITER = 9; /** * Labels in LOOP statement, ITERATE statement etc. * For example (only for begin label): * begin_label: BEGIN [statement_list] END [end_label] * begin_label: LOOP [statement_list] END LOOP [end_label] * begin_label: REPEAT [statement_list] ... END REPEAT [end_label] * begin_label: WHILE ... DO [statement_list] END WHILE [end_label]. */ public const TYPE_LABEL = 10; // Flags that describe the tokens in more detail. // All keywords must have flag 1 so `Context::isKeyword` method doesn't // require strict comparison. public const FLAG_KEYWORD_RESERVED = 2; public const FLAG_KEYWORD_COMPOSED = 4; public const FLAG_KEYWORD_DATA_TYPE = 8; public const FLAG_KEYWORD_KEY = 16; public const FLAG_KEYWORD_FUNCTION = 32; // Numbers related flags. public const FLAG_NUMBER_HEX = 1; public const FLAG_NUMBER_FLOAT = 2; public const FLAG_NUMBER_APPROXIMATE = 4; public const FLAG_NUMBER_NEGATIVE = 8; public const FLAG_NUMBER_BINARY = 16; // Strings related flags. public const FLAG_STRING_SINGLE_QUOTES = 1; public const FLAG_STRING_DOUBLE_QUOTES = 2; // Comments related flags. public const FLAG_COMMENT_BASH = 1; public const FLAG_COMMENT_C = 2; public const FLAG_COMMENT_SQL = 4; public const FLAG_COMMENT_MYSQL_CMD = 8; // Operators related flags. public const FLAG_OPERATOR_ARITHMETIC = 1; public const FLAG_OPERATOR_LOGICAL = 2; public const FLAG_OPERATOR_BITWISE = 4; public const FLAG_OPERATOR_ASSIGNMENT = 8; public const FLAG_OPERATOR_SQL = 16; // Symbols related flags. public const FLAG_SYMBOL_VARIABLE = 1; public const FLAG_SYMBOL_BACKTICK = 2; public const FLAG_SYMBOL_USER = 4; public const FLAG_SYMBOL_SYSTEM = 8; public const FLAG_SYMBOL_PARAMETER = 16; /** * The token it its raw string representation. * * @var string */ public $token; /** * The value this token contains (i.e. token after some evaluation). * * @var mixed */ public $value; /** * The keyword value this token contains, always uppercase. * * @var mixed */ public $keyword; /** * The type of this token. * * @var int */ public $type; /** * The flags of this token. * * @var int */ public $flags; /** * The position in the initial string where this token started. * * The position is counted in chars, not bytes, so you should * use mb_* functions to properly handle utf-8 multibyte chars. * * @var int */ public $position; /** * @param string $token the value of the token * @param int $type the type of the token * @param int $flags the flags of the token */ public function __construct($token, $type = 0, $flags = 0) { $this->token = $token; $this->type = $type; $this->flags = $flags; $this->keyword = null; $this->value = $this->extract(); } /** * Does little processing to the token to extract a value. * * If no processing can be done it will return the initial string. * * @return mixed */ public function extract() { switch ($this->type) { case self::TYPE_KEYWORD: $this->keyword = strtoupper($this->token); if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) { // Unreserved keywords should stay the way they are because they // might represent field names. return $this->token; } return $this->keyword; case self::TYPE_WHITESPACE: return ' '; case self::TYPE_BOOL: return strtoupper($this->token) === 'TRUE'; case self::TYPE_NUMBER: $ret = str_replace('--', '', $this->token); // e.g. ---42 === -42 if ($this->flags & self::FLAG_NUMBER_HEX) { if ($this->flags & self::FLAG_NUMBER_NEGATIVE) { $ret = str_replace('-', '', $this->token); $ret = -hexdec($ret); } else { $ret = hexdec($ret); } } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT) ) { $ret = (float) $ret; } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) { $ret = (int) $ret; } return $ret; case self::TYPE_STRING: // Trims quotes. $str = $this->token; $str = mb_substr($str, 1, -1, 'UTF-8'); // Removes surrounding quotes. $quote = $this->token[0]; $str = str_replace($quote . $quote, $quote, $str); // Finally unescapes the string. // // `stripcslashes` replaces escape sequences with their // representation. // // NOTE: In MySQL, `\f` and `\v` have no representation, // even they usually represent: form-feed and vertical tab. $str = str_replace('\f', 'f', $str); $str = str_replace('\v', 'v', $str); $str = stripcslashes($str); return $str; case self::TYPE_SYMBOL: $str = $this->token; if (isset($str[0]) && ($str[0] === '@')) { // `mb_strlen($str)` must be used instead of `null` because // in PHP 5.3- the `null` parameter isn't handled correctly. $str = mb_substr( $str, ! empty($str[1]) && ($str[1] === '@') ? 2 : 1, mb_strlen($str), 'UTF-8' ); } if (isset($str[0]) && ($str[0] === ':')) { $str = mb_substr($str, 1, mb_strlen($str), 'UTF-8'); } if (isset($str[0]) && (($str[0] === '`') || ($str[0] === '"') || ($str[0] === '\'')) ) { $quote = $str[0]; $str = str_replace($quote . $quote, $quote, $str); $str = mb_substr($str, 1, -1, 'UTF-8'); } return $str; } return $this->token; } /** * Converts the token into an inline token by replacing tabs and new lines. * * @return string */ public function getInlineToken() { return str_replace( [ "\r", "\n", "\t", ], [ '\r', '\n', '\t', ], $this->token ); } } sql-parser/src/Exceptions/LoaderException.php 0000644 00000001214 14736103337 0015350 0 ustar 00 <?php /** * Exception thrown by the lexer. */ 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; } } sql-parser/src/Exceptions/ParserException.php 0000644 00000001306 14736103337 0015400 0 ustar 00 <?php /** * Exception thrown by the parser. */ 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; } } sql-parser/src/Exceptions/LexerException.php 0000644 00000001550 14736103337 0015224 0 ustar 00 <?php /** * Exception thrown by the lexer. */ 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; } } sql-parser/src/Context.php 0000644 00000045441 14736103337 0011600 0 ustar 00 <?php /** * 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. */ declare(strict_types=1); namespace PhpMyAdmin\SqlParser; use PhpMyAdmin\SqlParser\Exceptions\LoaderException; use function class_exists; use function constant; use function explode; use function intval; use function is_array; use function is_numeric; use function str_replace; use function strlen; use function strncmp; use function strtoupper; use function substr; /** * 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 */ public static $KEYWORDS = []; /** * List of operators and their flags. * * @var array */ 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. * * @var int */ public static $MODE = 0; /* * Server SQL Modes * https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html */ // Compatibility mode for Microsoft's SQL server. // This is the equivalent of ANSI_QUOTES. public const SQL_MODE_COMPAT_MYSQL = 2; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_allow_invalid_dates public const SQL_MODE_ALLOW_INVALID_DATES = 1; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_ansi_quotes public const SQL_MODE_ANSI_QUOTES = 2; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_error_for_division_by_zero public const SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO = 4; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_high_not_precedence public const SQL_MODE_HIGH_NOT_PRECEDENCE = 8; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_ignore_space public const SQL_MODE_IGNORE_SPACE = 16; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_auto_create_user public const SQL_MODE_NO_AUTO_CREATE_USER = 32; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_auto_value_on_zero public const SQL_MODE_NO_AUTO_VALUE_ON_ZERO = 64; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_backslash_escapes public const SQL_MODE_NO_BACKSLASH_ESCAPES = 128; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_dir_in_create public const SQL_MODE_NO_DIR_IN_CREATE = 256; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_dir_in_create public const SQL_MODE_NO_ENGINE_SUBSTITUTION = 512; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_field_options public const SQL_MODE_NO_FIELD_OPTIONS = 1024; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_key_options public const SQL_MODE_NO_KEY_OPTIONS = 2048; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_table_options public const SQL_MODE_NO_TABLE_OPTIONS = 4096; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_unsigned_subtraction public const SQL_MODE_NO_UNSIGNED_SUBTRACTION = 8192; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_zero_date public const SQL_MODE_NO_ZERO_DATE = 16384; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_no_zero_in_date public const SQL_MODE_NO_ZERO_IN_DATE = 32768; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_only_full_group_by public const SQL_MODE_ONLY_FULL_GROUP_BY = 65536; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_pipes_as_concat public const SQL_MODE_PIPES_AS_CONCAT = 131072; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_real_as_float public const SQL_MODE_REAL_AS_FLOAT = 262144; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_all_tables public const SQL_MODE_STRICT_ALL_TABLES = 524288; // https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_strict_trans_tables public const SQL_MODE_STRICT_TRANS_TABLES = 1048576; // Custom modes. // 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; /* * Combination SQL Modes * https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sql-mode-combo */ // REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE public const SQL_MODE_ANSI = 393234; // PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, // NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, public const SQL_MODE_DB2 = 138258; // PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, // NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER public const SQL_MODE_MAXDB = 138290; // PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, // NO_TABLE_OPTIONS, NO_FIELD_OPTIONS public const SQL_MODE_MSSQL = 138258; // PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, // NO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER public const SQL_MODE_ORACLE = 138290; // PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS, // NO_TABLE_OPTIONS, NO_FIELD_OPTIONS public const SQL_MODE_POSTGRESQL = 138258; // STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, // ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER 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; } elseif ($str[0] === '`') { return Token::FLAG_SYMBOL_BACKTICK; } elseif ($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; } elseif ($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 < '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 * * @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 (strncmp($context, 'MariaDb', 7) === 0) { return static::loadClosest('MariaDb100300'); } elseif (strncmp($context, 'MySql', 5) === 0) { return static::loadClosest('MySql50700'); } return null; } /** * Sets the SQL mode. * * @param string $mode The list of modes. If empty, the mode is reset. */ public static function setMode($mode = '') { static::$MODE = 0; if (empty($mode)) { return; } $mode = explode(',', $mode); foreach ($mode as $m) { static::$MODE |= constant('static::SQL_MODE_' . $m); } } /** * Escapes the symbol by adding surrounding backticks. * * @param array|string $str the string to be escaped * @param string $quote quote to be used when escaping * * @return string|array */ 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 * * @return boolean false on empty param, true/false on given constant/int value * @param int $flag for example Context::SQL_MODE_ANSI_QUOTES */ public static function hasMode($flag = null) { if (empty($flag)) { return false; } return (self::$MODE & $flag) === $flag; } } // Initializing the default context. Context::load(); sql-parser/README.md 0000644 00000007425 14736103337 0010133 0 ustar 00 # SQL Parser A validating SQL lexer and parser with a focus on MySQL dialect. ## Code status [![Build Status](https://travis-ci.org/phpmyadmin/sql-parser.svg?branch=master)](https://travis-ci.org/phpmyadmin/sql-parser) [![Code Coverage](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/?branch=master) [![codecov.io](https://codecov.io/github/phpmyadmin/sql-parser/coverage.svg?branch=master)](https://codecov.io/github/phpmyadmin/sql-parser?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpmyadmin/sql-parser/?branch=master) [![Translation status](https://hosted.weblate.org/widgets/phpmyadmin/-/svg-badge.svg)](https://hosted.weblate.org/engage/phpmyadmin/?utm_source=widget) [![Packagist](https://img.shields.io/packagist/dt/phpmyadmin/sql-parser.svg)](https://packagist.org/packages/phpmyadmin/sql-parser) [![Open Source Helpers](https://www.codetriage.com/phpmyadmin/sql-parser/badges/users.svg)](https://www.codetriage.com/phpmyadmin/sql-parser) ## Installation Please use [Composer][1] to install: ``` 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('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/ sql-parser/.php_cs 0000644 00000001523 14736103337 0010122 0 ustar 00 <?php // @see https://github.com/FriendsOfPHP/PHP-CS-Fixer $finder = PhpCsFixer\Finder::create() ->in(array(__DIR__ . '/bin', __DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/tools')) ; return PhpCsFixer\Config::create() ->setRules(array( '@PSR1' => true, '@PSR2' => true, '@Symfony' => true, 'array_syntax' => array('syntax' => 'long'), 'concat_space' => array('spacing' => 'one'), 'ordered_imports' => true, 'no_trailing_whitespace' => true, 'no_useless_return' => true, 'no_useless_else' => true, 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_order' => true, 'yoda_style' => array( 'equal' => false, 'identical' => false, 'less_and_greater' => false, ) )) ->setFinder($finder) ; sql-parser/CHANGELOG.md 0000644 00000030651 14736103337 0010462 0 ustar 00 # Change Log ## [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.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. * Localizaton 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. * Localizaton 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. sql-parser/.weblate 0000644 00000000124 14736103337 0010265 0 ustar 00 [weblate] url = https://hosted.weblate.org/api/ translation = phpmyadmin/sql-parser sql-parser/locale/kn/LC_MESSAGES/sqlparser.mo 0000644 00000000763 14736103337 0014657 0 ustar 00 �� $ , 8 � 9 Project-Id-Version: SQL parser 5 Report-Msgid-Bugs-To: translators@phpmyadmin.net PO-Revision-Date: 2015-07-24 13:05+0200 Last-Translator: Shameem Ahmed A Mulla <shameem.sam@gmail.com> Language-Team: Kannada <https://hosted.weblate.org/projects/phpmyadmin/master/kn/> Language: kn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n != 1; X-Generator: Weblate 2.4-dev sql-parser/locale/kn/LC_MESSAGES/sqlparser.po 0000644 00000016131 14736103337 0014656 0 ustar 00 # phpMyAdmin translation. # Copyright (C) 2003 - 2013 phpMyAdmin devel team # This file is distributed under the same license as the phpMyAdmin package. # Automatically generated, 2013. # msgid "" msgstr "" "Project-Id-Version: SQL parser 5\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2020-03-20 21:01+0100\n" "PO-Revision-Date: 2015-07-24 13:05+0200\n" "Last-Translator: Shameem Ahmed A Mulla <shameem.sam@gmail.com>\n" "Language-Team: Kannada <https://hosted.weblate.org/projects/phpmyadmin/" "master/kn/>\n" "Language: kn\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 2.4-dev\n" #: src/Component.php:41 src/Component.php:61 msgid "Not implemented yet." msgstr "" #: src/Components/AlterOperation.php:278 src/Statement.php:351 msgid "" "A new statement was found, but no delimiter between it and the previous one." msgstr "" #: src/Components/AlterOperation.php:290 msgid "Missing comma before start of a new alter operation." msgstr "" #: src/Components/AlterOperation.php:302 msgid "Unrecognized alter operation." msgstr "" #: src/Components/Array2d.php:86 #, php-format msgid "%1$d values were expected, but found %2$d." msgstr "" #: src/Components/Array2d.php:110 msgid "An opening bracket followed by a set of values was expected." msgstr "" #: src/Components/ArrayObj.php:112 src/Components/CreateDefinition.php:230 msgid "An opening bracket was expected." msgstr "" #: src/Components/CaseExpression.php:136 src/Components/CaseExpression.php:164 #: src/Components/CaseExpression.php:177 src/Components/CaseExpression.php:191 #: src/Components/IndexHint.php:131 src/Components/IndexHint.php:160 #: src/Components/LockExpression.php:171 src/Components/LockExpression.php:181 #: src/Components/LockExpression.php:189 src/Statements/DeleteStatement.php:254 #: src/Statements/DeleteStatement.php:269 #: src/Statements/DeleteStatement.php:313 #: src/Statements/DeleteStatement.php:325 #: src/Statements/DeleteStatement.php:356 #: src/Statements/DeleteStatement.php:367 #: src/Statements/InsertStatement.php:189 #: src/Statements/InsertStatement.php:217 src/Statements/LoadStatement.php:271 #: src/Statements/LockStatement.php:86 src/Statements/ReplaceStatement.php:155 #: src/Statements/ReplaceStatement.php:183 msgid "Unexpected keyword." msgstr "" #: src/Components/CaseExpression.php:200 msgid "Unexpected end of CASE expression" msgstr "" #: src/Components/CaseExpression.php:225 msgid "Potential duplicate alias of CASE expression." msgstr "" #: src/Components/CaseExpression.php:236 msgid "An alias expected after AS but got " msgstr "" #: src/Components/CaseExpression.php:248 src/Components/Expression.php:353 #: src/Components/Expression.php:373 src/Components/Expression.php:408 msgid "An alias was previously found." msgstr "" #: src/Components/CaseExpression.php:262 #, fuzzy #| msgid "No tables selected." msgid "An alias was expected after AS." msgstr "ಯಾವುದೇ ಕೋಷ್ಟಕಗಳು ಆಯ್ಕೆ ಮಾಡಲಿಲ್ಲ." #: src/Components/CreateDefinition.php:252 msgid "" "A symbol name was expected! A reserved keyword can not be used as a column " "name without backquotes." msgstr "" #: src/Components/CreateDefinition.php:266 msgid "A symbol name was expected!" msgstr "" #: src/Components/CreateDefinition.php:301 msgid "A comma or a closing bracket was expected." msgstr "" #: src/Components/CreateDefinition.php:317 msgid "A closing bracket was expected." msgstr "" #: src/Components/DataType.php:130 msgid "Unrecognized data type." msgstr "" #: src/Components/ExpressionArray.php:101 msgid "An expression was expected." msgstr "" #: src/Components/Expression.php:258 src/Components/Expression.php:420 msgid "An alias was expected." msgstr "" #: src/Components/Expression.php:387 msgid "Unexpected dot." msgstr "" #: src/Components/IndexHint.php:137 src/Components/IndexHint.php:166 #: src/Components/LockExpression.php:159 src/Components/SetOperation.php:138 #: src/Statement.php:247 src/Statements/DeleteStatement.php:278 #: src/Statements/DeleteStatement.php:329 #: src/Statements/InsertStatement.php:227 #: src/Statements/InsertStatement.php:247 src/Statements/LoadStatement.php:274 #: src/Statements/LoadStatement.php:302 src/Statements/LoadStatement.php:323 #: src/Statements/LockStatement.php:93 src/Statements/LockStatement.php:99 #: src/Statements/PurgeStatement.php:109 src/Statements/PurgeStatement.php:119 #: src/Statements/PurgeStatement.php:139 #: src/Statements/ReplaceStatement.php:192 msgid "Unexpected token." msgstr "" #: src/Components/Limit.php:80 src/Components/Limit.php:108 msgid "An offset was expected." msgstr "" #: src/Components/LockExpression.php:91 msgid "Unexpected end of LOCK expression." msgstr "" #: src/Components/LockExpression.php:199 msgid "Unexpected end of Lock expression." msgstr "" #: src/Components/OptionsArray.php:145 #, php-format msgid "This option conflicts with \"%1$s\"." msgstr "" #: src/Components/RenameOperation.php:105 msgid "The old name of the table was expected." msgstr "" #: src/Components/RenameOperation.php:116 msgid "Keyword \"TO\" was expected." msgstr "" #: src/Components/RenameOperation.php:132 msgid "The new name of the table was expected." msgstr "" #: src/Components/RenameOperation.php:151 msgid "A rename operation was expected." msgstr "" #: src/Components/SetOperation.php:121 msgid "Missing expression." msgstr "" #: src/Lexer.php:244 msgid "Unexpected character." msgstr "" #: src/Lexer.php:285 msgid "Expected whitespace(s) before delimiter." msgstr "" #: src/Lexer.php:303 src/Lexer.php:325 msgid "Expected delimiter." msgstr "" #: src/Lexer.php:909 #, php-format msgid "Ending quote %1$s was expected." msgstr "" #: src/Lexer.php:955 msgid "Variable name was expected." msgstr "" #: src/Parser.php:451 msgid "Unexpected beginning of statement." msgstr "" #: src/Parser.php:476 msgid "Unrecognized statement type." msgstr "" #: src/Parser.php:565 msgid "No transaction was previously started." msgstr "" #: src/Statement.php:318 msgid "This type of clause was previously parsed." msgstr "" #: src/Statement.php:396 msgid "Unrecognized keyword." msgstr "" #: src/Statement.php:407 msgid "Keyword at end of statement." msgstr "" #: src/Statement.php:551 msgid "Unexpected ordering of clauses." msgstr "" #: src/Statements/CreateStatement.php:492 msgid "The name of the entity was expected." msgstr "" #: src/Statements/CreateStatement.php:542 #, fuzzy #| msgid "No tables selected." msgid "A table name was expected." msgstr "ಯಾವುದೇ ಕೋಷ್ಟಕಗಳು ಆಯ್ಕೆ ಮಾಡಲಿಲ್ಲ." #: src/Statements/CreateStatement.php:550 msgid "At least one column definition was expected." msgstr "" #: src/Statements/CreateStatement.php:665 msgid "A \"RETURNS\" keyword was expected." msgstr "" #: src/Statements/DeleteStatement.php:337 msgid "This type of clause is not valid in Multi-table queries." msgstr "" #: src/Statements/LockStatement.php:116 msgid "Unexpected end of LOCK statement." msgstr "" #: src/Statements/PurgeStatement.php:136 msgid "Unexpected keyword" msgstr "" sql-parser/locale/eu/LC_MESSAGES/sqlparser.mo 0000644 00000000746 14736103337 0014661 0 ustar 00 �� $ , 8 � 9 Project-Id-Version: SQL parser 5 Report-Msgid-Bugs-To: translators@phpmyadmin.net PO-Revision-Date: 2015-10-15 11:26+0200 Last-Translator: Michal Čihař <michal@cihar.com> Language-Team: Basque <https://hosted.weblate.org/projects/phpmyadmin/master/eu/> Language: eu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n != 1; X-Generator: Weblate 2.5-dev sql-parser/locale/eu/LC_MESSAGES/sqlparser.po 0000644 00000017414 14736103337 0014664 0 ustar 00 # msgid "" msgstr "" "Project-Id-Version: SQL parser 5\n" "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n" "POT-Creation-Date: 2020-03-20 21:01+0100\n" "PO-Revision-Date: 2015-10-15 11:26+0200\n" "Last-Translator: Michal Čihař <michal@cihar.com>\n" "Language-Team: Basque <https://hosted.weblate.org/projects/phpmyadmin/master/" "eu/>\n" "Language: eu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 2.5-dev\n" #: src/Component.php:41 src/Component.php:61 msgid "Not implemented yet." msgstr "" #: src/Components/AlterOperation.php:278 src/Statement.php:351 msgid "" "A new statement was found, but no delimiter between it and the previous one." msgstr "" #: src/Components/AlterOperation.php:290 msgid "Missing comma before start of a new alter operation." msgstr "" #: src/Components/AlterOperation.php:302 msgid "Unrecognized alter operation." msgstr "" #: src/Components/Array2d.php:86 #, php-format msgid "%1$d values were expected, but found %2$d." msgstr "" #: src/Components/Array2d.php:110 msgid "An opening bracket followed by a set of values was expected." msgstr "" #: src/Components/ArrayObj.php:112 src/Components/CreateDefinition.php:230 msgid "An opening bracket was expected." msgstr "" #: src/Components/CaseExpression.php:136 src/Components/CaseExpression.php:164 #: src/Components/CaseExpression.php:177 src/Components/CaseExpression.php:191 #: src/Components/IndexHint.php:131 src/Components/IndexHint.php:160 #: src/Components/LockExpression.php:171 src/Components/LockExpression.php:181 #: src/Components/LockExpression.php:189 src/Statements/DeleteStatement.php:254 #: src/Statements/DeleteStatement.php:269 #: src/Statements/DeleteStatement.php:313 #: src/Statements/DeleteStatement.php:325 #: src/Statements/DeleteStatement.php:356 #: src/Statements/DeleteStatement.php:367 #: src/Statements/InsertStatement.php:189 #: src/Statements/InsertStatement.php:217 src/Statements/LoadStatement.php:271 #: src/Statements/LockStatement.php:86 src/Statements/ReplaceStatement.php:155 #: src/Statements/ReplaceStatement.php:183 msgid "Unexpected keyword." msgstr "" #: src/Components/CaseExpression.php:200 msgid "Unexpected end of CASE expression" msgstr "" #: src/Components/CaseExpression.php:225 msgid "Potential duplicate alias of CASE expression." msgstr "" #: src/Components/CaseExpression.php:236 msgid "An alias expected after AS but got " msgstr "" #: src/Components/CaseExpression.php:248 src/Components/Expression.php:353 #: src/Components/Expression.php:373 src/Components/Expression.php:408 msgid "An alias was previously found." msgstr "" #: src/Components/CaseExpression.php:262 #, fuzzy #| msgid "No databases selected." msgid "An alias was expected after AS." msgstr "Ez dago datu-baserik aukeratuta." #: src/Components/CreateDefinition.php:252 msgid "" "A symbol name was expected! A reserved keyword can not be used as a column " "name without backquotes." msgstr "" #: src/Components/CreateDefinition.php:266 #, fuzzy msgid "A symbol name was expected!" msgstr "Txantiloi-fitxategiaren izena" #: src/Components/CreateDefinition.php:301 #, fuzzy #| msgid "No databases selected." msgid "A comma or a closing bracket was expected." msgstr "Ez dago datu-baserik aukeratuta." #: src/Components/CreateDefinition.php:317 msgid "A closing bracket was expected." msgstr "" #: src/Components/DataType.php:130 msgid "Unrecognized data type." msgstr "" #: src/Components/ExpressionArray.php:101 #, fuzzy #| msgid "No databases selected." msgid "An expression was expected." msgstr "Ez dago datu-baserik aukeratuta." #: src/Components/Expression.php:258 src/Components/Expression.php:420 #, fuzzy #| msgid "No databases selected." msgid "An alias was expected." msgstr "Ez dago datu-baserik aukeratuta." #: src/Components/Expression.php:387 msgid "Unexpected dot." msgstr "" #: src/Components/IndexHint.php:137 src/Components/IndexHint.php:166 #: src/Components/LockExpression.php:159 src/Components/SetOperation.php:138 #: src/Statement.php:247 src/Statements/DeleteStatement.php:278 #: src/Statements/DeleteStatement.php:329 #: src/Statements/InsertStatement.php:227 #: src/Statements/InsertStatement.php:247 src/Statements/LoadStatement.php:274 #: src/Statements/LoadStatement.php:302 src/Statements/LoadStatement.php:323 #: src/Statements/LockStatement.php:93 src/Statements/LockStatement.php:99 #: src/Statements/PurgeStatement.php:109 src/Statements/PurgeStatement.php:119 #: src/Statements/PurgeStatement.php:139 #: src/Statements/ReplaceStatement.php:192 msgid "Unexpected token." msgstr "" #: src/Components/Limit.php:80 src/Components/Limit.php:108 msgid "An offset was expected." msgstr "" #: src/Components/LockExpression.php:91 #, fuzzy #| msgid "At Beginning of Table" msgid "Unexpected end of LOCK expression." msgstr "Taularen hasieran" #: src/Components/LockExpression.php:199 #, fuzzy #| msgid "At Beginning of Table" msgid "Unexpected end of Lock expression." msgstr "Taularen hasieran" #: src/Components/OptionsArray.php:145 #, php-format msgid "This option conflicts with \"%1$s\"." msgstr "" #: src/Components/RenameOperation.php:105 msgid "The old name of the table was expected." msgstr "" #: src/Components/RenameOperation.php:116 msgid "Keyword \"TO\" was expected." msgstr "" #: src/Components/RenameOperation.php:132 msgid "The new name of the table was expected." msgstr "" #: src/Components/RenameOperation.php:151 #, fuzzy #| msgid "The row has been deleted." msgid "A rename operation was expected." msgstr "Errenkada ezabatua izan da" #: src/Components/SetOperation.php:121 #, fuzzy #| msgid "as regular expression" msgid "Missing expression." msgstr "adierazpen erregular moduan" #: src/Lexer.php:244 msgid "Unexpected character." msgstr "" #: src/Lexer.php:285 msgid "Expected whitespace(s) before delimiter." msgstr "" #: src/Lexer.php:303 src/Lexer.php:325 msgid "Expected delimiter." msgstr "" #: src/Lexer.php:909 #, fuzzy, php-format msgid "Ending quote %1$s was expected." msgstr "%s taula ezabatu egin da" #: src/Lexer.php:955 #, fuzzy msgid "Variable name was expected." msgstr "Txantiloi-fitxategiaren izena" #: src/Parser.php:451 #, fuzzy #| msgid "At Beginning of Table" msgid "Unexpected beginning of statement." msgstr "Taularen hasieran" #: src/Parser.php:476 msgid "Unrecognized statement type." msgstr "" #: src/Parser.php:565 msgid "No transaction was previously started." msgstr "" #: src/Statement.php:318 msgid "This type of clause was previously parsed." msgstr "" #: src/Statement.php:396 msgid "Unrecognized keyword." msgstr "" #: src/Statement.php:407 #, fuzzy #| msgid "At Beginning of Table" msgid "Keyword at end of statement." msgstr "Taularen hasieran" #: src/Statement.php:551 #, fuzzy #| msgid "At Beginning of Table" msgid "Unexpected ordering of clauses." msgstr "Taularen hasieran" #: src/Statements/CreateStatement.php:492 msgid "The name of the entity was expected." msgstr "" #: src/Statements/CreateStatement.php:542 #, fuzzy msgid "A table name was expected." msgstr "Txantiloi-fitxategiaren izena" #: src/Statements/CreateStatement.php:550 #, fuzzy #| msgid "The row has been deleted." msgid "At least one column definition was expected." msgstr "Errenkada ezabatua izan da" #: src/Statements/CreateStatement.php:665 msgid "A \"RETURNS\" keyword was expected." msgstr "" #: src/Statements/DeleteStatement.php:337 msgid "This type of clause is not valid in Multi-table queries." msgstr "" #: src/Statements/LockStatement.php:116 #, fuzzy #| msgid "At Beginning of Table" msgid "Unexpected end of LOCK statement." msgstr "Taularen hasieran" #: src/Statements/PurgeStatement.php:136 msgid "Unexpected keyword" msgstr "" #, fuzzy #~| msgid "Error" #~ msgid "error #1" #~ msgstr "Errorea" #, fuzzy #~| msgid "Query type" #~ msgid "strict error" #~ msgstr "Kontsulta mota" sql-parser/locale/pt_BR/LC_MESSAGES/sqlparser.mo 0000644 00000010755 14736103337 0015257 0 ustar 00 �� + t ; � � * � ! � * & L Q � � c � ? Z q � � <