Board index » delphi » Copying a TTable's record to memory...

Copying a TTable's record to memory...

Hi,

Say I have a variable in memory with RecordLen's number of byte.  How can I
fastest copy a TTable's record to this variable? (Not copying
field-by-field, but the whole record).

What about if I have a memofield (within the TTable, not in separate BLOB
file), how can I safely copy a record with memofield(s) to/from a variable
too...?

Thanks in advance for some useful hints...

Best regards

Tor

 

Re:Copying a TTable's record to memory...


If you do a Table.getcurrentrecord, the entire record gets copied to all the
TFields of the record at once. I'm not sure if this is what you want!

An example:

var
  recordbuffer: PChar;

begin
  recordbuffer:= AllocMem(Table.Recordsize);
  Try
     if Table.GetCurrentRecord(Recordbuffer) then
       begin
          do your code here
      end;
   finally
     freemem(recordbuffer,table.recordsize);
  end;
end;

Chris Vattaks

Quote
Tor Tveitane wrote in message <73cg89$6v...@forums.borland.com>...
>Hi,

>Say I have a variable in memory with RecordLen's number of byte.  How can I
>fastest copy a TTable's record to this variable? (Not copying
>field-by-field, but the whole record).

>What about if I have a memofield (within the TTable, not in separate BLOB
>file), how can I safely copy a record with memofield(s) to/from a variable
>too...?

>Thanks in advance for some useful hints...

>Best regards

>Tor

Other Threads