mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fixed query builder when empty ids are returned
This commit is contained in:
parent
bcc1c7e64b
commit
21b518a296
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "typeorm",
|
||||
"private": true,
|
||||
"version": "0.0.2-alpha.4",
|
||||
"version": "0.0.2-alpha.5",
|
||||
"description": "Data-mapper ORM for Typescript",
|
||||
"license": "Apache-2.0",
|
||||
"readmeFilename": "README.md",
|
||||
|
||||
@ -320,6 +320,8 @@ export class QueryBuilder<Entity> {
|
||||
.query<any[]>(idsQuery)
|
||||
.then((results: any[]) => {
|
||||
const ids = results.map(result => result["ids"]).join(", ");
|
||||
if (ids.length === 0)
|
||||
return Promise.resolve([]);
|
||||
const queryWithIds = this.clone()
|
||||
.andWhere(mainAlias + "." + metadata.primaryColumn.name + " IN (" + ids + ")")
|
||||
.getSql();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user