Subject | Re: [IBO] Varchar with #0 char in it |
---|---|
Author | Ed Dressel |
Post date | 2008-03-14T15:45:13Z |
> I'm not sure if it is pertinent, but are you referring to the fieldhere is my code:
> using .Value or .AsString? The .Value method does save extra code in
> loops but the downside is it accesses the values as variants and
> relies on Delphi to do the casting. That does increase the risk of
> undesired effects such as (possibly) the encounter with the ascii-
> zero causing the string to be interpreted as null-terminated. I
> always use the casting methods where possible...
procedure TdmDatabase.SetEncryptedFieldText(Sender: TField; const
Text: String);
var
lID: Integer;
begin
if Sender.DataSet.FieldByName('Encrypted').AsBoolean then
begin
lID := ...
if not (Sender.Dataset.State in dsEditModes) then
Sender.Dataset.Edit;
Sender.AsString := GeneralFunctions.GetEncryptedData(Text, lID, ...);
end;
end;
any other ideas?
Ed Dressel