Results 1 to 5 of 5

Thread: DUF 2.1.1: UtilTableOpen error when creating relationship

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    862

    Default DUF 2.1.1: UtilTableOpen error when creating relationship

    Hello,

    I am using embedded database and DF 19.0 in this test project.
    I have created two tables and a relationship between them, which is not working. All the changes are done, except the relationship.
    When I try to update the structure at "production" I get this error:

    Code:
    [Err No:] [pnVersionNumber:] [Status Text:]
        4105                  2 [ErrLine: 93125]    (Table.Field: 2.3)
    Error trigers at cDbUpdateFunctionLibrary.pkg, function UtilTableOpen

    Code:
        Function UtilTableOpen Integer hTable String sTableName Integer iMode Returns Boolean
            String sDriverID sConnection sSchema sExt sTableNameShort sTableNameOrg
            Boolean bOpen bMertechDriver bOK
            tSQLConnection SQLConnection
    
            Move sTableName to sTableNameOrg
            If (hTable > 0) Begin
                Send Ignore_Error of Error_Object_Id 20529
                Send Ignore_Error of Error_Object_Id DFERR_CANT_OPEN_DATA_FILE
                Send Ignore_Error of Error_Object_Id CLIERR_CONNECTIONIDNOTFOUND
                Open hTable Mode iMode
                Send Trap_Error of Error_Object_Id 20529
                Send Trap_Error of Error_Object_Id DFERR_CANT_OPEN_DATA_FILE
                Send Trap_Error of Error_Object_Id CLIERR_CONNECTIONIDNOTFOUND
                Get_Attribute DF_FILE_OPENED of hTable to bOpen
                If (bOpen = True) Begin
                    Function_Return True
                End
            End
    
            Get UtilTableOpenAsIntFile hTable sTableName iMode to bOK
            Get_Attribute DF_FILE_OPENED of hTable to bOpen
    
            Function_Return bOpen
        End_Function
    I have attached a test program.
    You have to change the library path and then compile.
    I am using DUF 2.1.1 and I have overwrite it with the AppSrc folder that Nils sent me back in day, plus the pkg that sent me through mail.

    Regards.
    Attached Files Attached Files
    We are always in a continuous learning mode, and the more we know, the more we realise that we don't know anything.

  2. #2
    Join Date
    Feb 2009
    Location
    Goteborg, Sweden
    Posts
    3,189

    Default Re: DUF 2.1.1: UtilTableOpen error when creating relationship

    Thank you Jose. That was indeed a bug.

    It happened because the ApiTableRelate function was calling the UtilTableOpen function with a hTable = 0, and that didn't work to well

    I have send Jose a fixed (well, hopefully) cDbUpdateFunctionLibrary.pkg privately.

    So Jose; please report back here if it now works as it should.
    Nils Svedmyr
    RDC Tools International
    www.rdctools.com

    "The problem with internet quotes is that you don't know if they are true."
    Abraham Lincoln

  3. #3
    Join Date
    Feb 2009
    Posts
    862

    Default Re: DUF 2.1.1: UtilTableOpen error when creating relationship

    Hello Nils,

    It is not working.
    Error has gone away, but relationship is not created.

    But... I have changed one parameter in a function call in order to have it working

    Code:
        Function ApiTableRelate Handle hTableFrom Handle hTableTo Integer iColumnFrom Integer iColumnTo Returns Boolean
            Handle hTable
            Boolean bOK bExists
            String sDriverID
    
            Get UtilTableExists hTableFrom to bOK
            If (bOK = False) Begin
                Set Private.phCurrentTable to hTableFrom
                Error DFERR_PROGRAM "Table exists in Filelist.cfg but not on disk or SQL back-end."
                Function_Return False
            End
    
            Get UtilTableExists hTableTo to bOK
            If (bOK = False) Begin
                Set Private.phCurrentTable to hTableTo
                Error DFERR_PROGRAM "Table exists in Filelist.cfg but not on disk or SQL back-end."
                Function_Return False
            End
    
            Get AutoConnectionIDLogin to bOK
            Get UtilTableOpen hTableFrom "" DF_EXCLUSIVE to bOK // It seems to be hTableFrom, not hTable
            If (bOK = False) Begin
                Function_Return False
            End
    
            Move False to Err
            Open hTableTo
    
            Move hTableFrom to hTable
            Get_Attribute DF_FILE_DRIVER of hTable to sDriverID
            Set Private.phCurrentTable to hTable
    
            Structure_Start hTable sDriverID
                Set_Attribute DF_FIELD_RELATED_FILE of hTable iColumnFrom to hTableTo
                If (iColumnTo <> 0) Begin
                    Set_Attribute DF_FIELD_RELATED_FIELD of hTable iColumnFrom to iColumnTo
                End
                Set Action_Text of ghoStatusPanel to "Restructures table..."
            Structure_End hTable DF_STRUCTEND_OPT_NONE "." ghoDbUpdateHandler
            Set Action_Text of ghoStatusPanel to ""
    
            If (hTableTo > 0) Begin
                Close hTableTo
            End
    
            Function_Return (Err = False)
        End_Function
    Regards.
    We are always in a continuous learning mode, and the more we know, the more we realise that we don't know anything.

  4. #4
    Join Date
    Feb 2009
    Location
    Goteborg, Sweden
    Posts
    3,189

    Default Re: DUF 2.1.1: UtilTableOpen error when creating relationship

    Hi Jose,

    OK, I have just double-checked this and you are correct. What you suggest is the exact change that is needed to fix the bug. Thank you for reporting and for providing a solution!

    The source for DUF has now been updated accordingly.
    Nils Svedmyr
    RDC Tools International
    www.rdctools.com

    "The problem with internet quotes is that you don't know if they are true."
    Abraham Lincoln

  5. #5
    Join Date
    Feb 2009
    Posts
    862

    Default Re: DUF 2.1.1: UtilTableOpen error when creating relationship

    We are always in a continuous learning mode, and the more we know, the more we realise that we don't know anything.

Posting Permissions

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