All Projects → Yeamy → SqlBuilder

Yeamy / SqlBuilder

Licence: GPL-2.0 license
This project is a SQL statement builder, allow you to write SQL in Java.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to SqlBuilder

jakartaee-azure
Java/Jakarta EE on Azure
Stars: ✭ 35 (+133.33%)
Mutual labels:  javaee
geronimo-specs
Mirror of Apache Geronimo specs
Stars: ✭ 20 (+33.33%)
Mutual labels:  javaee
codigo-tutoriales-blog
Código de ejemplo para el desarrollo ágil de aplicaciones con Java
Stars: ✭ 16 (+6.67%)
Mutual labels:  javaee
ozark-react
A ViewEngine for ReactJS templates for the Java EE MVC 1.0 reference implementation Ozark.
Stars: ✭ 43 (+186.67%)
Mutual labels:  javaee
springmvc
spring mvc study
Stars: ✭ 87 (+480%)
Mutual labels:  javaee
EasyShiro
基于 RBAC 模型功能全面的 Shiro 安全集成&简化&扩展组件。Shiro integration & simplifies & Extension component based RBAC
Stars: ✭ 47 (+213.33%)
Mutual labels:  javaee
geronimo
Mirror of Apache Geronimo
Stars: ✭ 35 (+133.33%)
Mutual labels:  javaee
ncms
Java CMS engine. Host and develop multiple websites inside a single instance through the GUI and benefit from features like A/B testing, affiliate tracking tools, and a high performance template engine with CSS stylesheets processing & scripts minification.
Stars: ✭ 32 (+113.33%)
Mutual labels:  javaee
tomcat-training
Apache Tomcat Training Material
Stars: ✭ 15 (+0%)
Mutual labels:  javaee
HotelReservationSystem
A web application to book a room in a hotel (room reservation).
Stars: ✭ 76 (+406.67%)
Mutual labels:  javaee
ping
A WAR Ping For JavaEE 7 Application Servers
Stars: ✭ 51 (+240%)
Mutual labels:  javaee
learning-path-java-ee
Learning path Java EE
Stars: ✭ 19 (+26.67%)
Mutual labels:  javaee
EasyEE-Auto
EasyEE 自动化代码生成器。EasyEE Automated code generator.
Stars: ✭ 39 (+160%)
Mutual labels:  javaee
JavaEE-SSH-Template
javaEE+SSH框架模板项目
Stars: ✭ 26 (+73.33%)
Mutual labels:  javaee
AwesomeMall
Java EE电商项目(使用SSM框架)
Stars: ✭ 29 (+93.33%)
Mutual labels:  javaee
application-modernization-javaee-quarkus
Application Modernization Sample - From Java EE (2010) to Cloud-Native (2021)
Stars: ✭ 99 (+560%)
Mutual labels:  javaee
x-ray
Statistics and analytics Java EE 6 software for blogs (tested with roller) and webapps. It is a vanilla Java EE 6 (REST/JAX-RS, CDI, EJB, JPA) app, tested on Glassfish v3.1, built with Maven 3 / hudson and developed with NetBeans 7. X-ray is the sample app of the "Real World Night Hacks" book.
Stars: ✭ 27 (+80%)
Mutual labels:  javaee
further-cdi
🔊 Going further with CDI presentation
Stars: ✭ 28 (+86.67%)
Mutual labels:  javaee
myblog
项目:一款Github上开源的博客系统项目 目的:对学到的框架、开源组件、前端技术进行应用学习。同时开发完成后写技术博客,开源到Github上
Stars: ✭ 23 (+53.33%)
Mutual labels:  javaee
microprofile1.2-samples
Eclipse MicroProfile 1.2 Samples
Stars: ✭ 22 (+46.67%)
Mutual labels:  javaee

SQL Statement Builder

English | 中文

This project is a SQL statement builder, allow you write SQL in Java.

It's not a fast way to build SQL statement, but it may make your codes more clear and more intuitive.

0. Example

The simple demo like this:

Column fruit_name = new Column("name");
SQL.delete("fruit", Clause.equal(fruit_name, "apple"));

As the output sql is:

DELETE FROM `fruit` WHERE `name` = "apple";

1. INSERT

String sql = new Insert(String table)
		.addAll(Map<String, Object> cv)          // by map<column, value>
		.add(String column, Object value)        // by values
		.toString();

2. DELETE

SQL.delete(String table, Clause where);

3. UPDATE

String sql = new Update(String table)
		.addAll(Map<String, Object> cv)          // by map<column, value>
		.add(String column, Object value)        // by values
		.where(clause)
		.toString();

4. SELECT

Simple way to select all colunm in one table.

SQL.select(String table, Clause where, int limit);

Most of time you may use the Select Builder for complex query.

You're no need to input the table name for the Builder, but the table name of the Column must be NON-NULL, especially in multi-table queries!

Column price_fruitId = new Column("price", "fruitId");
Column fruit_fruitId = new Column("fruit", "fruitId");
Column fruit_name = new Column("fruit", "name");

String sql = new Select()
		.addColumn(new Column("mylike", null))     // no column
		.addColumn(new Column("fruit", "*"))       // all column in table
		.addColumn(new Column("price", xxx))       // any column in table
		.innerJoin(price_fruitId, fruit_fruitId)   // join
		.where(Clause.like(fruit_name, "apple"))   // where
		.orderBy(new Asc(price_fruitId).desc(xxx)) // order by
		.limit(2)                                  // limit

5. WHERE

// Sigle clause:
//      in, between, isNull, isNotNull, like,
//      equal(=), lessThan(<), lessEqual(<=), moreThan(>), moreEqual(>=)
Clause.equal(column, pattern)

// Multi-clause
MultiClause clause = new MultiClause(clause1)
		.and(clause2)
		.or(new MultiClause(xxx)...);

6. Column

Column(String name);                              // no table
Column(String table, String name);                // with table
Column(table, name).as(String alias);             // with column alias
Column(table, name).as(tableAlias, nameAlias);    // with table alias
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].