Class SQLBuilder

    • Constructor Summary

      Constructors 
      Constructor Description
      SQLBuilder()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract TypedStatement build​(Database db)
      Runs buildPreparedStatement and passes this object to a new instance of TypedStatement.
      java.sql.PreparedStatement buildPreparedStatement​(Database db)
      Creates a PreparedStatement object that will generate ResultSet objects for sending SQL statements to the database.
      protected java.lang.StringBuilder getSql()  
      java.sql.PreparedStatement getStatement()
      Returns the PreparedStatement object that will generate ResultSet objects for sending SQL statements to the database.
      protected SQLBuilder setStatement​(java.sql.PreparedStatement statement)  
      java.lang.String toString()
      Returns the sql statement as a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SQLBuilder

        public SQLBuilder()
    • Method Detail

      • buildPreparedStatement

        public final java.sql.PreparedStatement buildPreparedStatement​(Database db)
                                                                throws java.sql.SQLException
        Creates a PreparedStatement object that will generate ResultSet objects for sending SQL statements to the database.
        Parameters:
        db - the database to request the PreparedStatement object from
        Returns:
        a new PreparedStatement object containing the pre-compiled SQL statement
        Throws:
        java.sql.SQLException - if a database access error occurs
      • build

        public abstract TypedStatement build​(Database db)
                                      throws java.sql.SQLException
        Runs buildPreparedStatement and passes this object to a new instance of TypedStatement.
        Parameters:
        db - the database to request the PreparedStatement object from
        Returns:
        a new instance of TypedStatement
        Throws:
        java.sql.SQLException - if a database access error occurs
      • getStatement

        @Contract(pure=true)
        public final java.sql.PreparedStatement getStatement()
        Returns the PreparedStatement object that will generate ResultSet objects for sending SQL statements to the database.
        Returns:
        the PreparedStatement object, null if buildPreparedStatement has not been run
      • setStatement

        protected SQLBuilder setStatement​(java.sql.PreparedStatement statement)
      • getSql

        protected java.lang.StringBuilder getSql()
      • toString

        public java.lang.String toString()
        Returns the sql statement as a string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the sql statement as a string