Class JdbcData

    • Constructor Detail

      • JdbcData

        public JdbcData()
    • Method Detail

      • getTableSourceData

        @Nonnull
        public TableData getTableSourceData​(TableSource ts)
                                     throws ReportException
        Is called from getReportData to request the data of a single TableSource if the TableSource is not a joined table or view. So it's called for procedures, commands and single tables or views.
        Specified by:
        getTableSourceData in interface DataFactory
        Overrides:
        getTableSourceData in class BaseDataFactory
        Parameters:
        ts - The current table source
        Returns:
        The resulting data, never null.
        Throws:
        ReportException - if error occurs in the API access
      • getReportDataPerInstance

        public boolean getReportDataPerInstance()
        Override this method only if you use subreport(s) and you set the data for the report with the getReportData or DataFactory.fetchData(Engine, FetchTables, DataCollector) method. For more information please refer to the sample Main_and_Subreport_Data_WithExternalResultSet.java.
        With this method you can specify whether the engine should call getReportData per subreport instance or only once for each of the subreports in the executed report. The same subreport can execute multiple time in a report with different parameters depending on its location. A subreport instance means one execution of one subreport. The method should return true if you want to set the different report data depending on the state of the report or if you want to set data depending on one or more parameter values. If you want to set data only once per sub-report, this function must return false. For example if you have a sub-report taking one prompt p0, and getReportDataPerInstance() returns true, then your sub-report will be called $n$ times whenever the value for p0 has been changed. So if your report has sub-reports and your sub-report prompts are linked with fields of the main report and you want to set the data whenever the sub-report prompts change, let getReportDataPerInstance() return true.
        Specified by:
        getReportDataPerInstance in interface DataFactory
        Overrides:
        getReportDataPerInstance in class BaseDataFactory
        Returns:
        true if the engine should invoke getReportData for every subreport instance or false otherwise.
      • getTableSourceInfos

        @Nonnull
        public java.util.Map<java.lang.String,​TableSourceInfo> getTableSourceInfos​(Datasource ds,
                                                                                         java.lang.String catalog)
                                                                                  throws ReportException
        Returns a map of objects in the database which can return table data. It can contain tables, views, stored procedures or your own objects. Keys of the returned map are table names and values are objects of type TableSourceInfo.
        Parameters:
        ds - datasource which describes the data
        catalog - an optional catalog
        Returns:
        a map of available objects, never null
        Throws:
        ReportException - if any error occurs
      • supportsCommands

        public boolean supportsCommands()
        If this data factory supports a TableSource of type command. If true the designer show the menu item for adding commands. The default value is false. For JDBC data factories this flag is true.
        Returns:
        the flag value
      • getTables

        protected abstract java.sql.ResultSet getTables​(Datasource ds,
                                                        java.lang.String catalog)
                                                 throws java.sql.SQLException,
                                                        ReportException
        Is used from #getTableSourceInfos(Datasource, String) to find a list of tables and views.
        Parameters:
        ds - The current Datasource containing the Connection.
        catalog - The catalog/database set in login dialog of i-net Designer.
        Returns:
        A ResultSet with the structure of DatabaseMetaData.getTables()
        Throws:
        java.sql.SQLException - if a database access error occurs
        ReportException - if the creation of a Connection failed.
        Since:
        6.1
      • getProcedures

        protected abstract java.sql.ResultSet getProcedures​(Datasource ds,
                                                            java.lang.String catalog)
                                                     throws java.sql.SQLException,
                                                            ReportException
        Is used from #getTableSourceInfos(Datasource, String) to find a list of stored procedures. Returns the procedures meta data for a datasource and catalog as defined by DatabaseMetaData.getProcedures(String, String, String)
        Parameters:
        ds - the datasource to connect to (if not already connected)
        catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
        Returns:
        each row is a procedure description
        Throws:
        java.sql.SQLException - if a database access error occurs
        ReportException - if creating a Connection failed.
        Since:
        7.6
      • getProcedureColumns

        protected abstract java.sql.ResultSet getProcedureColumns​(Datasource ds,
                                                                  java.lang.String catalog,
                                                                  java.lang.String schema,
                                                                  java.lang.String procedure)
                                                           throws java.sql.SQLException,
                                                                  ReportException
        Is used from #getColumns(TableSource) if the TableSource based on a stored procedure.
        Parameters:
        ds - The Datasource containing the Connection.
        catalog - The catalog/database set in login dialog of i-net Designer.
        schema - The table owner or null.
        procedure - The procedure name.
        Returns:
        A ResultSet with the structure of DatabaseMetaData.getProcedureColumns
        Throws:
        java.sql.SQLException - This SQLException will be show in a message box in i-net Designer.
        ReportException - if the creation of a Connection failed.
        Since:
        7.6
      • getColumnName

        protected java.lang.String getColumnName​(java.lang.String colName,
                                                 java.lang.String alias,
                                                 int driverVersion,
                                                 TableSource ts,
                                                 int colIdx)
        Returns the column name dependent of the database.
        Parameters:
        colName - the column name
        alias - the column alias (required for MySQL Connector5.x only)
        driverVersion - the driver version (required for MySQL Connector5.x only)
        ts - the table source
        colIdx - the column index (required for Informix only)
        Returns:
        the name
        Since:
        15.0
      • getSourceNameWithChange

        protected abstract java.lang.String getSourceNameWithChange​(TableSource ts,
                                                                    boolean escapeEverything)
        Returns the source name like catalog.schema.table. Overwrites the catalog and schema names if these was changed in the Datasource.
        Parameters:
        ts - the table source
        escapeEverything - True if the complete sql identifier should be quoted false otherwise
        Returns:
        the name
        Since:
        15.0
      • getSqlSyntax

        public abstract com.inet.report.database.sql.SqlSyntax getSqlSyntax()
        Returns the SQL syntax definition instance for this data factory.
        Returns:
        the SQL syntax definition instance for this data factory
        Since:
        15.0