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