Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.pom.parent</artifactId>
<version>0.0.6</version>
<version>0.0.7</version>
</parent>
<artifactId>org.eclipse.daanse.sql</artifactId>
<version>${revision}</version>
Expand Down Expand Up @@ -81,5 +81,6 @@
<modules>
<module>guard</module>
<module>deparser</module>
<module>statement</module>
</modules>
</project>
37 changes: 37 additions & 0 deletions statement/api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!--
/*********************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.sql.statement</artifactId>
<version>${revision}</version>
</parent>
<artifactId>org.eclipse.daanse.sql.statement.api</artifactId>
<name>Daanse SQL Query Builder API</name>
<description>Immutable query model, fluent assembler and renderer contract for
the
dialect-agnostic SQL query builder. Depends on the dialect API only for the
shared
value types (Datatype, BestFitColumnType); contains no dialect behaviour.</description>

<dependencies>
<dependency>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.jdbc.db.dialect.api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2026 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* SmartCity Jena - initial
* Stefan Bischof (bipolis.org) - initial
*/
package org.eclipse.daanse.sql.statement.api;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.eclipse.daanse.jdbc.db.api.schema.TableReference;
import org.eclipse.daanse.sql.statement.api.expression.Predicate;
import org.eclipse.daanse.sql.statement.api.model.DeleteStatement;

/** Mutable, dialect-free builder for a {@link DeleteStatement}. */
public final class DeleteStatementBuilder {

private TableReference table;
private final List<Predicate> filters = new ArrayList<>();
private String footerComment;

private DeleteStatementBuilder() {
}

public static DeleteStatementBuilder create() {
return new DeleteStatementBuilder();
}

public DeleteStatementBuilder from(String table) {
this.table = new TableReference(table);
return this;
}

public DeleteStatementBuilder from(String schema, String table) {
this.table = From.tableRef(schema, table);
return this;
}

public DeleteStatementBuilder from(TableReference table) {
this.table = table;
return this;
}

public DeleteStatementBuilder where(Predicate predicate) {
filters.add(predicate);
return this;
}

/**
* Sets an optional trailing explanatory comment, appended at the very end
* (emitted only when comments are on).
*/
public DeleteStatementBuilder footerComment(String comment) {
this.footerComment = comment;
return this;
}

public DeleteStatement build() {
return new DeleteStatement(Objects.requireNonNull(table, "table"), List.copyOf(filters),
java.util.Optional.ofNullable(footerComment));
}
}
Loading
Loading