Connecting with f90SQLBrowseConnect

 

f90SQLBrowseConnect, like f90SQLDriverConnect, uses a connection string. However, by using f90SQLBrowseConnect, an application can construct a complete connection string at run time. This allows the application to do two things:

 

The application calls f90SQLBrowseConnect and passes a connection string, known as the browse request connection string, which specifies a driver or data source. The driver returns a connection string, known as the browse result connection string, which contains keywords, possible values (if the keyword accepts a discrete set of values), and user-friendly names. The application builds a dialog box with the user-friendly names and prompts the user for values. It then builds a new browse request connection string from these values and returns this to the driver with another call to f90SQLBrowseConnect.

 

Because connection strings are passed back and forth, the driver can provide several levels of browsing by returning a new connection string when the application returns the old one. For example, the first time an application calls f90SQLBrowseConnect, the driver might return keywords to prompt the user for a server name. When the application returns the server name, the driver might return keywords to prompt the user for a database. The browsing process would be complete after the application returned the database name.

 

Each time f90SQLBrowseConnect returns a new browse result connection string, it returns SQL_NEED_DATA as its return code. This tells the application that the connection process is not complete. Until f90SQLBrowseConnect returns SQL_SUCCESS, the connection is in a Need Data state and cannot be used for other purposes. The application can terminate the connection browsing process by calling f90SQLDisconnect.