MCPcopy Create free account
hub / github.com/bytebase/dbhub / resolveDefaultSchemas

Function resolveDefaultSchemas

src/tools/search-objects.ts:80–88  ·  view source on GitHub ↗

* Resolve the set of schemas a search should scope to when the caller did not * pass an explicit `schema` filter. * * Prefers the connector's default schema (e.g. the database named in a * MySQL/MariaDB DSN) so searches don't leak across every database on the * server. When the connector report

(connector: Connector)

Source from the content-addressed store, hash-verified

78 * for PostgreSQL/SQL Server/SQLite is already scoped to the connected database.
79 */
80async function resolveDefaultSchemas(connector: Connector): Promise<string[]> {
81 if (connector.getDefaultSchema) {
82 const defaultSchema = await connector.getDefaultSchema();
83 if (defaultSchema) {
84 return [defaultSchema];
85 }
86 }
87 return connector.getSchemas();
88}
89
90/**
91 * Get row count estimate for a table.

Callers 5

searchSchemasFunction · 0.85
searchTablesFunction · 0.85
searchColumnsFunction · 0.85
searchProceduresFunction · 0.85
searchIndexesFunction · 0.85

Calls 2

getDefaultSchemaMethod · 0.65
getSchemasMethod · 0.65

Tested by

no test coverage detected