Class SQLDataProvider

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,Object>
fr.opensagres.xdocreport.document.sql.SQLDataProvider
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public abstract class SQLDataProvider extends HashMap<String,Object>
XDocReport support for SQL ResultSet. The implementation of this class
  • transform a ResultSet to Map which can be used instead of IContext.
  • update the FieldsMetadata with simple and list field from the ResultSet.
See Also:
  • Constructor Details

    • SQLDataProvider

      public SQLDataProvider(ResultSet rs, fr.opensagres.xdocreport.template.formatter.FieldsMetadata metadata) throws SQLException
      SQL Data provider constructor.
      Parameters:
      rs - the SQL ResultSet
      metadata - the FieldsMetadata.
      Throws:
      SQLException
  • Method Details

    • getColumnCount

      protected int getColumnCount(ResultSet rs) throws SQLException
      Returns the column count. Override this method if your JDBC driver cannot support that.
      Parameters:
      rs -
      Returns:
      Throws:
      SQLException
    • getTableName

      protected String getTableName(ResultSet rs, int column) throws SQLException
      Returns the table name of the given column of the given ResultSet. Override this method if your JDBC driver cannot support that.
      Parameters:
      rs -
      column -
      Returns:
      Throws:
      SQLException
    • getColumnLabel

      protected String getColumnLabel(ResultSet rs, int column) throws SQLException
      Returns the column label name of the given column of the given ResultSet. Override this method if your JDBC driver cannot support that.
      Parameters:
      rs -
      column -
      Returns:
      Throws:
      SQLException
    • getListName

      protected abstract String getListName(String tableName, String columnName)
      Returns true if the given column of the given table is a field list and false otherwise.
      Parameters:
      tableName -
      columnName -
      Returns: