Marco van de Voort wrote:
In our previous episode, Sven Barth said:
=== example end ===

Alternatively if you don't need to check the hierarchy, but can live with an exact match you can do this:

=== example begin ===

procedure checkLibrariesAndConnect(db: TSQLConnection);
begin
   case LowerCase(db.ClassName) of
     // Note: .ClassName won't work here
     'TPQConnection': ...;
     'TIBConnection': ...;
   end;
end;

var typ : TCLass;

begin
  typ:=db.classtype;  found:=false;
  while not found and assigned(typ) do
    begin
       case lowercase(typ.classname)
         ..  // must set found=true on match or break.
       end;
      typ:=typ.classparent;
    end;

Thanks, detail noted.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to