5 Command line tool to validate (syntax check) SQL files.
6 Primarily for MySQL ``.sql`` files.
8 Can be used in git pre-commit hooks to catch errors.
16 $ php-sqllint tests/files/create-missingcomma.sql
17 Checking SQL syntax of tests/files/create-missingcomma.sql
18 Line 3, col 5 at "pid": A comma or a closing bracket was expected.
19 Line 3, col 13 at "11": Unexpected beginning of statement.
20 Line 3, col 17 at "DEFAULT": Unrecognized statement type.
24 $ php-sqllint -r emacs tests/files/create-noname.sql
25 tests/files/create-noname.sql:1.12:Error: The name of the entity was expected.
26 tests/files/create-noname.sql:1.13:Error: A closing bracket was expected.
27 tests/files/create-noname.sql:1.13:Error: At least one column definition was expected.
33 Does ``php-sqllint`` not detect a syntax error, or doesn't support a certain
35 Then please report a bug at `udan11/sql-parser`__.
37 __ https://github.com/udan11/sql-parser
43 - PEAR's `Console_Commandline`__
44 - `udan11's SqlParser`__, which is used by `phpMyAdmin`__
46 __ http://pear.php.net/package/Console_CommandLine
47 __ https://github.com/udan11/sql-parser
48 __ https://www.phpmyadmin.net/
51 Dependency installation
52 =======================
57 Now you can use ``./bin/php-sqllint`` without building the phar yourself.
63 You'll need `phing`__, the PHP build tool::
67 __ https://www.phing.info/
69 The result are ``.phar`` files in ``dist/`` directory that you can execute::
71 $ ./dist/php-sqllint-0.0.1.phar tests/files/create-noname.sql
72 Checking SQL syntax of tests/files/create-noname.sql
73 Line 1, col 12 at "(": The name of the entity was expected.
82 ``php-sqllint`` is licensed under the `AGPL v3`__ or later.
84 __ http://www.gnu.org/licenses/agpl.html
90 http://cweiske.de/php-sqllint.htm
92 http://git.cweiske.de/php-sqllint.git
94 Mirror: https://github.com/cweiske/php-sqllint