Class DbPreparedStatement

  • All Implemented Interfaces:
    de.uplanet.lucy.server.util.db.IDbPreparedStatement, de.uplanet.util.ICloseable, AutoCloseable

    public final class DbPreparedStatement
    extends Object
    implements de.uplanet.lucy.server.util.db.IDbPreparedStatement
    • Method Detail

      • getFetchSize

        public int getFetchSize()
                         throws SQLException
        Specified by:
        getFetchSize in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setFetchSize

        public void setFetchSize​(int p_iFetchSize)
                          throws SQLException
        Specified by:
        setFetchSize in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • execute

        public void execute()
                     throws SQLException
        Specified by:
        execute in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • executeUpdate

        public int executeUpdate()
                          throws SQLException
        Specified by:
        executeUpdate in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • executeQuery

        public DbResultSet executeQuery()
                                 throws SQLException
        Specified by:
        executeQuery in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • executeAndGetScalarValueHolder

        public IValueHolder<?> executeAndGetScalarValueHolder()
                                                       throws SQLException
        Get the value of the first column in the first row of the result set.

        If the result set is empty, null is returned.

        Specified by:
        executeAndGetScalarValueHolder in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Returns:
        A value holder that contains the value of the first column in the first row of the result set, or null if the result set is empty.
        Throws:
        SQLException
      • executeAndGetScalarValue

        public Object executeAndGetScalarValue​(Object p_valueFallback)
                                        throws SQLException
        Get the value of the first column in the first row of the result set.

        If the result set is empty, or the value is null, p_valueIfNull is returned.

        Specified by:
        executeAndGetScalarValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Parameters:
        p_valueFallback - The return value if the query returns an empty result set or null.
        Returns:
        The value of the first column in the first row of the result set, or p_valueIfNull if the result set is empty, or the value is null.
        Throws:
        SQLException
      • executeAndGetScalarValue

        public Object executeAndGetScalarValue()
                                        throws SQLException
        Get the value of the first column in the first row of the result set.

        If the result set is empty, null is returned.

        Specified by:
        executeAndGetScalarValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Returns:
        The value of the first column in the first row of the result set, or null if the result set is empty.
        Throws:
        SQLException
      • executeAndGetScalarBooleanValue

        public Boolean executeAndGetScalarBooleanValue​(Object p_valueFallback)
                                                throws SQLException,
                                                       de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarBooleanValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarBooleanValue

        public Boolean executeAndGetScalarBooleanValue()
                                                throws SQLException,
                                                       de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarBooleanValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarByteValue

        public Byte executeAndGetScalarByteValue​(Object p_valueFallback)
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarByteValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarByteValue

        public Byte executeAndGetScalarByteValue()
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarByteValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarShortValue

        public Short executeAndGetScalarShortValue​(Object p_valueFallback)
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarShortValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarShortValue

        public Short executeAndGetScalarShortValue()
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarShortValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarIntValue

        public Integer executeAndGetScalarIntValue​(Object p_valueFallback)
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarIntValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarIntValue

        public Integer executeAndGetScalarIntValue()
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarIntValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarLongValue

        public Long executeAndGetScalarLongValue​(Object p_valueFallback)
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarLongValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarLongValue

        public Long executeAndGetScalarLongValue()
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarLongValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarFloatValue

        public Float executeAndGetScalarFloatValue​(Object p_valueFallback)
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarFloatValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarFloatValue

        public Float executeAndGetScalarFloatValue()
                                            throws SQLException,
                                                   de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarFloatValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarDoubleValue

        public Double executeAndGetScalarDoubleValue​(Object p_valueFallback)
                                              throws SQLException,
                                                     de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarDoubleValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarDoubleValue

        public Double executeAndGetScalarDoubleValue()
                                              throws SQLException,
                                                     de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarDoubleValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarBigDecimalValue

        public BigDecimal executeAndGetScalarBigDecimalValue​(Object p_valueFallback)
                                                      throws SQLException,
                                                             de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarBigDecimalValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarBigDecimalValue

        public BigDecimal executeAndGetScalarBigDecimalValue()
                                                      throws SQLException,
                                                             de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarBigDecimalValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarStringValue

        public String executeAndGetScalarStringValue​(Object p_valueFallback)
                                              throws SQLException,
                                                     de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarStringValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarStringValue

        public String executeAndGetScalarStringValue()
                                              throws SQLException,
                                                     de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarStringValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarTimestampValue

        public Timestamp executeAndGetScalarTimestampValue​(Object p_valueFallback)
                                                    throws SQLException,
                                                           de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarTimestampValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarTimestampValue

        public Timestamp executeAndGetScalarTimestampValue()
                                                    throws SQLException,
                                                           de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarTimestampValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarDateValue

        public Date executeAndGetScalarDateValue​(Object p_valueFallback)
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarDateValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarDateValue

        public Date executeAndGetScalarDateValue()
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarDateValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarTimeValue

        public Date executeAndGetScalarTimeValue​(Object p_valueFallback)
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarTimeValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • executeAndGetScalarTimeValue

        public Date executeAndGetScalarTimeValue()
                                          throws SQLException,
                                                 de.uplanet.lucy.server.util.db.ValueCastException
        Specified by:
        executeAndGetScalarTimeValue in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
        de.uplanet.lucy.server.util.db.ValueCastException
      • setBoolean

        public void setBoolean​(int p_iIdx,
                               Object p_value)
                        throws SQLException
        Specified by:
        setBoolean in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setInt

        public void setInt​(int p_iIdx,
                           Object p_value)
                    throws SQLException
        Specified by:
        setInt in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setLong

        public void setLong​(int p_iIdx,
                            Object p_value)
                     throws SQLException
        Specified by:
        setLong in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setShort

        public void setShort​(int p_iIdx,
                             Object p_value)
                      throws SQLException
        Specified by:
        setShort in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setByte

        public void setByte​(int p_iIdx,
                            Object p_value)
                     throws SQLException
        Specified by:
        setByte in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setBigDecimal

        public void setBigDecimal​(int p_iIdx,
                                  Object p_value)
                           throws SQLException
        Specified by:
        setBigDecimal in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setFloat

        public void setFloat​(int p_iIdx,
                             Object p_value)
                      throws SQLException
        Specified by:
        setFloat in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setDouble

        public void setDouble​(int p_iIdx,
                              Object p_value)
                       throws SQLException
        Specified by:
        setDouble in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTimestamp

        public void setTimestamp​(int p_iIdx,
                                 Object p_value)
                          throws SQLException
        Specified by:
        setTimestamp in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTimestamp

        public void setTimestamp​(int p_iIdx,
                                 Object p_value,
                                 TimeZone p_tz)
                          throws SQLException
        Specified by:
        setTimestamp in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTimestamp

        public void setTimestamp​(int p_iIdx,
                                 Object p_value,
                                 Calendar p_cal)
                          throws SQLException
        Specified by:
        setTimestamp in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTime

        public void setTime​(int p_iIdx,
                            Object p_value)
                     throws SQLException
        Specified by:
        setTime in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTime

        public void setTime​(int p_iIdx,
                            Object p_value,
                            TimeZone p_tz)
                     throws SQLException
        Specified by:
        setTime in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setTime

        public void setTime​(int p_iIdx,
                            Object p_value,
                            Calendar p_cal)
                     throws SQLException
        Specified by:
        setTime in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setDate

        public void setDate​(int p_iIdx,
                            Object p_value)
                     throws SQLException
        Specified by:
        setDate in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setDate

        public void setDate​(int p_iIdx,
                            Object p_value,
                            TimeZone p_tz)
                     throws SQLException
        Specified by:
        setDate in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setDate

        public void setDate​(int p_iIdx,
                            Object p_value,
                            Calendar p_cal)
                     throws SQLException
        Specified by:
        setDate in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • setString

        public void setString​(int p_iIdx,
                              Object p_value)
                       throws SQLException
        Specified by:
        setString in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException
      • close

        public void close()
                   throws SQLException
        Close this statement.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface de.uplanet.lucy.server.util.db.IDbPreparedStatement
        Throws:
        SQLException - If a database error occurred.