Class ResultProducers

    • Field Detail

      • allowNoResults

        private boolean allowNoResults
    • Constructor Detail

      • ResultProducers

        public ResultProducers()
    • Method Detail

      • returningUpdateCount

        public static ResultProducer<java.lang.Integer> returningUpdateCount()
        Result producer that eagerly executes the statement, returning the update count
        Returns:
        update count
        See Also:
        Statement.getUpdateCount()
      • returningResults

        public static ResultProducer<ResultBearing> returningResults()
        Result producer that returns a ResultBearing over the statement result rows.
        Returns:
        ResultBearing of result rows.
        See Also:
        Statement.getResultSet()
      • returningGeneratedKeys

        public static ResultProducer<ResultBearing> returningGeneratedKeys​(java.lang.String... generatedKeyColumnNames)
        Result producer that returns a ResultBearing over the statement-generated keys.
        Parameters:
        generatedKeyColumnNames - optional list of generated key column names.
        Returns:
        ResultBearing of generated keys
        See Also:
        Statement.getGeneratedKeys()
      • createResultBearing

        public static ResultBearing createResultBearing​(java.util.function.Supplier<java.sql.PreparedStatement> preparedStatementSupplier,
                                                        ResultProducers.ResultSetCreator resultSetCreator,
                                                        StatementContext ctx)
        Create a ResultBearing instance backed by a ResultSet. This method can be used to create other ResultProducer instances that manage a ResultBearing instance.
        Parameters:
        preparedStatementSupplier - Provides the PreparedStatement to obtain the ResultSet.
        resultSetCreator - Creates a ResultSet from a Statement.
        ctx - The statement context.
        Returns:
        An instance of ResultBearing that is backed by the ResultSet.
      • createCopy

        public ResultProducers createCopy()
        Description copied from interface: JdbiConfig
        Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.
        Specified by:
        createCopy in interface JdbiConfig<ResultProducers>
        Returns:
        a copy of this configuration object.
      • allowNoResults

        public ResultProducers allowNoResults​(boolean allowNoResults)
        Normally a query that doesn't return a result set throws an exception. With this option, we will replace it with an empty result set instead.
        Parameters:
        allowNoResults - True if an empty ResultSet object should be returned, false if a NoResultsException should be thrown.
        Returns:
        this