#1 2016-06-21 14:18:08

Elcio
Member
Registered: 2016-06-21
Posts: 1

What problem this code?

Hello All

What show description partial ?

var
    Id,desc: TSynTableFieldProperties;
    IDCount: integer;
    p: pointer;
    data: RawByteString;

begin
    T:= TSynBigTableRecord.Create('test.db','Client');
    try
      T.AddField('Id',  tftInt64,   []);
      T.AddField('desc',       tftUTF8,    []);
      T.AddFieldUpdate;

      Id := T.Table['Id'];
      desc := T.Table['desc'];

      //# 1
      rec.Init(T.Table);
      rec.SetFieldValue(Id, 1);
      rec.SetFieldValue(desc, 'Sérgio');
      T.RecordAdd(rec);

      //# 2
      rec.Init(T.Table);
      rec.SetFieldValue(Id, 2);
      rec.SetFieldValue(desc, 'Adão da Silva');
      T.RecordAdd(rec);

      T.UpdateToFile;

      IDCount:= 0;
      T.Search(desc, 'Adão da Silva', IDs, IDCount);

      if (IDCount>0) then begin
        T.RecordGet(IDs[0], rec);
        ShowMessage(rec.Field['desc']);  < - Show only 'Ad' ???

        p := T.GetPointer(IDs[0],data);
        ShowMessage(desc.GetRawUTF8(p));  < - Show full desc 'Adão da Silva'  ???
      end;

    finally
      FreeAndNil(T);
    end;
end;

Thanks for All
Elcio

Last edited by Elcio (2016-06-21 17:10:58)

Offline

Board footer

Powered by FluxBB