-
Notifications
You must be signed in to change notification settings - Fork 7
tweak(db): exists method on database and database model classes
#6525
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,6 +294,15 @@ export class TupaiaDatabase { | |
| return buildQuery(this.connection, ...args); | ||
| } | ||
|
|
||
| /** | ||
| * @returns {Promise<boolean>} | ||
| */ | ||
| async exists(...args) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could move this to the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 100% agree! But it doesn't exist on the base branch (this PR is off dev) Unless you’re itching to use this (I have been), feel free to leave this PR for my return and I will integrate it into BaseDatabase and resolve merge conflicts |
||
| const innerQuery = this.find(...args); | ||
| const [{ exists }] = await this.executeSql('SELECT EXISTS(?);', [innerQuery]); | ||
jaskfla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return exists; | ||
jaskfla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Race condition: Unready DB breaks subquery.The |
||
|
|
||
| /** | ||
| * | ||
| * @param {string} recordType | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.