5 minutes, 10 lines
More than 100 format options, txt, html and RTF output
PHP, C#, VB.NET, Java, VCL and any COM enabled languages (VB, VC etc)
If you need to add SQL format/beautify features in your own program, it's highly recommended
to use our SQL formatter feature in General SQL Parser. It will save you hundreds of hours if not more!
We know how difficult it is to build a flexible and stable SQL formatter. If you need
to support more than one SQL dialect like ORACLE, MS SQL SERVER, DB2, MySQL
then this component/library will be the most valuable investment you ever made.
gudu_sqlpp [-d=dbvendor] [-f=path_to_sql_file] [-help]
dbvendor: mssql, oracle, db2, mysql, access, mdx.
if no dbvendor specified, mssql was used as default database.
if no sql file was specified, read sql from stdio, press CTRL+D to end input.
After formatting sql, you can check exit status code:
$ echo $?
return 0 means formatting sql successfully, 1 means formatting sql failed.
example 1: format test.sql using sql server engine.
$ gudu_sqlpp -d=mssql -f=test.sql
example 2: format test.sql using input redirect, using sql server engine.
$ gudu_sqlpp -d=mssql < test.sql
example 3: format SQL form STDIO, using oracle engine.
$ gudu_sqlpp -d=oracle
example 4: format SQL form STDIO, using default database engine: sql server.
$ gudu_sqlpp
This sql formatting tool can be used in PHP like this:
<?php $output = array(); $last_line = exec ( '/path_to_tool/gudu_sqlpp -f=/path_to_sql/test.sql',$output, $return); echo $last_line.'<br>'; print_r($output); echo $return.'<br>'; ?>
If you have any questions about General SQL Parser, You can always send us an email and we'll get back to you within a few hours.
Yes, of course. We collect all kinds of examples in this page to illustrate how and why you want to use general sql parser, hope it can help you to make better use of this library.