java.lang.Object
io.github.projectunified.craftdatabase.client.sql.helper.Query

public final class Query extends Object
A SQL statement with its ordered parameter values
  • Method Details

    • getSql

      @Language("SQL") public String getSql()
      Get the SQL statement
      Returns:
      the SQL statement
    • getValues

      public Object[] getValues()
      Get the values for the ? placeholders, in order, empty if only the statement is built
      Returns:
      the values
    • toStatementBuilder

      public StatementBuilder toStatementBuilder(Connection connection)
      Convert this query to a statement builder
      Parameters:
      connection - the connection
      Returns:
      the statement builder
    • toStatementBuilder

      public StatementBuilder toStatementBuilder(SqlClient<?> client) throws SQLException
      Convert this query to a statement builder
      Parameters:
      client - the client
      Returns:
      the statement builder
      Throws:
      SQLException - if there is an SQL error
    • toStatementBuilderUnsafe

      public StatementBuilder toStatementBuilderUnsafe(SqlClient<?> client)
      Convert this query to a statement builder
      Parameters:
      client - the client
      Returns:
      the statement builder
      Throws:
      IllegalStateException - if there is an SQL error
    • toBatchBuilder

      public BatchBuilder toBatchBuilder(Connection connection)
      Convert this query to a batch builder, the values of this query, if any, are added as the first entry
      Parameters:
      connection - the connection
      Returns:
      the batch builder
    • toBatchBuilder

      public BatchBuilder toBatchBuilder(SqlClient<?> client) throws SQLException
      Convert this query to a batch builder, the values of this query, if any, are added as the first entry
      Parameters:
      client - the client
      Returns:
      the batch builder
      Throws:
      SQLException - if there is an SQL error
    • toBatchBuilderUnsafe

      public BatchBuilder toBatchBuilderUnsafe(SqlClient<?> client)
      Convert this query to a batch builder, the values of this query, if any, are added as the first entry
      Parameters:
      client - the client
      Returns:
      the batch builder
      Throws:
      IllegalStateException - if there is an SQL error
    • toString

      public String toString()
      Overrides:
      toString in class Object