MCPcopy Create free account
hub / github.com/bytebase/dbhub / extractRowsFromMultiStatement

Function extractRowsFromMultiStatement

src/utils/multi-statement-result-parser.ts:53–69  ·  view source on GitHub ↗
(results: any)

Source from the content-addressed store, hash-verified

51 * @returns Array containing only the rows from SELECT queries
52 */
53export 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.

Callers 1

parseQueryResultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected