MOBILE-3977 db: Implement method to log history
This commit is contained in:
parent
fdd5d5d8a5
commit
effe53807a
@ -38,6 +38,17 @@ export class CoreDbProvider {
|
||||
return CoreAppProvider.isAutomated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print query history in console.
|
||||
*/
|
||||
printHistory(): void {
|
||||
const substituteParams = ({ sql, params }: CoreDbQueryLog) =>
|
||||
Object.values(params ?? []).reduce((sql: string, param: string) => sql.replace('?', param), sql);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(this.queryLogs.map(substituteParams).join('\n'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a query.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user