Skip to content

Commit 967ca32

Browse files
authored
fix: using the correct database when switch store (#779)
Co-authored-by: rick <[email protected]>
1 parent 06ca3e4 commit 967ca32

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

console/atest-ui/src/views/DataManager.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@ const tablesTree = ref([] as TreeItem[])
4848
const storeChangedEvent = (s: string) => {
4949
kind.value = ''
5050
SetDataManagerPreference('currentStore', s)
51+
queryDataMeta.value.currentDatabase = ""
5152
stores.value.forEach((e: Store) => {
5253
if (e.name === s) {
5354
kind.value = e.kind.name
5455
switch (GetDriverName(e)){
5556
case Driver.MySQL:
5657
sqlConfig.value.dialect = MySQL
58+
e.properties.forEach((p: Pair) => {
59+
if (p.key === 'database') {
60+
queryDataMeta.value.currentDatabase = p.value
61+
}
62+
})
5763
break;
5864
case Driver.Postgres:
5965
sqlConfig.value.dialect = PostgreSQL
@@ -64,6 +70,18 @@ const storeChangedEvent = (s: string) => {
6470
default:
6571
sqlConfig.value.dialect = StandardSQL
6672
}
73+
74+
switch (GetDriverName(e)){
75+
case Driver.MySQL:
76+
case Driver.Postgres:
77+
case Driver.TDengine:
78+
e.properties.forEach((p: Pair) => {
79+
if (p.key === 'database') {
80+
queryDataMeta.value.currentDatabase = p.value
81+
}
82+
})
83+
break;
84+
}
6785
return
6886
}
6987
})
@@ -79,7 +97,6 @@ const storeChangedEvent = (s: string) => {
7997
complexEditor.value = true
8098
}
8199
82-
queryDataMeta.value.currentDatabase = GetDataManagerPreference().currentDatabase
83100
executeQuery()
84101
}
85102
watch(store, storeChangedEvent)

0 commit comments

Comments
 (0)