rmAlias.cc  
 

A Custom Control for working with a BDE Alias

 


The above image is of the sample test and demo form for the rmAlias.cc control.

The rmAlias control has its roots in the dUFLP files BDEAlias.cc and BDEAliasEx.cc. Sweeping changes have been made however, with a mixture of bug fixes, modifications and additions to existing functions, and completely new added functionality, such that this is now a separate class in its own right.

The intended basic use of this control is to allow your application to check for the existence of an Alias, check that the Alias can successfully connect to your data, and if not, can delete a non connecting Alias and create a new one. This control does not provide a fixed sequence of tasks to achieve this end result, but rather a suite of functions which allow the rapid development of your own application logic to achieve any Alias related task such as this that you may desire.

The functions are intuitively named, and are as follows :

  • CreateAccessAlias
  • CreateAlias
  • CreateAliasPath
  • CreateDbaseAlias
  • CreateMSSQLAlias
  • DeleteAlias
  • DoesAliasConnect
  • DoesAliasExist
  • DoesTableExist
  • GetAliasHelpText
  • GetAliasList
  • GetAliasPath
  • GetBDEConfigFileName
  • GetComputerName
  • GetDatabaseType
  • GetLocalShare
  • GetProceduresList
  • GetTableList
  • GetViewsList
  • IsUserAdmin
  • RestartBDE

In order to use the DoesAliasConnect function, a table name in the database needs to be supplied. A logon name and password need to be supplied for any database which requires this. In addition, in order to prevent problems testing the connection to a database table which contains fields of a type not accessible by the BDE or dBASE without "casting", the name of a suitable field in the table needs to be supplied. There are entryfields on the supplied test form to demonstrate this, as in the following image.

Note that deleting an Alias for an ODBC connection will successfully delete the BDE Alias, and this will be correctly reported by DoesAliasExist and DoesAliasConnect, however the underlying ODBC connection remains untouched, and assuming that the BDE "Auto ODBC" is set to true, a RestartBDE will see the deleted Alias reappear fully operational.

ODBC connections can be managed using the rmODBC.cc control.

The demo form only surfaces a subset of this controls capabilities, and further information can be gleaned by examining the comments in the code of rmAlias.cc.

See rmAliasTest.wfm for basic sample usage and sample code.