()
| 87 | } |
| 88 | |
| 89 | _closePortal() { |
| 90 | if (this.state === 'done') return |
| 91 | |
| 92 | // because we opened a named portal to stream results |
| 93 | // we need to close the same named portal. Leaving a named portal |
| 94 | // open can lock tables for modification if inside a transaction. |
| 95 | // see https://github.com/brianc/node-pg-cursor/issues/56 |
| 96 | this.connection.close({ type: 'P', name: this._portal }) |
| 97 | |
| 98 | // If we've received an error we already sent a sync message. |
| 99 | // do not send another sync as it triggers another readyForQuery message. |
| 100 | if (this.state !== 'error') { |
| 101 | this.connection.sync() |
| 102 | } |
| 103 | |
| 104 | this.state = 'done' |
| 105 | } |
| 106 | |
| 107 | handleRowDescription(msg) { |
| 108 | this._result.addFields(msg.fields) |
no test coverage detected