******************************
How to use it
******************************
Compile from Source Code
==============================
You will need to have ``JDK 8`` or ``JDK 11`` installed.
.. tabs::
.. tab:: Maven
.. code-block:: shell
git clone https://github.com/prestodb/sql.git
cd sql
mvn install
.. tab:: Gradle
.. code-block:: shell
git clone https://github.com/prestodb/sql.git
cd sql
gradle build
Maven Artifacts
==============================
.. tabs::
.. tab:: Stable Release
.. code-block:: xml
:substitutions:
com.facebook.presto
presto-coresql
|PRESTO_SQL_PARSER_VERSION|
.. tab:: Development Snapshot
.. code-block:: xml
:substitutions:
presto-coresql-snapshots
true
https://oss.sonatype.org/content/groups/public/
com.facebook.presto
presto-coresql
|PRESTO_SQL_PARSER_SNAPSHOT_VERSION|
Parse a SQL Statements
==============================
Parse the SQL Text into Java Objects:
.. code-block:: java
import com.facebook.coresql.parser.AstNode;
import com.facebook.coresql.parser.ParserHelper;
import com.facebook.coresql.parser.Unparser;
String sqlStr = "select 1 from dual where a=b";
AstNode ast = ParserHelper.parseStatement(sqlStr);
String unparsedSqlStr = Unparser.unparse(ast);