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

fix: lint warning
  • Loading branch information
shitong.zheng committed Jun 10, 2020
1 parent defa9bc commit d0ba127
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 d0ba127

Please sign in to comment.