fix(sqlserver): restore view selection after reconnect
This commit is contained in:
parent
67b04f5635
commit
c4f4ce2460
|
|
@ -783,6 +783,12 @@ async function ensureTreeLoadedForTarget(target: ActiveTabSidebarTarget, opts?:
|
|||
if (force || !databaseChildrenLoaded) {
|
||||
await store.loadSqlServerDatabaseObjects(connId, target.database, loadOptions);
|
||||
}
|
||||
if (targetSchema) {
|
||||
const schemaNode = findSchemaNode(store.treeNodes, connId, target.database, targetSchema);
|
||||
if (schemaNode && (force || !schemaNode.children || schemaNode.children.length === 0)) {
|
||||
await store.loadTables(connId, target.database, targetSchema, loadOptions);
|
||||
}
|
||||
}
|
||||
} else if (usesSchemaTree) {
|
||||
if (force || !databaseChildrenLoaded) {
|
||||
await store.loadSchemas(connId, target.database, loadOptions);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,18 @@ test("builds schema-aware cursor table candidates", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("builds SQL Server view candidates from bracket-quoted identifiers", () => {
|
||||
const sql = "SELECT * FROM [sales].[v_city_sales]";
|
||||
const tab = queryTab(sql, sql.length, undefined);
|
||||
|
||||
assert.deepEqual(queryCursorTableCandidate(tab, "sqlserver"), {
|
||||
connectionId: "conn-1",
|
||||
database: "app",
|
||||
schema: "sales",
|
||||
tableName: "v_city_sales",
|
||||
});
|
||||
});
|
||||
|
||||
test("builds database-qualified candidates for multi-database non-schema engines", () => {
|
||||
const tab = queryTab("select * from analytics.events", "select * from analytics.events".length, undefined);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue