Forum > Database

[Solved] Different behaviour of Blob type

(1/1)

luca:
Hi,
I've updated a program to last official version of Lazarus.
I must change this code

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  i:integer;  a:String;  begin....  qry.ParamByName('VAL').AsBlob:=a;....end; to this one

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  i:integer;  a:TBytes;  begin....  qry.ParamByName('VAL').AsBlob:=a;....end; 
I know probably last version is better than the previous one, BUT I cannot compile the old code because I receive this error:

unit1.pas(470,43) Error: Incompatible type for arg no. 1: Got "AnsiString", expected "TBytes"

So my question is: what has changed from Lazarus 2.0.12 to Lazarus 2.2.0?

Regards
Luca

luca:
I found this in the user Changes 3.2.0
https://wiki.freepascal.org/User_Changes_3.2.0#TBlobData_opaque_type_reworked_to_TBytes


--- Quote ---TBlobData opaque type reworked to TBytes
Old behaviour: TBlobData was declared as Ansistring
New behaviour: TBlobData is declared as TBytes
Reason for change: Delphi compatibility. Also helps to avoid possible code page recodings.
Remedy: If your application used TBlobData as a string, you can use AsString for parameters, or convert to TBytes.

--- End quote ---

Navigation

[0] Message Index

Go to full version