| 1651 | * that splitting on every space would. |
| 1652 | */ |
| 1653 | const parseCommandTag = (tag: string): { command: string; rowCount: number; oid: number | null } => { |
| 1654 | const firstSpace = tag.indexOf(" ") |
| 1655 | if (firstSpace < 0) return { command: tag, oid: null, rowCount: 0 } |
| 1656 | const command = tag.slice(0, firstSpace) |
| 1657 | const secondSpace = tag.indexOf(" ", firstSpace + 1) |
| 1658 | if (command === "INSERT" && secondSpace > 0) { |
| 1659 | return { |
| 1660 | command, |
| 1661 | oid: Number(tag.slice(firstSpace + 1, secondSpace)), |
| 1662 | rowCount: Number(tag.slice(secondSpace + 1)) |
| 1663 | } |
| 1664 | } |
| 1665 | const last = tag.slice((secondSpace < 0 ? firstSpace : secondSpace) + 1) |
| 1666 | return { command, oid: null, rowCount: isDigits(last) ? Number(last) : 0 } |
| 1667 | } |
| 1668 | |
| 1669 | const isDigits = (value: string): boolean => { |
| 1670 | if (value.length === 0) return false |