| 2050 | * description carrying that column name falls back to the slow spelling. |
| 2051 | */ |
| 2052 | const makeRowBuilder = (fields: ReadonlyArray<PgProtocol.FieldDescription>): RowBuilder => { |
| 2053 | const names: Array<string> = new Array(fields.length) |
| 2054 | let hasProto = false |
| 2055 | for (let index = 0; index < fields.length; index++) { |
| 2056 | const name = fields[index].name |
| 2057 | names[index] = name |
| 2058 | if (name === "__proto__") hasProto = true |
| 2059 | } |
| 2060 | if (hasProto) { |
| 2061 | return (rowValues) => { |
| 2062 | const row: Record<string, unknown> = {} |
| 2063 | for (let index = 0; index < names.length; index++) { |
| 2064 | Object.defineProperty(row, names[index], { |
| 2065 | value: rowValues[index], |
| 2066 | enumerable: true, |
| 2067 | configurable: true, |
| 2068 | writable: true |
| 2069 | }) |
| 2070 | } |
| 2071 | return row |
| 2072 | } |
| 2073 | } |
| 2074 | return (rowValues) => { |
| 2075 | const row: Record<string, unknown> = {} |
| 2076 | for (let index = 0; index < names.length; index++) { |
| 2077 | row[names[index]] = rowValues[index] |
| 2078 | } |
| 2079 | return row |
| 2080 | } |
| 2081 | } |
| 2082 | |
| 2083 | const streamRows = ( |
| 2084 | conn: PgConnectionImpl, |