diff --git a/README.md b/README.md index 3be695f..7c1ebe8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,15 @@ # MySQL -[![Marketplace Version](https://vsmarketplacebadge.apphb.com/version-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Rating](https://vsmarketplacebadge.apphb.com/rating-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Build Status](https://travis-ci.org/formulahendry/vscode-mysql.svg?branch=master)](https://travis-ci.org/formulahendry/vscode-mysql) +[![Marketplace Version](https://vsmarketplacebadge.apphb.com/version-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Rating](https://vsmarketplacebadge.apphb.com/rating-short/cweijan.vscode-mysql-manager.svg)](https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-manager) [![Build Status](https://travis-ci.org/cweijan/vscode-mysql.svg?branch=master)](https://travis-ci.org/cweijan/vscode-mysql) MySQL management tool Plus -> This plugin forked from [MySQL](https://marketplace.visualstudio.com/items?itemName=formulahendry.vscode-mysql) +> This plugin base of [MySQL](https://marketplace.visualstudio.com/items?itemName=formulahendry.vscode-mysql) > > Many amazing improvements have been made > > Welcome to contribute in [repository](https://github.com/cweijan/vscode-mysql) -> -> You can see changes in the [changelog](/CHANGELOG.md) ## Features diff --git a/logo.png b/logo.png index 40c79a6..9d26dae 100644 Binary files a/logo.png and b/logo.png differ diff --git a/resources/webview/result.html b/resources/webview/result.html index ce5cfbc..a50da6b 100644 --- a/resources/webview/result.html +++ b/resources/webview/result.html @@ -28,7 +28,7 @@ .info-panel { color: #444; - font-size: 16px; + font-size: 14px; background-color: white; border: 1px solid #dcdfe6; border-radius: 5px; @@ -84,24 +84,27 @@ -
-
+
+
+
- + sortable v-if="result.columnList" :width="computeWidth(column)"> @@ -166,7 +169,8 @@ info: { sql: null, message: null, - visible: false + visible: false, + error: false }, update: { current: {}, @@ -175,6 +179,14 @@ } }, methods: { + sort(row) { + let order = row.order == 'ascending' ? "asc" : "desc" + let sortSql = this.result.sql + .replace(";","") + .replace(/order by .+? (desc|asc)?/ig, "") + .replace(/\s?(limit.+)?$/i,` ORDER BY ${row.column.label} ${order} \$1 `) + this.execute(sortSql) + }, insertRequest() { this.editor.visible = true; this.update.primary = null; @@ -332,14 +344,12 @@ // vscode.setState({ result: vue.result }); is instead by retainContextWhenHidden=true } - const handlerDml = (res) => { - // TODO 回显优化 + const handlerCommon = (res) => { vue.editor.loading = false; vue.editor.visible = false; vue.info.visible = true; vue.info.message = res.message // vue.$message({ type: 'success', message: `EXECUTE ${res.sql} SUCCESS, affectedRows:${res.affectedRows}` }); - vue.refresh() } window.addEventListener('message', event => { @@ -358,8 +368,13 @@ handlerData(response) break; case "DML": + handlerCommon(response) + vue.info.error = false + vue.refresh() + break; case "ERROR": - handlerDml(response) + handlerCommon(response) + vue.info.error = true break; default: vue.$message(JSON.stringify(event.data)); diff --git a/src/provider/Complection/CompletionProvider.ts b/src/provider/Complection/CompletionProvider.ts index 2194078..e5077b5 100644 --- a/src/provider/Complection/CompletionProvider.ts +++ b/src/provider/Complection/CompletionProvider.ts @@ -18,7 +18,6 @@ export class CompletionProvider implements vscode.CompletionItemProvider { private initDefaultComplectionItem() { // The chain is orderly - // TODO 增加在Where和ON语句下的表检测 this.fullChain = [ new TableCreateChain(), new TypeKeywordChain(), diff --git a/src/provider/Complection/chain/keywordChain.ts b/src/provider/Complection/chain/keywordChain.ts index 47abaea..78d6864 100644 --- a/src/provider/Complection/chain/keywordChain.ts +++ b/src/provider/Complection/chain/keywordChain.ts @@ -3,7 +3,6 @@ import { ComplectionChain, ComplectionContext } from "../complectionContext"; export class KeywordChain implements ComplectionChain { - // TODO 需要再细分, 分为ON和WHERE才能使用的条件 private keywordList: string[] = ["JOIN", "SELECT", "UPDATE", "DELETE", "TABLE", "INSERT", "INTO", "VALUES", "FROM", "WHERE", "GROUP BY", "ORDER BY", "HAVING", "LIMIT", "ALTER", "CREATE", "DROP", "FUNCTION", "CASE", "PROCEDURE", "TRIGGER", "INDEX", "CHANGE", "COLUMN", "ADD", 'SHOW', "PRIVILEGES", "IDENTIFIED", "VIEW", "CURSOR", "EXPLAIN"]; private keywordComplectionItems: vscode.CompletionItem[] = []; diff --git a/src/view/result/query.ts b/src/view/result/query.ts index f131249..069397d 100644 --- a/src/view/result/query.ts +++ b/src/view/result/query.ts @@ -6,7 +6,7 @@ import { DatabaseCache } from "../../database/DatabaseCache"; import { QueryUnit } from "../../database/QueryUnit"; import { IConnection } from "../../model/Connection"; import { ColumnNode } from "../../model/table/columnNode"; -import { DataResponse, ErrorResponse, DMLResponse } from "./queryResponse"; +import { DataResponse } from "./queryResponse"; export class QueryParam { type: MessageType; @@ -31,13 +31,12 @@ export class QueryPage { queryParam.res.message=`EXECUTE SUCCESS:

  ${queryParam.res.sql}

AffectedRows : ${queryParam.res.affectedRows}, CostTime : ${queryParam.res.costTime}ms` break; case MessageType.ERROR: - queryParam.res.message=`EXECUTE Fail:

  ${queryParam.res.sql}

message :
  ${queryParam.res.message}` + queryParam.res.message=`EXECUTE FAIL:

  ${queryParam.res.sql}

Message :

  ${queryParam.res.message}` break; } this.sendData = queryParam if (this.creating) return; - // TODO support delimiter : const _sql = sql.toString().replace(/DELIMITER ;?;/gm, '').replace(/;;/gm, ';') // update result webview if (this.resultWebviewPanel) {