Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2018-2022 Pavel Ponec
* https://github.com/pponec/ujorm/blob/master/project-m2/ujo-tools/src/main/java/org/ujorm/tools/jdbc/SqlBuilder.java
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ujorm.tools.sql;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.ujorm.tools.Assert;
import org.ujorm.tools.jdbc.JdbcBuilder;
/**
* PrepareStatement builder support
*
*
How to use a SELECT
*
* SqlBuilder sql = new SqlBuilder()
* .select("t.id", "t.name")
* .from("testTable t")
* .where()
* .andCondition("t.name", "=", "Test")
* .andCondition("t.created", ">=", someDate);
* for (ResultSet rs : sql.executeSelect(dbConnection)) {
* int id = rs.getInt(1);
* String name = rs.getString(2);
* }
*
* SqlBuilder sql = new SqlBuilder()
* .update("testTable")
* .columnUpdate("name", "Test")
* .columnUpdate("date", SOME_DATE)
* .where()
* .andCondition("id", "IN", 10, 20, 30)
* .andCondition("created BETWEEN ? AND ?", null, someDate, someDate.plusMonths(1))
* .andCondition("name", "IS NOT NULL")
* sql.executeUpdate(dbConnection);
*
* For more information see a jUnit test.
* @author Pavel Ponec
*/
public class SqlBuilder extends JdbcBuilder {
public SqlBuilder() {
}
public SqlBuilder(List sql, List