[fpc-devel] Major problem with Move and Array of Int64
Ludo Brands
ludo.brands at free.fr
Fri Sep 23 09:44:31 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?
What is "large". Remember that the upper limit for blobs sent in a sql
statement is max_allowed_packet. Default is 1M.
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_m
ax_allowed_packet
To send larger blobs you need to prepare the statement and send data in
chuncks. Not supported in sqldb.
Ludo
More information about the fpc-devel
mailing list