Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't execute the query twice #884

Merged
merged 3 commits into from
Aug 9, 2023
Merged

Conversation

mosch
Copy link
Contributor

@mosch mosch commented Jul 13, 2023

I found this while debugging why my sqlite-proxy isn't working. Am I missing something or are we executing the query twice here? We are executing the query in line 112 and 118 if no fields are selected:

async all(placeholderValues?: Record<string, unknown>): Promise<T['all']> {
const { fields, queryString, logger, joinsNotNullableMap } = this;
const params = fillPlaceholders(this.params, placeholderValues ?? {});
logger.logQuery(queryString, params);
const { rows } = await this.client(queryString, params, 'all');
if (fields) {
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
}
return this.client(queryString, params, 'all').then(({ rows }) => rows);
}

@mosch mosch marked this pull request as ready for review July 13, 2023 10:50
@AndriiSherman
Copy link
Member

Agree here, will merge it
Thanks a lot!

@AndriiSherman AndriiSherman merged commit 3febe3c into drizzle-team:main Aug 9, 2023
4 checks passed
@mosch mosch deleted the patch-2 branch August 10, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants