Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Problemas con Data Packet (https://www.clubdelphi.com/foros/showthread.php?t=77411)

Paulao 23-01-2012 16:56:09

Problemas con Data Packet
 
Buenos dias, estoy con un problema asi: Mi aplicacion cria un campo en ejecucion, que llamo de campo customisable. Que pasa es que hay un limite para la cantidad de caracteres(31) y tengo un campo que necesita de 36. Luego, intente cambiar para 60 y no he logrado exito. Exist una variable del tipo TDSDataPacketFldDesc que es declarada en la UNIT DSIntf. En la UNIT Provider hay este comando para garantizar que los caracteres no lo son mas que lo permitido:
Código Delphi [-]
procedure AddFieldDesc(const FldName: string; FldType, Attributes: Integer);
  var
    FldDesc: TDSDataPacketFldDesc;
  begin
    if Length(FldName) >= SizeOf(FldDesc.szFieldName) then
      raise EDSWriter.CreateFmt(SFieldNameTooLong,[SizeOf(FldDesc.szFieldName) - 1]);
    FillChar(FldDesc, SizeOf(FldDesc), 0);
    StrLCopy(FldDesc.szFieldName, PChar(FldName), SizeOf(FldDesc.szFieldName) - 1);
    FldDesc.iFieldType := FldType;
    FldDesc.iAttributes := Attributes;
    Check(FIDSWriter.AddColumnDesc(FldDesc));
  end;
Pero en UNIT DSIntf hay esto:

Código Delphi [-]
MIDASNAME            = packed array [0..31] of Char; { holds a name }
Código Delphi [-]
type
  TPcktAttrArea = (fldAttrArea, pcktAttrArea);
  TPcktFldStatus = (fldIsChanged, fldIsNull, fldIsUnChanged);

  PDSDataPacketFldDesc = ^TDSDataPacketFldDesc;
  TDSDataPacketFldDesc = packed record
    szFieldName: MIDASNAME;           { Column Name }
    iFieldType: Integer;            { Column Type }
    iAttributes: Word;              { Column attributes }
  end;
Mi pregunta es: Como hago para poder permitir que si tenga valores mayores que 32? Ya cambie el Array pa:[0..60] y continua no permitinda nada mayor que 32.

Paulao 25-01-2012 13:37:59

Señores, hizo asi para ver el resultado, o sea, cambie para un valor fijo(60) y saque la validacion(hizo un comentario) y me lo da el error:

Código Delphi [-]
Field name cannot longer than 31 characters.

procedure AddFieldDesc(const FldName: string; FldType, Attributes: Integer);
  var
    FldDesc: TDSDataPacketFldDesc;
  begin
    if Length(FldName) >=  60{SizeOf(FldDesc.szFieldName)} then
      raise EDSWriter.CreateFmt(SFieldNameTooLong,[SizeOf(FldDesc.szFieldName) - 1]);
    FillChar(FldDesc, SizeOf(FldDesc), 0);
    StrLCopy(FldDesc.szFieldName, PChar(FldName), SizeOf(FldDesc.szFieldName) - 1);
    FldDesc.iFieldType := FldType;
    FldDesc.iAttributes := Attributes;
    Check(FIDSWriter.AddColumnDesc(FldDesc));
  end;


La franja horaria es GMT +2. Ahora son las 22:44:11.

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