Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Saber clase hija (https://www.clubdelphi.com/foros/showthread.php?t=35680)

DANY 18-09-2006 14:12:31

Saber clase hija
 
Tengo un metodo que automatiza la generacion de inserts en la clase base , leyendo las propertys de las clases hijas. El asunto es que tambien em toma las propertys de la clase base, como pregunto por si el campo pertenece a un clase determinada?, ya que uso self como parametro dado que no se cual
aca les dejo mi codigo:
Código Delphi [-]
procedure TClaseTablas.Insertar;
var
  I, CantidadProp, Count : Integer;
  PropList: PPropList ;
  ValoresCampos:  array of variant ;
  Campos, Parametros: TStrings ;
  SQL: String ;
begin
  CantidadProp := GetPropList(Self, PropList);
  Count := 0;
  Campos := TStringList.Create ;
  Parametros := TStringList.Create ;
  Campos.Add(' Insert into ( ');
  Parametros.Add(' Values ( ');
  for I := 0 to CantidadProp  -1 do
  begin
    if (PropList[i].PropType^.Kind = tkClass) then
      Continue;

//ACA DEBERIA IR ALGO COMO IF PROPLIS[i] NO ES DE LA CLASE BASE.

    if I = CantidadProp  -1  then
    Begin
      Campos.Add (PropList[i].Name+ ')');
      Parametros.Add ( ':'+ PropList[i].Name+')');
    End
    Else
    Begin
      Campos.Add ( PropList[i].Name+ ' , ') ;
      Parametros.Add (':'+PropList[i].Name+' , ');
    End;


    inc (Count) ;
    SetLength(ValoresCampos, Count);
    ValoresCampos[Count-1] := GetValorPropiedad(Self, PropList[i].Name);

  End;


  SQL := Campos + Parametros ;
  fDatos.EjecutarQuery(SQL, ValoresCampos , False );


end;
Saludos...

DANY 18-09-2006 17:10:02

Saber clase padre
 
perdon, formule mal la pregunta, la duda seria, como se que es una property de la clase base?


La franja horaria es GMT +2. Ahora son las 07:04:49.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi