( rows: any[], columns: string[], )
| 549 | } |
| 550 | |
| 551 | function sqliteRowsToObjects( |
| 552 | rows: any[], |
| 553 | columns: string[], |
| 554 | ): Record<string, unknown>[] { |
| 555 | return rows.map((row) => { |
| 556 | if (!Array.isArray(row) && row && typeof row === "object") { |
| 557 | return { ...row }; |
| 558 | } |
| 559 | const obj: Record<string, unknown> = {}; |
| 560 | for (let i = 0; i < columns.length; i++) { |
| 561 | obj[columns[i]] = row[i]; |
| 562 | } |
| 563 | return obj; |
| 564 | }); |
| 565 | } |
| 566 | |
| 567 | export default async function dbExec(args: string[]): Promise<void> { |
| 568 | const parsed = parseArgs(args); |