1、delphi的strtodate 不能给TUnimDatePicker.Date赋值,需要通过UniDateStringToDate(formatstr,datestr)(uniDateUtils.dcu/pas)来执行,反过来formatdatetime可以将TUnimDatePicker.Date转为string。
js:=JSONObj.GetValue('日期').Value;
eRegdate.Date:= UniDateStringToDate('yyyyMMdd',js);
//eRegDate.Date:=strtodate(copy(js,1,4)+'-'+copy(js,5,2)+'-'+copy(js,7,2));
2、TUnimImage,通过loadfromstream出错(windows中正常),可以将stream保存为文件(png,jpg,两种保存时扩展名无所谓(必须要有扩展名),其它格式没试过)。
{$ifdef Linux64}
fn2:='./o.jpg';
fn1:='./d.jpg';
tblobfield(tt.FieldByName('o')).SaveToFile('./o.jpg');
try
o.Picture.LoadFromFile('./o.jpg');
except
putlog('o nil');
end;
tblobfield(tt.FieldByName('d')).SaveToFile('./d.jpg');
try
d.Picture.LoadFromFile('./d.jpg');
except
putlog('d nil');
end;
{$else}
st:=tt.createBlobStream(tblobfield(tt.FieldByName('o')), bmRead);
st.Position:=0;
o.Picture.LoadFromStream(st);
st:=tt.createBlobStream(tblobfield(tt.FieldByName('d')), bmRead);
st.Position:=0;
d.Picture.LoadFromStream(st);
{$endif}
3、TUnimImage.picture.savetostream,保存的stream无法被dataset.params.loadfromstream使用,先保存为文件(扩展名无所谓),然后dataset用loadfromfile(stream,ftBlob)。
tq.ParamByName('Doc').LoadFromFile(fn2,ftBlob);
//tq.ParamByName('Doc').LoadFromStream(st,ftBlob)
4、Linux中,createdir,createfile,有路径的不能用\,要用/。windows都行。
{$ifdef Linux64}
if not DirectoryExists('Upload/') then
CreateDir('Upload/');
p:='Upload/'+formatdatetime('yyyymmdd',now)+'/';
{$else}
if not DirectoryExists('Upload\') then
CreateDir('Upload\');
p:='Upload\'+formatdatetime('yyyymmdd',now)+'\';
{$endif}
5、datasnap在linux下如果需要用到路径也要保存/\的区别,不然会出错。
6、Linux下获取路径,不能用Application.exename,只能用ExtractFilePath(ParamStr(0)),但这有个问题,程序在执行时如果命令行直接输入./comname,则返回.,需要输入全路径,得出路径才是正常的。/home/temp/comname,结果就是/home/temp,
{$ifdef Linux64}
SetCurrentDir(ExtractFilePath(ParamStr(0)));
{$else}
SetCurrentDir(ExtractFilePath(Application.exename));
{$endif}
==================
unigui需要的4个文件夹,里面的文件都不能少,有时候复制不完整会导致页面破碎,执行报错。

4716

被折叠的 条评论
为什么被折叠?



