MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / getDatabases

Function getDatabases

src/lib/connectors/mssql/index.ts:48–60  ·  view source on GitHub ↗
(connection: Connection)

Source from the content-addressed store, hash-verified

46};
47
48const getDatabases = async (connection: Connection): Promise<string[]> => {
49 const pool = await getMSSQLConnection(connection);
50 const request = pool.request();
51 const result = await request.query(`SELECT name FROM sys.databases WHERE name NOT IN ('${systemDatabases.join("','")}');`);
52 await pool.close();
53 const databaseList = [];
54 for (const row of result.recordset) {
55 if (row["name"]) {
56 databaseList.push(row["name"]);
57 }
58 }
59 return databaseList;
60};
61
62const getTableSchema = async (connection: Connection, databaseName: string): Promise<Schema[]> => {
63 const pool = await getMSSQLConnection(connection);

Callers 1

newConnectorFunction · 0.70

Calls 1

getMSSQLConnectionFunction · 0.85

Tested by

no test coverage detected