[fpc-devel] Major problem with Move and Array of Int64

Andrew Brunner andrew.t.brunner at gmail.com
Fri Sep 23 03:52:53 CEST 2011


I use latest FPC from /trunk/ and this problem just started happening recently.

Pseudo code

Write To SQL as Blob (using parameter binding)

Param.AsString=uInt64Array.toBlob(MyList);

unit "uInt64Array"

procedure fromBlob(List,string)
  count=length(string) div 8; // size of int64
  SetLength(List,count)
  iPos:=1;
  for iLcv=0 to Count-1 do begin
    System.Move(String[iPos],List[iLcv],8);
    Inc(iPos,8);
  end;
end;

function toBlob(List):string;
begin
  iLen=System.Length(List)*8;
  System.SetLength(Result,iLen);
  iPos:=1;
  for iLcv:=0 to High(List) do begin
    System.Move(List[iLcv],Result[iPos],8);
    Inc(iPos,8);
  end;
end;

Posting to the MySQL 5.1 database : the field size is as expected.
Retrieving /converting the list (asString) from the database with all
values set to small numbers appears to work
Retrieving converting the list (asString) from teh database with
larger values no longer works.

Did anyone do anything to System.Move?
Did anyone recently do work on BLOB features to MySQL 5.1 connector?



More information about the fpc-devel mailing list