Results 1 to 10 of 19

Thread: Old Fashion connections - How to retrieve the back end DBNAME for a given entry in file-list ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    6,259

    Default Old Fashion connections - How to retrieve the back end DBNAME for a given entry in file-list ?

    Old project, no connectionIDs implemented, and neither Managed Connections.

    So, all new interfaces from Managed connection and cConnection class is not applicable.

    System access multiple different dbs. TableA - db1, TableB from db2, etc ...

    I am pretty sure I've done that before, but I can't remember and find the code... so again.

    How can I retrieve the backend database name , associated with a given table ? I need to build the 3 part name in a select statement [dbName].[Schema].[TableName]

    I got the schema and table name from DF_FILE_OWNER and DF_FILE_TABLE_NAME attributes (yes, df logical name is different than the real table name in backend.. ).

    But not finding how to retrieve the dbname.

    -----------------
    This code results in a critical error.. which aborts the program in 19.1

    Code:
     
    Get_Attribute DF_FILE_OWNER       of  iTable to sSchema 
    Get_Attribute DF_FILE_TABLE_NAME  of iTable to sdbTabName 
    Get_Attribute DF_DATABASE_ID      of iTable to hoDbID
    Get_Attribute DF_FILE_DRIVER      of iTable to sDriver
    Get DriverIndex                   of hoSQLMngr sDriver to iDriver
    Get_Attribute DF_DATABASE_DEFAULT_DATABASE of iDriver hoDbID to sDbName   <<-- fatal error.
    or this variant, same error:

    Code:
    Get SQLFileConnect of iTable to hoConn2 
    ... (same set of attributes as before) 
    Get_Attribute DF_DATABASE_DEFAULT_DATABASE of iDriver hoConn2 to sDbName   <<-- fatal error.
    I've noticed that the sample codes in this last attribute uses parameters coming from cConnection class. so it seems it requires that.. :-(

    So, how to get the backend database name , for a given table (that I am already connected to), in the old fashion way. reliably ?


    SideNote: The Fatal error is really not desired here. and should also be investigated . If the connectionID are not being used, and this attribute requires that.. a proper a good non-critical error should be raised instead protecting the fatal one.


    [edit] find the function that handles this on this post [/edit]

    Thanks in advance

    Regards
    Last edited by Samuel Pizarro; 16-Jan-2025 at 11:02 AM.
    Samuel Pizarro

Posting Permissions

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