()
| 211 | } |
| 212 | |
| 213 | async getSchemas(): Promise<string[]> { |
| 214 | if (!this.connection) { |
| 215 | throw new Error("Not connected to SQL Server database"); |
| 216 | } |
| 217 | |
| 218 | try { |
| 219 | const result = await this.connection.request().query(` |
| 220 | SELECT SCHEMA_NAME |
| 221 | FROM INFORMATION_SCHEMA.SCHEMATA |
| 222 | ORDER BY SCHEMA_NAME |
| 223 | `); |
| 224 | |
| 225 | return result.recordset.map((row: { SCHEMA_NAME: any }) => row.SCHEMA_NAME); |
| 226 | } catch (error) { |
| 227 | throw new Error(`Failed to get schemas: ${(error as Error).message}`); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | async getTables(schema?: string): Promise<string[]> { |
| 232 | if (!this.connection) { |
nothing calls this directly
no outgoing calls
no test coverage detected