组装一条mysql语句:
sprintf_s(strsql, insert into twifibox_runninglogs values
(null,'%u', '%s', from_unixtime('%u'), '%.1f', '%.1f', '%d', '%d', null)\r\n,
deviceid, roomid, time(null), (float)pth->s16curroomtemp/10,
(float)pth->s16trgroomtemp/10, pth->u8warmstate, pth->workmode);
日志打印:
insert into twifibox_runninglogs values (null,'589923834', '232985fa',
from_unixtime('1439538081'), '0.0', '0.0', '1077215232', '0', null)
from_unixtime('%u') 后面的全部错误,调试跟踪了:
pth->s16curroomtemp = 252
pth->s16trgroomtemp = 350
pth->u8warmstate = 0
pth->workmode = 1
看了很多遍,没发现有不妥的地方,参数都对齐了,求帮助
time(null) 不能直接用,得先用临时值保存?或者%u的格式用错了?
但是其他地方同样的用法又没出错
