Git Product home page Git Product logo

merrily01 / jsqlparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsqlparser/jsqlparser

0.0 1.0 0.0 7.29 MB

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern

Home Page: https://github.com/JSQLParser/JSqlParser/wiki

License: Apache License 2.0

JavaScript 0.15% Python 0.06% Java 98.64% XSLT 0.19% CSS 0.37% PLSQL 0.59%

jsqlparser's Introduction

Build Status

Build Status (Legacy) Coverage Status Codacy Badge Maven Central Javadocs

Gitter

Summary

Please visit the WebSite. JSqlParser is a RDBMS agnostic SQL statement parser. It translates SQL statements into a traversable hierarchy of Java classes (see Samples):

SELECT 1 FROM dual WHERE a = b
SQL Text
 └─Statements: statement.select.PlainSelect
    ├─selectItems: statement.select.SelectItem
    │  └─LongValue: 1
    ├─Table: dual
    └─where: expression.operators.relational.EqualsTo
       ├─Column: a
       └─Column: b
String sqlStr = "select 1 from dual where a=b";

PlainSelect select = (PlainSelect) CCJSqlParserUtil.parse(sqlStr);

SelectItem selectItem =
        select.getSelectItems().get(0);
Assertions.assertEquals(
        new LongValue(1)
        , selectItem.getExpression());

Table table = (Table) select.getFromItem();
Assertions.assertEquals("dual", table.getName());

EqualsTo equalsTo = (EqualsTo) select.getWhere();
Column a = (Column) equalsTo.getLeftExpression();
Column b = (Column) equalsTo.getRightExpression();
Assertions.assertEquals("a", a.getColumnName());
Assertions.assertEquals("b", b.getColumnName());
}

JSqlParser aims to support the SQL standard as well as all major RDBMS. Any missing syntax or features can be added on demand.

RDBMS Statements
Oracle
MS SQL Server and Sybase
PostgreSQL
MySQL and MariaDB
DB2
H2 and HSQLDB and Derby
SQLite
SELECT
INSERT, UPDATE, UPSERT, MERGE
DELETE, TRUNCATE TABLE
CREATE ..., ALTER ...., DROP ...
WITH ...

JSqlParser can also be used to create SQL Statements from Java Code with a fluent API (see Samples).

Alternatives to JSqlParser?

General SQL Parser looks pretty good, with extended SQL syntax (like PL/SQL and T-SQL) and java + .NET APIs. The tool is commercial (license available online), with a free download option.

License

JSqlParser is dual licensed under LGPL V2.1 or Apache Software License, Version 2.0.

jsqlparser's People

Contributors

wumpz avatar manticore-projects avatar tomershay avatar anemortalkid avatar gitmotte avatar ceekaygit avatar ted-johnson avatar tvar avatar cbockermann avatar georgekankava avatar oliviercavadenti avatar valdasraps avatar d2a-raudenaerde avatar rfscholte avatar skomlaebri avatar zaza avatar chiangcho avatar chrycheng avatar dependabot[bot] avatar messfish avatar optimizing-ci-builds avatar mo3000 avatar a4vision avatar cmoine avatar davelindquist-egistix avatar fanchuo avatar bgaborg avatar chiastic-security avatar matthiasblaesing avatar rodac avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.