| 51 | * @returns Array containing only the rows from SELECT queries |
| 52 | */ |
| 53 | export function extractRowsFromMultiStatement(results: any): any[] { |
| 54 | if (!Array.isArray(results)) { |
| 55 | return []; |
| 56 | } |
| 57 | |
| 58 | const allRows: any[] = []; |
| 59 | |
| 60 | for (const result of results) { |
| 61 | if (Array.isArray(result)) { |
| 62 | // This is a row array from a SELECT query - add all rows |
| 63 | allRows.push(...result); |
| 64 | } |
| 65 | // Skip metadata objects from INSERT/UPDATE/DELETE |
| 66 | } |
| 67 | |
| 68 | return allRows; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Extracts total affected rows from query results. |