Class ResultSetTranslatorImp

    • Constructor Detail

      • ResultSetTranslatorImp

        protected ResultSetTranslatorImp()
    • Method Detail

      • translate

        public final void translate​(JdbcResult source,
                                    AdaptrisMessage target)
                             throws java.sql.SQLException,
                                    ServiceException
        Description copied from interface: ResultSetTranslator
        Translate the contents of the result set into the AdaptrisMessage object. Only use this method for JdbcResults that are guaranteed to fit in memory.
        Parameters:
        source - the result set from a database query executed by JdbcDataQueryService
        target - the adaptris message
        Throws:
        java.sql.SQLException - on errors accessing the result set.
        ServiceException - wrapping any other exception
      • toString

        protected java.lang.String toString​(JdbcResultRow rs,
                                            int column)
      • logColumnErrors

        protected void logColumnErrors​(int column,
                                       java.lang.Exception e)
      • updateMetadataQueryCount

        protected void updateMetadataQueryCount​(AdaptrisMessage message,
                                                long numResults)
      • updateMetadata

        protected void updateMetadata​(AdaptrisMessage message,
                                      long numResults,
                                      java.lang.String metadataItemName)
      • getDisplayColumnErrors

        public java.lang.Boolean getDisplayColumnErrors()
        Returns:
        whether to log errors caused by problem data
      • setDisplayColumnErrors

        public void setDisplayColumnErrors​(java.lang.Boolean b)
        Sets whether to log any errors encountered when retrieving fields from the database.

        As an example, some databases use "0000-00-00" instead of a null date. This will cause an exception when attempting to retrieve the date using JDBC. We ignore the exception and simply produce an empty element; setting this flag causes the exception to be logged (handy during testing)

        Parameters:
        b -
      • isDisplayColumnErrors

        protected boolean isDisplayColumnErrors()
      • getColumnTranslators

        public java.util.List<ColumnTranslator> getColumnTranslators()
      • setColumnTranslators

        public void setColumnTranslators​(java.util.List<ColumnTranslator> list)
        Set the list of column translators that will be used and applied against each column in the result set.

        If this list is not empty then each translator in the list will be used to translate the corresponding column in the result set. If the list is empty then each column in the result set will be treated as either a byte[] or String column which may lead to undefined behaviour in the event of columns being CLOB / NCLOB / BLOB types.

        Parameters:
        list - default is empty.
      • addColumnTranslator

        public void addColumnTranslator​(ColumnTranslator ct)
      • getResultCountMetadataItem

        public java.lang.String getResultCountMetadataItem()
      • setResultCountMetadataItem

        public void setResultCountMetadataItem​(java.lang.String s)
        Add the number of resultsets to metadata.
        Parameters:
        s - the metadata to add the value against; default is null (no output)
      • getUpdateCountMetadataItem

        public java.lang.String getUpdateCountMetadataItem()
      • setUpdateCountMetadataItem

        public void setUpdateCountMetadataItem​(java.lang.String s)
        Add the number of result sets updated to metadata.
        Parameters:
        s - the metadata to add the value against; default is null (no output)
      • getAttemptAutoConvert

        public java.lang.Boolean getAttemptAutoConvert()
      • setAttemptAutoConvert

        public void setAttemptAutoConvert​(java.lang.Boolean b)
        Whether or not to attempt conversion with a ColumnTranslator rather than using a simple toString().

        Note that output may differ depending on defaults within the column translators. For instance java.sql.Timestamp#toString() differs from the default format in TimestampColumnTranslator.

        Parameters:
        b - true to attempt conversion, default is false if not specified.
      • withAttemptAutoConvert

        public <T extends ResultSetTranslatorImp> T withAttemptAutoConvert​(java.lang.Boolean b)