我们正在尝试使我们的应用程序与unicode兼容,并且我们正在从delphi 2007迁移到delphi xe2,我们遇到了一些问题并需要有关它们的建议
1)一个变化是在数据库中存储具有unicode字符串的blob数据
我们将巨大的xml数据作为blob存储在数据库中,但在最新的delphi版本(xe2)中,blob被视为一个字节数组。那么应该怎么做才能在数据库中存储blob数据,尝试过像转换Param.AsBlob:= WideBytesOf(xml),但这似乎不起作用。
2)我们也使用来自EFD系统的HyperString来更快地进行字符串操作,但是现在这个库的unicode版本不可用,通过将ansistring更改为string来编译代码并尝试修改一些汇编语言指令但是成功了到目前为止只有少数人,所以任何人都可以建议更快的字符串操作
答案 0 :(得分:0)
我在互联网上搜索大约半年如何正确地将Blob放入数据库中,我找到了一个对我有用的溶剂,也许它对你有帮助:
Image - TcxImage组件 MainQuery - TQuery组件 MainQueryPicture - 它是通过Field Editor存储在Query组件中的数据库中的Blob字段 ImagePath - 保存图像文件路径的字符串变量
MainQuery.Edit;
if Image.Picture.Graphic <> nil then //if there is an image loaded to the component
begin
MainQueryPicture.LoadFromFile(ImagePath); //load the image to a blob field
end;
MainQuery.Post; //post any changes to the table
希望它有所帮助。