(query, parameters, execOptions, options)
| 165 | } |
| 166 | |
| 167 | function getStatementInfo(query, parameters, execOptions, options) { |
| 168 | const maxQueryLength = options.messageMaxQueryLength || defaultMessageMaxQueryLength; |
| 169 | const maxParameterLength = options.messageMaxParameterValueLength || defaultMaxParameterValueLength; |
| 170 | |
| 171 | if (Array.isArray(query)) { |
| 172 | return getBatchStatementInfo(query, execOptions, maxQueryLength, maxParameterLength); |
| 173 | } |
| 174 | |
| 175 | // String concatenation is usually faster than Array#join() in V8 |
| 176 | let message = query.substr(0, maxQueryLength); |
| 177 | const remaining = maxQueryLength - message.length - 1; |
| 178 | message += getParametersInfo(parameters, remaining, maxParameterLength); |
| 179 | |
| 180 | if (!execOptions.isPrepared()) { |
| 181 | // This part of the message is not accounted for in "maxQueryLength" |
| 182 | message += ' (not prepared)'; |
| 183 | } |
| 184 | |
| 185 | return message; |
| 186 | } |
| 187 | |
| 188 | function getBatchStatementInfo(queries, execOptions, maxQueryLength, maxParameterLength) { |
| 189 | // This part of the message is not accounted for in "maxQueryLength" |
no test coverage detected