(schemaName: string, name: string)
| 282 | } |
| 283 | |
| 284 | async view(schemaName: string, name: string): Promise<DatabaseViewSchema> { |
| 285 | const sql = `SELECT * FROM ${this.escapeId(schemaName)}.sqlite_schema WHERE type = 'view' AND name = ${this.escapeValue(name)};`; |
| 286 | const result = await this.query(sql); |
| 287 | |
| 288 | const viewRow = result.rows[0] as { sql: string } | undefined; |
| 289 | if (!viewRow) throw new Error("View dose not exist"); |
| 290 | |
| 291 | return parseCreateViewScript(schemaName, viewRow.sql); |
| 292 | } |
| 293 | |
| 294 | createView(view: DatabaseViewSchema): string { |
| 295 | return `CREATE VIEW ${this.escapeId(view.schemaName)}.${this.escapeId(view.name)} AS ${view.statement}`; |
nothing calls this directly
no test coverage detected