Class SqlExecuteStatement

java.lang.Object
org.eclipse.edc.sql.statement.SqlExecuteStatement

public class SqlExecuteStatement extends Object
Helps in constructing SQL insert/update statements without having to deal with the SQL syntax directly
  • Constructor Details

    • SqlExecuteStatement

      public SqlExecuteStatement(String jsonCastOperator)
  • Method Details

    • newInstance

      public static SqlExecuteStatement newInstance(String jsonCastOperator)
      Create a new instance with the JSON cast operator
      Parameters:
      jsonCastOperator - the json cast operator.
      Returns:
      a new SqlExecuteStatement.
    • equalTo

      public static org.eclipse.edc.spi.query.Criterion equalTo(String columnName)
      Utility criterion to describe an equality condition in a SQL prepared statement.
      Parameters:
      columnName - the column name.
      Returns:
      the criterion.
    • isNull

      public static org.eclipse.edc.spi.query.Criterion isNull(String columnName)
      Utility criterion to describe an "is null" condition in a SQL prepared statement.
      Parameters:
      columnName - the column name.
      Returns:
      the criterion.
    • column

      public SqlExecuteStatement column(String columnName)
      Add a new standard column
      Parameters:
      columnName - the column name.
      Returns:
      the SqlExecuteStatement.
    • jsonColumn

      public SqlExecuteStatement jsonColumn(String columnName)
      Add a new json column
      Parameters:
      columnName - the column name.
      Returns:
      the SqlExecuteStatement.
    • insertInto

      public String insertInto(String tableName)
      Gives a SQL insert statement.
      Parameters:
      tableName - the table name.
      Returns:
      sql insert statement.
    • update

      public String update(String tableName, String whereColumn)
      Gives a SQL update statement.
      Parameters:
      tableName - the table name.
      whereColumn - the column that will be used for the where condition
      Returns:
      sql update statement.
    • update

      public String update(String tableName, org.eclipse.edc.spi.query.Criterion where)
      Gives a SQL update statement.
      Parameters:
      tableName - the table name.
      where - the update field criterion
      Returns:
      sql update statement.
    • delete

      public String delete(String tableName, String whereColumn)
      Gives a SQL delete statement.
      Parameters:
      tableName - the table name.
      whereColumn - the column that will be used for the where condition
      Returns:
      sql delete statement.
    • delete

      public String delete(String tableName, org.eclipse.edc.spi.query.Criterion... whereCriteria)
      Gives a SQL delete statement. The where criteria is joined with AND operator.
      Parameters:
      tableName - the table name.
      whereCriteria - the delete field condition
      Returns:
      sql delete statement.
    • upsertInto

      public String upsertInto(String tableName, String idColumn)
      Gives a SQL upsert statement based on the "ON CONFLICT" semantic
      Parameters:
      tableName - the table name.
      idColumn - the id column.
      Returns:
      sql upsert statement.