Browse Source

Add option to set maximum table count, and increase the dafault count

pull/7/head
formulahendry 8 years ago
parent
commit
54d07c1630
  1. 4
      README.md
  2. 5
      package.json
  3. 2
      src/common/utility.ts
  4. 2
      src/model/databaseNode.ts

4
README.md

@ -30,6 +30,10 @@ MySQL management tool
![newquery](images/newquery.png)
## Settings
* `vscode-mysql.maxTableCount`: The maximum table count shown in the tree view. (Default is **500**)
## Telemetry data
By default, anonymous telemetry data collection is turned on to understand user behavior to improve this extension. To disable it, update the settings.json as below:

5
package.json

@ -125,6 +125,11 @@
"type": "boolean",
"default": true,
"description": "Whether to enable anonymous usage collection."
},
"vscode-mysql.maxTableCount": {
"type": "integer",
"default": 500,
"description": "The maximum table count shown in the tree view"
}
}
}

2
src/common/utility.ts

@ -8,6 +8,8 @@ import { Global } from "./global";
import { OutputChannel } from "./outputChannel";
export class Utility {
public static readonly maxTableCount = Utility.getConfiguration().get<number>("maxTableCount");
public static getConfiguration(): vscode.WorkspaceConfiguration {
return vscode.workspace.getConfiguration("vscode-mysql");
}

2
src/model/databaseNode.ts

@ -29,7 +29,7 @@ export class DatabaseNode implements INode {
port: this.port,
database: this.database,
});
return Utility.queryPromise<any[]>(connection, `SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '${this.database}' LIMIT 100`)
return Utility.queryPromise<any[]>(connection, `SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '${this.database}' LIMIT ${Utility.maxTableCount}`)
.then((tables) => {
return tables.map<TableNode>((table) => {
return new TableNode(this.host, this.user, this.password, this.port, this.database, table.TABLE_NAME);

Loading…
Cancel
Save