(sessionId: string, sql: string)
| 56 | * Returns columnar format with timing for the legacy IPC contract. |
| 57 | */ |
| 58 | export function executeRawSQL(sessionId: string, sql: string): SQLResult { |
| 59 | const adapter = ensureAdapter(sessionId) |
| 60 | |
| 61 | try { |
| 62 | const result = executeSql(adapter, sql, { columnar: true, timing: true, maxRows: 0 }) |
| 63 | return { |
| 64 | columns: result.columns, |
| 65 | rows: result.rows as unknown[][], |
| 66 | rowCount: result.rowCount, |
| 67 | duration: result.duration ?? 0, |
| 68 | limited: result.truncated, |
| 69 | } |
| 70 | } catch (error) { |
| 71 | if (error instanceof Error) { |
| 72 | const message = error.message.replace(/^SQLITE_ERROR: /, '').replace(/^SQLITE_READONLY: /, '') |
| 73 | throw new Error(message) |
| 74 | } |
| 75 | throw error |
| 76 | } |
| 77 | } |
no test coverage detected