Getting the primary key index name.

Hi all again,

    I'm trying to get the name of the primary key index for a Sybase
Anywere 5.5 database table, I use the folowing function, but I don't
think this would work with other databases and since I'm building some
custom database components, I want them to be as standard as possible.
Does anyone know how to properly get the name of the primary key index?.
It is supposed to be indicated as an option in the Items property, but
this didn't work; at least not with Sybase. Thanks in advance.

FUNCTION TRQuery.GetKeyIndex:string;
VAR
    TmpTbl: TTable;
    cont: longint;
    curr : string;
BEGIN

  // Crea un objeto ttable que permita acceder a datos sobre los indices

  TmpTbl:=TTable.Create(Self);
  TmpTbl.DatabaseName:=DatabaseName;
  TmpTbl.TableName:=table;

  // Busca un indice que contenga en el nombre la palabra primary con
esperanza de que sea
  // caracterstico de indice de clave primaria en todos los motores de
DB.
  curr := '';
  TmpTbl.IndexDefs.Update;    // Si no se llama, no se tiene informacin
sobre los ndices
  for cont:= 0 to TmpTbl.IndexDefs.Count-1 do
  begin
       IF
(Pos('PRIMARY',UpperCase(TmpTbl.IndexDefs.Items[cont].name))<>0) then
       begin
          curr := TmpTbl.IndexDefs.Items[cont].fields;
          break;
       end;
  end;

  // Si no llegara a encontrar el ndice, da aviso.
  IF (curr='') THEN
     Raise TError.Create('No se ha encontrado un indice de clave
primaria para la tabla '+table);

  GetKeyIndex := curr;

END;