|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
need an sql parser
Honest to god, I searched the internet for a good hour and half and found nothing.
Does anyone know of an sql parser that can validate an sql statement? It doesn't have to be in php. I remember seeing one here before and can't find it now. |
|
#2
|
||||
|
||||
|
Moved to Development Software.
Chibiguy, please keep your posts on-topic, thanks.
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#3
|
||||
|
||||
|
my fault.
|
|
#4
|
|||
|
|||
|
Here are a few Perl parsers:
http://search.cpan.org/~jzucker/SQL...b/SQL/Parser.pm http://search.cpan.org/~jzucker/SQL...QL/Statement.pm http://sqlfairy.sourceforge.net/ http://sourceforge.net/projects/sqlfairy/ A Delphi parser is here: http://sourceforge.net/projects/gasqlparser/ And a description of the SQL language can be found here: http://www.netaktive.com/article.php3?id_article=11 http://www.contrib.andrew.cmu.edu/~...sql/sql1992.txt http://www.contrib.andrew.cmu.edu/~...l2bnf.aug92.txt |
|
#5
|
|||
|
|||
|
If you want to write your own parser
The O'Reilly Lex & Yacc book contains the implementation of an SQL parser, but that is probably not what you want, just thought I would mention it.
|
|
#6
|
|||
|
|||
|
SQL parser is server specific. the one works with Oracle may not work with MS SQLServer, Sybase, or MySQL
__________________
Wedding Gifts | Web Development | Order Fulfllment | Supply Chain | E-Business | Add to 100 SEO Friendly Directories fast do it yourself |
|
#7
|
||||
|
||||
|
You can try a workaround, send an EPLAIN query to the database and watch the response.
On Oracle there is a php function ociparse which is said to Quote:
Hope this helps!
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#8
|
||||
|
||||
|
I thought that I'd mention that I did finally create a parser ...
http://txtsql.dotgeek.org and click "development" link at the top... it's in two files - txtSQL.tokenizer.php and txtSQL.lexer.php Tell me what you guys think... |
|
#9
|
|||
|
|||
|
Dead link
ChibiGuy, do you still have that parser available? The link above is dead.
Thanks! |
|
#10
|
|||
|
|||
|
Repost Link?
Quote:
The link is dead. Do you know if there's another link? |
|
#11
|
||||
|
||||
|
Just curious, do you really want a generic SQL parser?
They are mostly useless. Nobody writes SQL. Or perhaps very, very few people write SQL. They write in sql for some implementation such as MySql, SQL Server, Oracle, etc. While it is technically possible to use pure SQL, each package adds some cool stuff that makes your life easier, and so most humans fall into the trap of using the extensions. |
|
#12
|
|||
|
|||
|
Quote:
Yes, I do. While its true that people use different features, most SQL is in fact portable. Take just about any SELECT, UPDATE, or INSERT statement. They are going to work most of the time on any platform as long as the correct objects are in the database. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Development Software > need an sql parser |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|