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