Class SqlBuilder.PreparedSqlBuilder

java.lang.Object
org.tamilnadujug.SqlBuilder
org.tamilnadujug.SqlBuilder.PreparedSqlBuilder
All Implemented Interfaces:
Sql<Integer>
Enclosing class:
SqlBuilder

public static final class SqlBuilder.PreparedSqlBuilder extends SqlBuilder
  • Method Details

    • execute

      public Integer execute(Connection connection) throws SQLException
      Executes the SQL operation using the given JDBC connection.
      Specified by:
      execute in interface Sql<Integer>
      Overrides:
      execute in class SqlBuilder
      Parameters:
      connection - JDBC connection to use for execution
      Returns:
      result of the SQL operation
      Throws:
      SQLException - if an error occurs during execution
    • paramNull

      public SqlBuilder.PreparedSqlBuilder paramNull()
      Adds a parameter with a null.
      Returns:
      the current SqlBuilder instance, for method chaining
    • paramNull

      public SqlBuilder.PreparedSqlBuilder paramNull(int sqlType, String typeName)
      Adds a parameter with a specific SQL type and type name as `NULL` to the SQL query. This method is used when the SQL parameter should be set to `NULL` for types that require a type name in addition to the SQL type, such as SQL `STRUCT` or `ARRAY`.
      Parameters:
      sqlType - the SQL type of the parameter, as defined in Types
      typeName - the type name of the parameter, used for SQL types that require specific type information
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Integer value)
      Adds a parameter to the SQL query. The method allows chaining and is used to bind values to placeholders in the SQL query.
      Parameters:
      value - the value of the parameter to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Short value)
      Adds a Short parameter to the SQL query.
      Parameters:
      value - the Short value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(String value)
      Adds a parameter to the SQL query. The method allows chaining and is used to bind values to placeholders in the SQL query.
      Parameters:
      value - the value of the parameter to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Double value)
      Adds a Double parameter to the SQL query.
      Parameters:
      value - the Double value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Boolean value)
      Adds a Boolean parameter to the SQL query.
      Parameters:
      value - the Boolean value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Long value)
      Adds a Long parameter to the SQL query.
      Parameters:
      value - the Long value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Date value)
      Adds a Date parameter to the SQL query.
      Parameters:
      value - the Date value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Float value)
      Adds a Float parameter to the SQL query.
      Parameters:
      value - the Float value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(byte[] value)
      Adds a byte array parameter to the SQL query.
      Parameters:
      value - the byte array to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      Adds a BigDecimal parameter to the SQL query.
      Parameters:
      value - the BigDecimal value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Time value)
      Adds a Time parameter to the SQL query.
      Parameters:
      value - the Time value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      Adds a Timestamp parameter to the SQL query.
      Parameters:
      value - the Timestamp value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Object value)
      Adds an Object parameter to the SQL query.
      Parameters:
      value - the Object value to be added
      Returns:
      the current SqlBuilder instance, for method chaining
    • param

      public SqlBuilder.PreparedSqlBuilder param(Object value, int targetSqlType)
      Adds an Object parameter to the SQL query with targetSqlType.
      Parameters:
      value - the Object value to be added
      targetSqlType - the targeted SqlType.
      Returns:
      the current SqlBuilder instance, for method chaining
    • exists

      protected boolean exists(Connection connection) throws SQLException
      Checks if Record Exists.
      Overrides:
      exists in class SqlBuilder
      Parameters:
      connection -
      Returns:
      exists
      Throws:
      SQLException
    • queryForOne

      public <T> Sql<T> queryForOne(RowMapper<T> query)
      Get Result for a Query.
      Overrides:
      queryForOne in class SqlBuilder
      Type Parameters:
      T -
      Parameters:
      query -
      Returns:
      result
    • queryForList

      public <T> Sql<List<T>> queryForList(RowMapper<T> query)
      Get Result as a List for a Query. Creates a new Query object that can be used to execute a SELECT query and map the result set to list of a specific object type using the provided RowMapper.
      Overrides:
      queryForList in class SqlBuilder
      Type Parameters:
      T - the type of object to map the result set to
      Parameters:
      query - an implementation of RowMapper to map each row of the result set
      Returns:
      a new Query instance for execution
    • queryGeneratedKeys

      public <T> Sql<T> queryGeneratedKeys(RowMapper<T> rowMapper)
      Get Generated Keys for a Query. Creates a new Generated Keys object that can be used to execute a SELECT query and map the result set to a specific object type using the provided RowMapper.
      Overrides:
      queryGeneratedKeys in class SqlBuilder
      Type Parameters:
      T - the type of object to map the result set to
      Parameters:
      rowMapper - an implementation of RowMapper to map each row of the result set
      Returns:
      a new Query instance for execution
    • queryGeneratedKeysAsList

      public <T> Sql<List<T>> queryGeneratedKeysAsList(RowMapper<T> rowMapper)
      Creates query to get Generated Keys As a List.
      Overrides:
      queryGeneratedKeysAsList in class SqlBuilder
      Type Parameters:
      T - the type of object to map the result set to
      Parameters:
      rowMapper - an implementation of RowMapper to map each row of the result set
      Returns:
      a new Query instance for execution
    • addBatch

      Builds JDBC Batch Builder.
      Returns:
      batch