@@ -9,6 +9,7 @@ import { GetDataManagerPreference, SetDataManagerPreference } from './cache'
99import { ElMessage } from ' element-plus'
1010import { Codemirror } from ' vue-codemirror'
1111import { sql , StandardSQL , MySQL , PostgreSQL , Cassandra } from " @codemirror/lang-sql"
12+ import type { SQLConfig } from " @codemirror/lang-sql"
1213import HistoryInput from ' ../components/HistoryInput.vue'
1314import type { Ref } from ' vue'
1415import { Refresh , Document } from ' @element-plus/icons-vue'
@@ -153,6 +154,7 @@ API.GetStores((data) => {
153154 loadingStores .value = false
154155})
155156
157+ const showNativeSQL = ref (true )
156158const ormDataHandler = (data : QueryData ) => {
157159 const result = [] as any []
158160 const cols = new Set <string >()
@@ -168,7 +170,7 @@ const ormDataHandler = (data: QueryData) => {
168170
169171 columns .value = [] as string []
170172 data .meta .labels = data .meta .labels .filter ((item ) => {
171- if (item .key === ' _native_sql' ) {
173+ if (showNativeSQL . value && item .key === ' _native_sql' ) {
172174 sqlQuery .value = item .value
173175 return false
174176 }
@@ -210,15 +212,15 @@ const keyValueDataHandler = (data: QueryData) => {
210212 })
211213 })
212214}
213-
214215const sqlConfig = ref ({
215216 dialect: StandardSQL ,
216217 defaultSchema: queryDataMeta .value .currentDatabase ,
217218 upperCaseKeywords: true ,
218219 schema: {}
219- })
220+ } as SQLConfig )
220221
221222const executeQuery = async () => {
223+ showNativeSQL .value = true
222224 if (sqlQuery .value === ' ' ) {
223225 switch (kind .value ) {
224226 case ExtensionKind .ExtensionKindElasticsearch :
@@ -291,6 +293,13 @@ Magic.AdvancedKeys([{
291293 Keys: [' Ctrl+E' , ' Ctrl+Enter' ],
292294 Func: executeQuery ,
293295 Description: ' Execute query'
296+ }, {
297+ Keys: [' Ctrl+Shift+O' ],
298+ Func : () => {
299+ showNativeSQL .value = false
300+ executeWithQuery (sqlQuery .value )
301+ },
302+ Description: ' Execute query without showing native SQL'
294303}])
295304 </script >
296305
0 commit comments