(q)
| 156 | } |
| 157 | |
| 158 | function execute(q) { |
| 159 | if (terminated) |
| 160 | return queryError(q, Errors.connection('CONNECTION_DESTROYED', options)) |
| 161 | |
| 162 | if (stream) |
| 163 | return queryError(q, Errors.generic('COPY_IN_PROGRESS', 'You cannot execute queries during copy')) |
| 164 | |
| 165 | if (q.cancelled) |
| 166 | return |
| 167 | |
| 168 | try { |
| 169 | q.state = backend |
| 170 | query |
| 171 | ? sent.push(q) |
| 172 | : (query = q, query.active = true) |
| 173 | |
| 174 | build(q) |
| 175 | return write(toBuffer(q)) |
| 176 | && !q.describeFirst |
| 177 | && !q.cursorFn |
| 178 | && sent.length < max_pipeline |
| 179 | && (!q.options.onexecute || q.options.onexecute(connection)) |
| 180 | } catch (error) { |
| 181 | sent.length === 0 && write(Sync) |
| 182 | errored(error) |
| 183 | return true |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | function toBuffer(q) { |
| 188 | if (q.parameters.length >= 65534) |
no test coverage detected