Browse Source

Fix mock data fail.

pull/252/head
cweijan 4 years ago
parent
commit
0e77a12618
  1. 2
      package.json
  2. 10
      src/bin/mockjs.js
  3. 2
      src/model/main/tableNode.ts
  4. 2
      src/service/mock/mockRunner.ts

2
package.json

@ -991,7 +991,6 @@
},
"devDependencies": {
"@antv/g2": "^4.0.9",
"@types/mockjs": "^1.0.2",
"@types/mongodb": "^3.6.3",
"@types/node": "^12.12.6",
"@types/ssh2": "^0.5.43",
@ -1030,7 +1029,6 @@
"json-format-highlight": "^1.0.4",
"lodash": "^4.17.20",
"lodash.defaults": "^4.1.0",
"mockjs": "^1.1.0",
"mongodb": "^3.6.9",
"mysql2": "^2.2.5",
"officegen": "^0.6.5",

10
src/bin/mockjs.js
File diff suppressed because it is too large
View File

2
src/model/main/tableNode.ts

@ -252,7 +252,7 @@ ROW_FORMAT : ${meta.row_format}
const count = await this.execute(`select max(${primaryKey}) max from ${this.wrap(this.table)}`);
if (count && count[0]?.max) {
const max = count[0].max;
return Number.isInteger(max) ? max : 0;
return Number.isInteger(max)||max.match(/^\d+$/) ? max : 0;
}
}

2
src/service/mock/mockRunner.ts

@ -1,5 +1,5 @@
import { existsSync, readFileSync } from 'fs';
import * as Mock from 'mockjs';
import * as Mock from '@/bin/mockjs';
import * as vscode from "vscode";
import { MessageType } from "../../common/constants";
import { ConnectionManager } from "../connectionManager";

Loading…
Cancel
Save