Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pranavan15/sql-parser

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

270 Commits
270 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Parser

A validating SQL lexer and parser with a focus on MySQL dialect.

Code status

Build Status Code Coverage codecov.io Scrutinizer Code Quality

Installation

Please use Composer to install:

composer require phpmyadmin/sql-parser

Usage

Command line utility

Command line utility to syntax highlight SQL query:

./vendor/bin/highlight-query --query "SELECT 1"

Command line utility to lint SQL query:

./vendor/bin/lint-query --query "SELECT 1"

Formatting SQL query

echo SqlParser\Utils\Formatter::format($query, array('type' => 'html'));

Parsing and building SQL query

$parsed = new SqlParser\Parser($query);

// you can now inspect or change query
var_dump($parser->statements[0]);

// and build it again
$statement = $parser->statements[0];
$statement->build()

More information

This library was originally created during the Google Summer of Code 2015 and has been used by phpMyAdmin since version 4.5.

About

A validating SQL lexer and parser with a focus on MySQL dialect.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.