When an application has been ported from Btrieve to a SQL backend and the Btrieve access dll (w3btrv7 or wbtrv32) has been replaced, the application does not have any indication the backend has changed. Perhaps you would like the application to verify which backend is in use or you want to be sure the correct version of the Mertech driver is installed. This can be done through a standard BTRV function call using B_EXTENDED_VERSION (5026) defined in mds_btrieve.h provided with our driver SDK.
B_EXTENDED_VERSION is fully documented in the SDK docs but we’ll give an overview here and some sample code. Two main sub-functions are provided – the Mertech driver version and the SQL server version.
BTI_ULONG dataLen;
BTI_SINT stat;
B_VERSION_T verData[3]; memset(&verData[0], 0, sizeof(verData));
stat = BTRCALL(B_VERSION, NULL, &verData, &(dataLen=sizeof(verData)), NULL, 0, 0);
if (stat == B_NO_ERROR)
printBVersion(verData, dataLen);
else
cerr << "Error loading Btrieve dll" << endl;
MDS_VERSIONINFO mdsVersionInfo;
stat = BTRCALL(B_EXTENDED_VERSION, NULL, &mdsVersionInfo, &(dataLen=sizeof(mdsVersionInfo)), NULL, 0, MDS_VERSION_OF_DRIVER);
if (stat == B_NO_ERROR)
cout << "Mertech driver version for " << mdsVersionInfo.originalDllName << ": " << mdsVersionInfo.versionString << endl;
else
cerr << "Status " << stat << " returned from B_EXTENDED_VERSION" << endl;
MDS_SQL_LOGIN loginInfo = {"", "", "", "", ""};
stat = BTRCALL(B_SQL_LOGIN, NULL, &loginInfo, &(dataLen=sizeof(loginInfo)), NULL, 0, 0);
if (stat == B_NO_ERROR)
{
char sqlVersionString[2000];
stat = BTRCALL(B_EXTENDED_VERSION, NULL, &sqlVersionString, &(dataLen=sizeof(sqlVersionString)), NULL, 0, MDS_VERSION_OF_SERVER);
if (stat == B_NO_ERROR)
cout << "Server version: " << sqlVersionString << endl;
else
cerr << "Status " << stat << " returned from B_EXTENDED_VERSION" << endl;
}