Search in sources :

Example 1 with DeleteBySearchBuilder

use of org.sql.generation.api.grammar.builders.modification.DeleteBySearchBuilder in project qi4j-sdk by Qi4j.

the class AbstractSQLIndexing method createDeleteFromTableStatement.

protected DeleteStatement createDeleteFromTableStatement(String schemaName, String tableName, String columnName, SQLVendor vendor) {
    ModificationFactory m = vendor.getModificationFactory();
    BooleanFactory b = vendor.getBooleanFactory();
    LiteralFactory l = vendor.getLiteralFactory();
    ColumnsFactory c = vendor.getColumnsFactory();
    TableReferenceFactory t = vendor.getTableReferenceFactory();
    // "DELETE FROM " + "%s" + "." + "%s" + "\n" + //
    // "WHERE " + "%s" + " = ? " + "\n" + //
    // ";" //
    DeleteBySearchBuilder delete = m.deleteBySearch();
    delete.setTargetTable(m.createTargetTable(t.tableName(schemaName, tableName))).getWhere().reset(b.eq(c.colName(columnName), l.param()));
    return delete.createExpression();
}
Also used : ModificationFactory(org.sql.generation.api.grammar.factories.ModificationFactory) TableReferenceFactory(org.sql.generation.api.grammar.factories.TableReferenceFactory) DeleteBySearchBuilder(org.sql.generation.api.grammar.builders.modification.DeleteBySearchBuilder) ColumnsFactory(org.sql.generation.api.grammar.factories.ColumnsFactory) BooleanFactory(org.sql.generation.api.grammar.factories.BooleanFactory) LiteralFactory(org.sql.generation.api.grammar.factories.LiteralFactory)

Aggregations

DeleteBySearchBuilder (org.sql.generation.api.grammar.builders.modification.DeleteBySearchBuilder)1 BooleanFactory (org.sql.generation.api.grammar.factories.BooleanFactory)1 ColumnsFactory (org.sql.generation.api.grammar.factories.ColumnsFactory)1 LiteralFactory (org.sql.generation.api.grammar.factories.LiteralFactory)1 ModificationFactory (org.sql.generation.api.grammar.factories.ModificationFactory)1 TableReferenceFactory (org.sql.generation.api.grammar.factories.TableReferenceFactory)1