Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 11 to 12 of 12 total |
Blobs |
Mon, Mar 14 2011 4:52 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
> SetLength(TempString,(Length(DoubleArray)*SizeOf(Double))); > Move(DoubleArray[0],TempString[1],Length(TempString)); Neat way to convert to a string - I'll add to my toolbox. Does using .AsBlob mean you don't have to use BinaryToSQLStr? Roy Lambert |
Mon, Mar 14 2011 9:09 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Does using .AsBlob mean you don't have to use BinaryToSQLStr? >> AsBlob basically is just an AnsiString property in the older versions of Delphi so yes, you should not use BinaryToSQLStr because the TParam actually wants a straight-up buffer, not a hex-encoded string. There's a lot of this "string abuse" in the earlier days of Delphi where byte arrays weren't used as much. Now that byte arrays are more prevalent, the AsBlob property in the newer versions of Delphi use byte arrays (TBytes). Which basically brings me to my next statement: David, I gave you the information for older versions of Delphi, not Delphi XE. With Delphi XE, you can use this: var DoubleArray: array of Double; TempBytes: TBytes; begin SetLength(DoubleArray,10); DoubleArray[0]:=100; DoubleArray[9]:=200; SetLength(TempBytes,(Length(DoubleArray)*SizeOf(Double))); Move(DoubleArray[0],TempBytes[0],Length(TempBytes)); with EDBQuery1 do begin SQL.Text:='insert into david (ID, DATA) values (:ID, :DATA)'; Prepare; ParamByName('ID').ParamType:=ptInputOutput; ParamByName('DATA').AsBlob:=TempBytes; ExecSQL; end; end; -- Tim Young Elevate Software www.elevatesoft.com |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |