Class SQLAdapter

  • All Implemented Interfaces:
    AdapterInterface, java.io.Serializable

    public abstract class SQLAdapter
    extends SimpleSQLAdapter
    Abstract adapter dedicated to SQL query input streams.
    The only method to implement is the single line level processRow() method.
    The SQL query is provided as the input stream.
    This class (and its child classes) cannot be instanciated.
    They correspond to an Adapter configuration item.
    See Also:
    Serialized Form
    • Constructor Detail

      • SQLAdapter

        public SQLAdapter()
    • Method Detail

      • getSQL

        public final java.lang.String getSQL()

        Get SQL query

      • setSQL

        public final void setSQL​(java.lang.String sql)

        Set SQL query

      • process

        public void process()
                     throws java.lang.InterruptedException

        Executes each SQL (or the single one set by setSQL) query and iterates on results
        Each result line is passed to the processLine() method for processing

        Specified by:
        process in interface AdapterInterface
        Overrides:
        process in class SimpleSQLAdapter
        Throws:
        java.lang.InterruptedException
      • processSelect

        public final java.lang.String processSelect​(java.lang.String sql,
                                                    java.util.List<java.lang.String[]> rows)
                                             throws PlatformException,
                                                    java.lang.InterruptedException
        Iterates on select results and calls processHead and processRow
        Specified by:
        processSelect in class SimpleSQLAdapter
        Parameters:
        sql - SQL statement
        rows - Result rows (including headers)
        Throws:
        PlatformException
        java.lang.InterruptedException
      • processHead

        public java.lang.String processHead​(java.lang.String[] head)
                                     throws PlatformException

        Select result header processing. Does nothing by default, can be overriden if required

        Parameters:
        head - Result header
        Returns:
        Processed header as Simplicite XML statements or null
        Throws:
        PlatformException
      • processRow

        public abstract java.lang.String processRow​(long rowNumber,
                                                    java.lang.String[] row)
                                             throws PlatformException,
                                                    java.lang.InterruptedException

        Select result row processing to implement

        Parameters:
        rowNumber - Input row number (1 is the first line)
        row - Input row values
        Returns:
        Processed row as Simplicite XML statements or null
        Throws:
        PlatformException
        java.lang.InterruptedException
      • processUpdate

        public java.lang.String processUpdate​(java.lang.String sql,
                                              int result)
                                       throws PlatformException

        Update result processing. Does nothing by default, can be overriden if required

        Specified by:
        processUpdate in class SimpleSQLAdapter
        Parameters:
        sql - SQL statement
        result - Result
        Throws:
        PlatformException