ali-sdk / ali-rds

Aliyun RDS client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

where 空数组问题

shepherdwind opened this issue · comments

commented

如果 where 是一个空的数组会报错,msyql 语法有问题。感觉这种情况是不是可以直接退出,不查询了。一个空的 where 就返回一个空就行了。

if (Array.isArray(value)) {

sqlMessage: '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 \')\' at line 1'
sqlState: '42000'
index: 0
sql: 'SELECT * FROM `table` WHERE `tableId` IN ()'

这种还是 fail fast 比较好吧? 空的数组说明代码逻辑肯定是有问题的,应该早点让开发者察觉?

呃,value 是空数组,这样传应该不对吧。

commented

抛个异常也行,不过直接生成一个错误的 sql 好像不好。

commented

异常也还行,这个先关闭吧