- 微信小程序云函数动态更新MySQL?
var sql = 'UPDATE sensors SET time_sta=15,update_status=0,update_time=11 WHERE id="SCSQ210124001" AND num=1'; const [rows, fields] = await connection.execute(sql); 在云函数里 利用这二条指令 还操作MySQL 并且更新成功(自己云服务器上的) 但想把里面的值改为动态输入 先拟定id1,num1为用户输入 var id1 = "SCSQ210124001"; var num1 = 1; var sql = 'UPDATE sensors SET time_sta=15,update_status=0,update_time=11 WHERE id=' + id1 + ' AND num='+num1 ; "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'num=1' at line 1" 结果报错 "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'num=1' at line 1" 最后才发现要加空格 var sql = 'UPDATE sensors SET time_sta=11,update_status=1,update_time=11 WHERE id='+ id1 +' AND num='+num1 ; 这才更新进MySQL
2021-03-11 - 云函数反馈调用失败怎么解决呀?
日志内容 Request ID: 839b687a-7da1-11eb-aa81-525400b84760 执行时间: 50000ms内存使用: 32.54 MB 返回结果 {"errorCode":-1,"errorMessage":"Async invoking task timed out after 50 seconds","statusCode":433} 日志 START RequestId:839b687a-7da1-11eb-aa81-525400b84760 2021-03-05T10:57:02.215Z 成功 [ BinaryRow { temp: 25, humi: 55, time: 55, minute: 656 }, BinaryRow { temp: 34, humi: 45, time: 2, minute: 3 }, BinaryRow { temp: 23, humi: 52, time: 22, minute: 333 }, BinaryRow { temp: 55, humi: 45, time: 45, minute: 465 }, BinaryRow { temp: 12, humi: 54, time: 78, minute: 787 } ] ERROR RequestId:839b687a-7da1-11eb-aa81-525400b84760 Result:{"errorCode":-1,"errorMessage":"Async invoking task timed out after 50 seconds","statusCode":433} END RequestId:839b687a-7da1-11eb-aa81-525400b84760 Report RequestId:839b687a-7da1-11eb-aa81-525400b84760 Duration:50000ms Memory:256MB MemUsage:32.542969MB
2021-03-05