Class SqlFileSelectQuery

All Implemented Interfaces:
Query, SelectQuery

public class SqlFileSelectQuery extends AbstractSelectQuery
A query that selects data from a database using an external SQL file.

This class extends AbstractSelectQuery to provide functionality for executing SELECT statements defined in external SQL files. It handles SQL file loading, transformation, and execution.

  • Field Details

    • sqlFilePath

      protected String sqlFilePath
      The path to the SQL file.
    • sqlFile

      protected SqlFile sqlFile
      The SQL file containing the SELECT statement.
  • Constructor Details

    • SqlFileSelectQuery

      public SqlFileSelectQuery()
  • Method Details

    • prepare

      public void prepare()
      Prepares this query for execution. This method must be called before the query is executed.

      This implementation prepares options and SQL.

      Specified by:
      prepare in interface Query
      Overrides:
      prepare in class AbstractSelectQuery
    • prepareSql

      protected void prepareSql()
      Prepares the SQL for this query.

      This method loads the SQL file, transforms the SQL node using the dialect, and builds the prepared SQL statement.

      Specified by:
      prepareSql in class AbstractSelectQuery
    • complete

      public void complete()
      Completes this query after execution. This method must be called after the query is executed.
    • setSqlFilePath

      public void setSqlFilePath(String sqlFilePath)
      Sets the path to the SQL file.
      Parameters:
      sqlFilePath - the SQL file path