项目作者: exasol

项目描述 :
Build SQL statements safely without string concatenation
高级语言: Java
项目地址: git://github.com/exasol/sql-statement-builder.git
创建时间: 2018-09-18T06:38:29Z
项目社区:https://github.com/exasol/sql-statement-builder

开源协议:MIT License

下载


SQL Statement Builder

Build Status
Maven Central – Exasol SQL Statement Builder

Quality Gate Status

Security Rating
Reliability Rating
Maintainability Rating
Technical Debt

Code Smells
Coverage
Duplicated Lines (%)
Lines of Code

The Exasol SQL Statement Builder abstracts programmatic creation of SQL statements and is intended to replace ubiquitous string concatenation solutions which make the code hard to read and are prone to error and security risks.

Goals:

  1. Foster clean and readable code
  2. Allow for thorough validation of dynamic parts
  3. Detect as many errors as possible at compile time
  4. Don’t repeat yourself (DRY)
  5. Allow extension for different SQL dialects

In a Nutshell

The following example gives you an idea about what you can do with the SQL Statement Builder. Check our user guide for more details.

  1. Select select = StatementFactory.getInstance().select()
  2. .field("fieldA", "tableA.fieldB", "tableB.*");
  3. select.from().table("schemaA.tableA");
  4. select.limit(10);
  5. StringRendererConfig config = StringRendererConfig.builder().quoteIdentifiers(true).build();
  6. SelectRenderer renderer = new SelectRenderer(config);
  7. select.accept(renderer);
  8. String sql = renderer.render();

Table of Contents

Information for Users

“Users” from the perspective of the sql-statement-builder are developers integrating the module into their own software.

Information for Developers