PDA

Ver la Versión Completa : Problemas con Data Packet


Paulao
23-01-2012, 16:56:09
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:
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:

MIDASNAME = packed array [0..31] of Char; { holds a name }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:

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;