How to use sql-parser components in phpMyAdmin
This article is to share with you about how to use sql-parser components in phpMyAdmin, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
PhpMyAdmin is an open source database management tool running on the web side, which supports the management of MySQL and MariaDB databases. PhpMyAdmin program mainly uses php and javascript development, its installation and use are relatively simple and there have been a lot of related introduction will not be repeated, today is to introduce a core component of the source code sql-parser.
Introduction to sql-parser
The main purpose of sql-parser component is to carry out lexical analysis and syntax analysis of SQL sentences, and then to realize the requirements of deconstruction, processing, replacement and reassembly of SQL statements. In addition, it can also process SQL by highlight. Sql-parser is implemented in pure PHP language, and it is also one of the few modules in the whole phpMyAdmin source code that has a clear code architecture and conforms to the current PSR standard specification in the PHP world.
Sql-parser component installation
Php,git client and composer php package management tools need to be installed beforehand.
Margin@margin-MB1:~/tmp$ sudo git clone https://github.com/phpmyadmin/sql-parser.gitmargin@margin-MB1:~/tmp$ cd sql-parser & & sudo composer install
After the component is installed, the specific call is described below.
Parsing ordinary sentences