Results 1 to 3 of 3

Thread: DatabaseMainType (DR7.0) and DatabaseType (DR6.2) and how it's used

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2016
    Location
    New Zealand
    Posts
    275

    Question DatabaseMainType (DR7.0) and DatabaseType (DR6.2) and how it's used

    Hi DAW,

    We're currently on DR6.2 version. I'm trying to use the ReportUsesODBC function on an ODBC report but the function returns false. I was doing some debugging and after tracing it down, the function ReportUsesODBC gets the DatabaseType then evaluates the Database type based on the Hi() value of the return value. This is different in DR7.0 as it uses the DatabaseMainType (which returns the Low() value).

    Could you explain how I could use the ReportUsesODBC and also ReportQuery with this in mind?

    See highlighted lines in RED for point of interest

    DR7 Code

    Code:
        Function DatabaseMainType String sReportId Returns C_DRDatabaseTypes
            Integer eDatabaseType eDatabaseMainType
            Boolean bComObjectCreated
    
    
            Send RedirectErrorsToLocalHandler True
    
    
            If (sReportId = C_USEMAINDRREPORTID) Begin
                Get psReportId to sReportId
            End
    
    
            If (sReportId <> "") Begin
                Get IsComObjectCreated to bComObjectCreated
                If (bComObjectCreated) Begin
                    Get ComDatabaseType sReportId to eDatabaseType
                    Move (Low (eDatabaseType)) to eDatabaseMainType
                End
                Else Begin
                    Error DFERR_DATAFLEX_REPORTS (Sformat (C_$DRReportOCXNotInitialised, Name (Self)))
                End
            End
            Else Begin
                Error DFERR_DATAFLEX_REPORTS C_$DRNoReportIdSpecified
            End
    
    
            Send RedirectErrorsToLocalHandler False
    
    
            Function_Return eDatabaseMainType
        End_Function
    
    
        Function ReportUsesODBC String sReportId Returns Boolean
            Integer eDatabaseMainType iSubReports iSubReport
            String sSubReportId
            Boolean bODBCBasedReport
    
    
            Get DatabaseMainType sReportId to eDatabaseMainType
            If (eDatabaseMainType = C_DRODBC) Begin
                Move True to bODBCBasedReport
            End
            Else Begin
                Get SubReportCount sReportId to iSubReports
                Decrement iSubReports
                For iSubReport from 0 to iSubReports
                    Get SubReportId sReportId iSubReport to sSubReportId
                    Get ReportUsesODBC sSubReportId to bODBCBasedReport
                    If (bODBCBasedReport) ;
                        Break
                Loop
            End
    
    
            Function_Return bODBCBasedReport
        End_Function

    DR6.2 Code

    Code:
        Function DatabaseType String sReportId Returns C_DRDatabaseTypes        Integer eDatabaseType
            Boolean bComObjectCreated
    
    
            Send RedirectErrorsToLocalHandler True
    
    
            If (sReportId = C_USEMAINDRREPORTID) Begin
                Get psReportId to sReportId
            End
    
    
            If (sReportId <> "") Begin
                Get IsComObjectCreated to bComObjectCreated
                If (bComObjectCreated) Begin
                    Get ComDatabaseType sReportId to eDatabaseType
                End
                Else Begin
                    Error DFERR_DATAFLEX_REPORTS (Sformat (C_$DRReportOCXNotInitialised, Name (Self)))
                End
            End
            Else Begin
                Error DFERR_DATAFLEX_REPORTS C_$DRNoReportIdSpecified
            End
    
    
            Send RedirectErrorsToLocalHandler False
    
    
            Function_Return eDatabaseType
        End_Function
    
    
        Function ReportUsesODBC String sReportId Returns Boolean
            Integer eDatabaseType iSubReports iSubReport
            String sSubReportId
            Boolean bODBCBasedReport
    
    
            Get DatabaseType sReportId to eDatabaseType
            If (Hi (eDatabaseType) = C_DRODBC) Begin
                Move True to bODBCBasedReport
            End
            Else Begin
                Get SubReportCount sReportId to iSubReports
                Decrement iSubReports
                For iSubReport from 0 to iSubReports
                    Get SubReportId sReportId iSubReport to sSubReportId
                    Get ReportUsesODBC sSubReportId to bODBCBasedReport
                    If (bODBCBasedReport) ;
                        Break
                Loop
            End
    
    
            Function_Return bODBCBasedReport
        End_Function
    In DR6.2 - the functions below gets the DatabaseType and then evaluates the Hi() value with the type constants (ie. C_DRODBC, C_DRRDS), I think this is wrong and it should be evaluated using the Low() value. This has been changed in DR7.0 by using the DatabaseMainType function instead which returns the Low() value

    - ReportQuery
    - ReportUsesODBC
    - RDSTableNames
    - ReportUsesRDS
    - ReportUsesStoredProcedures - This needs to swap the check for so it becomes " If ((Low (eDatabaseType) = C_DRODBC) and (Hi (eDatabaseType) = C_DRSP)) "
    Last edited by bluelight20; 15-Jan-2020 at 08:22 PM. Reason: Added conclusion
    Regards,
    Rol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •