Skip to content

Commit 6f6bdbd

Browse files
zstiushitong.zheng
andauthored
fix: insert IN(null) instead of IN() when In([]) empty array for mysqlDriver (#6237)
fix: lint warning Co-authored-by: shitong.zheng <shitong.zheng@shopee.com>
1 parent 6eeb03a commit 6f6bdbd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/find-options/FindOperator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {FindOperatorType} from "./FindOperatorType";
22
import {Connection} from "../";
33
import {OracleDriver} from "../driver/oracle/OracleDriver";
4+
import {MysqlDriver} from "../driver/mysql/MysqlDriver";
45

56
/**
67
* Find Operator used in Find Conditions.
@@ -108,9 +109,9 @@ export class FindOperator<T> {
108109
case "between":
109110
return `${aliasPath} BETWEEN ${parameters[0]} AND ${parameters[1]}`;
110111
case "in":
111-
if (connection.driver instanceof OracleDriver && parameters.length === 0) {
112+
if ((connection.driver instanceof OracleDriver || connection.driver instanceof MysqlDriver) && parameters.length === 0) {
112113
return `${aliasPath} IN (null)`;
113-
}
114+
}
114115
return `${aliasPath} IN (${parameters.join(", ")})`;
115116
case "any":
116117
return `${aliasPath} = ANY(${parameters[0]})`;
@@ -127,4 +128,4 @@ export class FindOperator<T> {
127128
return "";
128129
}
129130

130-
}
131+
}

0 commit comments

Comments
 (0)