Skip to content

Commit

Permalink
fix: insert IN(null) instead of IN() when In([]) empty array for mysq…
Browse files Browse the repository at this point in the history
…lDriver (#6237)

fix: lint warning

Co-authored-by: shitong.zheng <[email protected]>
  • Loading branch information
zstiu and shitong.zheng authored Jul 7, 2020
1 parent 6eeb03a commit 6f6bdbd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/find-options/FindOperator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {FindOperatorType} from "./FindOperatorType";
import {Connection} from "../";
import {OracleDriver} from "../driver/oracle/OracleDriver";
import {MysqlDriver} from "../driver/mysql/MysqlDriver";

/**
* Find Operator used in Find Conditions.
Expand Down Expand Up @@ -108,9 +109,9 @@ export class FindOperator<T> {
case "between":
return `${aliasPath} BETWEEN ${parameters[0]} AND ${parameters[1]}`;
case "in":
if (connection.driver instanceof OracleDriver && parameters.length === 0) {
if ((connection.driver instanceof OracleDriver || connection.driver instanceof MysqlDriver) && parameters.length === 0) {
return `${aliasPath} IN (null)`;
}
}
return `${aliasPath} IN (${parameters.join(", ")})`;
case "any":
return `${aliasPath} = ANY(${parameters[0]})`;
Expand All @@ -127,4 +128,4 @@ export class FindOperator<T> {
return "";
}

}
}

0 comments on commit 6f6bdbd

Please sign in to comment.