Class SelectSqlGenerator

java.lang.Object
org.litebridge.db.spi.impl.sql.AbstractSqlGenerator
org.litebridge.db.spi.impl.sql.SelectSqlGenerator

public class SelectSqlGenerator extends AbstractSqlGenerator
SQL generator for SELECT statements.
  • Constructor Details

  • Method Details

    • prepareSql

      public PreparedSql prepareSql(Select select, ConnectionProvider connectionProvider)
      Prepares a SQL SELECT statement along with its bind values for execution.
      Parameters:
      select - the select operation
      connectionProvider - the connection provider
      Returns:
      a PreparedSql object containing the generated SQL query string and the list of bind values
    • prepareSql

      public PreparedSql prepareSql(Select select, ConnectionProvider connectionProvider, @Nullable Operation parentOperation)
      Prepares a SQL SELECT statement along with its bind values for execution.
      Parameters:
      select - the select operation
      connectionProvider - the connection provider
      parentOperation - the parent operation, if any
      Returns:
      a PreparedSql object containing the generated SQL query string and the list of bind values
    • createJoin

      protected PreparedSql createJoin(Join join, Select operation, ConnectionProvider connectionProvider)
      Create a SQL JOIN clause based on the provided Join object.

      The join clause is constructed by specifying the target table, optional schema, and any associated conditions for the join operation. Conditional logic is applied to determine the join type (e.g., ON or USING) and format the resulting SQL string.

      Parameters:
      join - the Join object containing the target table information and the list of conditions defining the join relationship
      operation - the select operation
      connectionProvider - the connection provider
      Returns:
      Prepared SQL join clause
    • appendLimitClause

      protected void appendLimitClause(Limit limit, StringBuilder sql)
      Appends a LIMIT clause to the SQL.
      Parameters:
      limit - the limit
      sql - the SQL string builder