Home » Database » SQL_Parser
An SQL parser
This package is unmaintained.
Download latest release 0.7.0 (archived versions might be outdated)
License: LGPL
Description
This class is primarily an SQL parser, written with influences from a variety of sources (mSQL, CPAN's SQL-Statement, mySQL). It also includes a tokenizer (lexer) class and a reimplementation of the ctype extension in PHP.
Maintainers
- Alan Knowles (alan_k) — lead, active
- Sebastian Mendel (cybot) — lead, active
- Brent Cook (busterb) — lead, inactive
- Erich Enke (epte) — lead, inactive
Dependencies
Required
- PHP (>= 5.2.0)
- PEAR Installer (>= 1.6.1)
Releases
- 0.7.0 (devel, 2016-04-06)
Release notes
License: LGPL
Minor Feature / bug fixes release
* basic create table, alter table support
fix #18647 - extral lexemes for mysql dialect
fix #18298 - document the options for dialect a bit better
fix #18559 - update parsing (bug got lost somewhere)
fix #18648 - index table options support (thomas ernest1)
fix #16129 - support columns without column names
fix #4089 - IF EXISTS support for drop table - 0.6.0 (devel, 2010-10-06)
Release notes
License: LGPL
QA release
* Fixed bug in parsing default function arguments
* Added more test cases; tests no longer rely on Var_Dump for now
* Dialects can pass parser and lexer options to change behavior
beyond just keywords.
* Added lexer option to accept idents starting with a number
Bug #4034 Assignment of field = field not recognized busterb
Bug #4035 Update statements should recognize FROM clause cybot
Bug #4036 Implement Parser with Bridge design pattern
Bug #4054 Parsing create: int(11) not recognized as type epte
Bug #4058 [Patch] Functions added to Dialect_MySQL busterb
Bug #4059 parseFieldList (or Options?) doesn't handle auto_increment
Bug #4066 Functions are keywords busterb
Bug #4067 Dialect_Mysql.php needs tinyint in $types busterb
Bug #4081 [PATCH] Added tinyint to synonyms epte
Bug #4082 MySQL: PRIMARY KEY(id) line breaks epte
Bug #4085 Lexer should recognize identifier delimiters cybot
Bug #4086 (UN)LOCK TABLES statements not recognized (MySQL) cybot
Bug #4087 Comma not recognized after PRIMARY KEY statement cybot
Bug #4088 c-style block comments not handled cybot
Bug #5755 Cannot handle select in form of tablename.* epte
Bug #6438 Column list with '*' cannot have additional columns epte
Bug #6439 Improper handling of absolute column names eg: table.column epte
Bug #11462 generate_testcases.php does not correct split queries cybot
Bug #11463 int and string is a valid token after SELECT cybot
Bug #11464 FROM is not required for SELECT cybot
Bug #11472 comment handling for ANSI and MySQL cybot
Bug #11544 Arithmetic Operations in (), problem with update and in where clause cybot
Bug #11679 Wrong parsed select statement. cybot
Bug #13403 Parser does not accept arbitrary expressions in JOIN clauses cybot
Bug #13404 NOW() causes infinite loop cybot
Bug #14744 keyword parse problem doconnor - 0.5 (devel, 2004-05-11)
Release notes
License: LGPL
Parser:
* More robust search clause parsing; now handles subsearches
with parentheses in more cases (Brent Cook
* Add more alias handling cases (John Griffin)
* Handle ordinal functions in select project clauses correctly
* Add explicit join support (John Griffin)
* Add initial support for multiple SQL dialects (ANSI, MySQL)
(John Griffin, Brent Cook)
* Added SQL Compiler that takes a parse tree and generates a
SQL statement (John Griffin) - 0.4 (devel, 2003-12-20)
Release notes
License: LGPL
Lexer:
Fixed off-by-one error and other accesses of undefined memory
Idents can be of the form aaa.bbb
Parser:
Can now parse table.field style field names
Understand some forms of table alias
Fix some bugs in error carret display
Fix some references to undefined memory
Handle some subselects
Handle 'in' and 'not in' keywords for sets and subselects
Use new features of Lexer
Fix quantum comparisons in creates
add support for 'group by'
Thanks to John Griffin for many of these fixes. There are many more
left to merge in the next release - hopefully, it wont be too far
in the future. - 0.3 (devel, 2003-04-14)
Release notes
License: LGPL
This is an 'I'm back' release. Did you miss me?
Mostly focusing on the Lexer this time.
* Add support for pushing tokens back (Jason Pell)
* Add support for # and -- comments (for real this time)
* Add support for ellipsis tokens
* Removed extraneous negative-number parsing - 0.2 (devel, 2002-12-18)
Release notes
License: LGPL
* Add support for column and table aliases (thanks to Lauren Matheson)
* Add support for null as a value type (thanks to Jason Pell) - 0.1 (devel, 2002-09-30)
Release notes
License: LGPL
Initial release as a stand-alone package. Lots of documentation is needed (e.g. grammar notes), but it is already pretty robust and easy to extend. The lexer could use some optimization for speed too.
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #272 | Closed | Bug | 2003-11-18 | Parser does not handle parentheses in where clause | |
| #457 | Closed | Bug | 2003-12-19 | Notice with function raiseError() in Parser.php | |
| #459 | Closed | Bug | 2003-12-19 | Notices with function get() in lexer.php | |
| #487 | Closed | Bug | 2003-12-23 | Lexer can't handle functions inside getParams() | |
| #495 | Closed | Bug | 2003-12-25 | User is a reserved word. | |
| #4034 | Closed | Bug | 2005-04-02 | Assignment of field = field not recognized | |
| #4035 | Closed | Bug | 2005-04-02 | Update statements should recognize FROM clause | |
| #4036 | Closed | Req | 2005-04-03 | Implement Parser with Bridge design pattern | |
| #4054 | Closed | Bug | 2005-04-04 | Parsing create: int(11) not recognized as type | |
| #4058 | Closed | Bug | 2005-04-04 | [Patch] Functions added to Dialect_MySQL | |
| #4059 | Closed | Bug | 2005-04-05 | parseFieldList (or Options?) doesn't handle auto_increment | |
| #4066 | Closed | Bug | 2005-04-05 | Functions are keywords | |
| #4067 | Closed | Bug | 2005-04-05 | Dialect_Mysql.php needs tinyint in $types | |
| #4081 | Closed | Bug | 2005-04-06 | [PATCH] Added tinyint to synonyms | |
| #4082 | Closed | Bug | 2005-04-06 | MySQL: PRIMARY KEY(id) line breaks | |
| #4084 | Closed | Req | 2005-04-06 | Ability to handle multiple queries (ala mysqldump) | |
| #4085 | Closed | Bug | 2005-04-06 | Lexer should recognize identifier delimiters | |
| #4086 | Closed | Bug | 2005-04-06 | (UN)LOCK TABLES statements not recognized (MySQL) | |
| #4087 | Closed | Bug | 2005-04-06 | Comma not recognized after PRIMARY KEY statement | |
| #4088 | Closed | Bug | 2005-04-06 | c-style block comments not handled | |
| #4089 | Closed | Bug | 2005-04-06 | IF EXISTS not recognized in DROP statements | |
| #5755 | Closed | Bug | 2005-10-22 | Cannot handle select in form of tablename.* | |
| #6209 | Verified | Req | 2005-12-09 | PATCH NEEDED - Tables like [cat/dog] not recognized | |
| #6438 | Closed | Bug | 2006-01-07 | Column list with '*' cannot have additional columns | |
| #6439 | Closed | Bug | 2006-01-07 | Improper handling of absolute column names eg: table.column | |
| #7416 | Open | Req | 0.5 | 2006-04-18 | PATCH NEEDED - Pound Sign Breaking Legal Field Names |
| #8388 | Open | Bug | CVS | 2006-08-08 | PATCH NEEDED - Between statements not recognized |
| #11462 | Closed | Bug | CVS | 2007-06-28 | generate_testcases.php does not correct split queries |
| #11463 | Closed | Bug | CVS | 2007-06-28 | int and string is a valid token after SELECT |
| #11464 | Closed | Bug | CVS | 2007-06-28 | FROM is not required for SELECT |
| #11466 | Open | Bug | CVS | 2007-06-28 | PATCH NEEDED - 1a is not treated as single string |
| #11469 | Analyzed | Req | CVS | 2007-06-28 | CLARIFICATION NEEDED - unify line endings |
| #11472 | Closed | Req | CVS | 2007-06-28 | comment handling for ANSI and MySQL |
| #11544 | Closed | Bug | CVS | 2007-07-06 | Arithmetic Operations in (), problem with update and in where clause |
| #11679 | Closed | Bug | CVS | 2007-07-24 | Wrong parsed select statement. |
| #13403 | Closed | Bug | CVS | 2008-03-16 | Parser does not accept arbitrary expressions in JOIN clauses |
| #13404 | Closed | Bug | CVS | 2008-03-16 | NOW() causes infinite loop |
| #14744 | Closed | Bug | 0.5 | 2008-10-05 | keyword parse problem |
| #16023 | Closed | Bug | 0.5 | 2009-03-11 | Parser.php:190 does assignment instead of equality |
| #16139 | Closed | Bug | CVS | 2009-04-22 | The compiler doesn't support insert without column_names. |
| #16215 | Closed | Bug | CVS | 2009-05-11 | Compiler doesn't support "null" type. |
| #17118 | Open | Bug | CVS | 2010-02-16 | PATCH NEEDED - Unit tests fail |
| #17920 | Open | Bug | 0.5 | 2010-09-30 | PATCH NEEDED - subselect parsing error |
| #18298 | Closed | Doc | 0.6.0 | 2011-02-23 | Does not handle `(Backtick) encapsulated Table names |
| #18637 | No Feedback | Bug | 0.6.0 | 2011-06-30 | Cannot parse ALTER TABLE queries |
| #18647 | Closed | Req | 0.6.0 | 2011-07-01 | Add new lexemes for MySQL dialect |
| #18648 | Closed | Req | 0.6.0 | 2011-07-01 | Add support for CONSTRAINT and INDEX in declaration CREATE TABLE |
| #18736 | No Feedback | Bug | 0.6.0 | 2011-08-16 | mysql dialect include fails |
| #19210 | Open | Bug | 0.6.0 | 2012-01-09 | [needs patch] Does not recognize nested SELECT statements |
| #19356 | Bogus | Bug | 0.6.0 | 2012-03-28 | Unable to parse any query |
| #21020 | Feedback | Req | 0.6.0 | 2016-01-25 | Deprecated messages when using under PHP 7 |