MCPcopy Index your code
hub / github.com/brianc/node-postgres / _closePortal

Method _closePortal

packages/pg-cursor/index.js:89–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers 2

handleCommandCompleteMethod · 0.95
closeMethod · 0.95

Calls 2

syncMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected