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

Function isMetadataObject

src/utils/multi-statement-result-parser.ts:17–27  ·  view source on GitHub ↗

* Checks if an element is a metadata object from INSERT/UPDATE/DELETE operations * rather than a row array from SELECT queries. * * Different drivers use different property names for metadata: * - MariaDB: affectedRows, warningStatus, insertId * - MySQL2: affectedRows, insertId, fieldCount, Res

(element: any)

Source from the content-addressed store, hash-verified

15 * - MySQL2: affectedRows, insertId, fieldCount, ResultSetHeader type
16 */
17function isMetadataObject(element: any): boolean {
18 if (!element || typeof element !== 'object' || Array.isArray(element)) {
19 return false;
20 }
21
22 // Check for common metadata properties that indicate this is not a row array
23 return 'affectedRows' in element ||
24 'insertId' in element ||
25 'fieldCount' in element ||
26 'warningStatus' in element;
27}
28
29/**
30 * Checks if results appear to be from a multi-statement query.

Callers 2

isMultiStatementResultFunction · 0.85
extractAffectedRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected