feature_odbc - ODBC databases supported?

Description

feature_odbc can be used to determine if the current platform supports using ODBC to connect to databases.

Example

program Data(input, output);
var
   conn : connection;

   procedure DisplayError(msg : string);
   begin
      writeln('ERROR:',msg);
      halt
   end;

   function GetConnectionString : string;
   var
      s, sDSN, sUSER, sPassword : string;

      function GetStringValue(sPrompt : string) : string;
      var
         sValue : string;
      begin
         write(sPrompt);
         readln(sValue);
         GetStringValue := sValue
      end;

   begin
      if supported(feature_odbc) then
         begin
            sDSN := GetStringValue('Enter Data Source Name (DSN):');
            sUser := GetStringValue('Enter user id:');
            sPassword := GetStringValue('Enter password:');
            s := 'ODBC;DSN='+sDSN+';user='+sUser+';password='+sPassword;
         end
      else if supported(feature_mysql) then
         begin
            sUser := GetStringValue('Enter user id:');
            sPassword := GetStringValue('Enter password:');
            s := 'MYSQL;user="'+sUser+'";password="'+sPassword+'";socket="/tmp/mysql.sock"';
         end
      else
         DisplayError('No database support detected');
      GetConnectionString := s;
   end;

begin
   new(conn);
   conn.open(GetConnectionString);
   //
   //Add code here to process database
   //
   conn.close;
   dispose(conn);
end.

Portability

Operating Systems: All
Standard Pascal: No