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 (typeorm#6237)

fix: lint warning

Co-authored-by: shitong.zheng <shitong.zheng@shopee.com>
  • Loading branch information
2 people authored and Svetlozar committed Jan 12, 2021
1 parent 1a069b6 commit 3a715ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/find-options/FindOperator.ts
@@ -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 3a715ff

Please sign in to comment.