Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
fix: mysql builder & timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Soontao committed Sep 1, 2020
1 parent 056bc94 commit a1794a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
'testMatch': [
'**/test/**/?(*.)+(spec|test).[jt]s?(x)'
],
'testTimeout': 120 * 1000,
'testTimeout': 10 * 60 * 1000, // 10 minutes
'collectCoverageFrom': [
'src/**/*',
'!**/node_modules/**'
Expand Down
6 changes: 4 additions & 2 deletions src/type/db_helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const buildName = (...names: string[]): string => names.filter(Boolean).join('.'

const buildNameWithQuote = (...names: string[]): string => names.filter(Boolean).map((name) => `"${name}"`).join('.');

const buildNameWithBackQuote = (...names: string[]): string => names.filter(Boolean).map((name) => `\`${name}\``).join('.');

export class BaseDBHelper implements DBHelper {

getDatabaseType(): EDatabaseType {
Expand Down Expand Up @@ -108,11 +110,11 @@ export class MySqlDBHelper extends BaseDBHelper {
colNameMapper = (v) => v;
}

const fullTableName = buildName(`\`${schema}\``, `\`${tableName}\``);
const fullTableName = buildNameWithBackQuote(schema, tableName);

const { sqlQuery, count, where, selectedFields } = transformQueryAst(
query,
(col) => buildName(`\`${schema}\``, `\`${tableName}\``, `\`${colNameMapper(col)}\``)
(col) => buildNameWithBackQuote(schema, tableName, colNameMapper(col))
);

const sSelects = isEmpty(selectedFields) ? '*' : selectedFields.join(', ');
Expand Down

0 comments on commit a1794a9

Please sign in to comment.