MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / getStatementInfo

Function getStatementInfo

lib/tracker/request-logger.js:167–186  ·  view source on GitHub ↗
(query, parameters, execOptions, options)

Source from the content-addressed store, hash-verified

165}
166
167function 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
188function getBatchStatementInfo(queries, execOptions, maxQueryLength, maxParameterLength) {
189 // This part of the message is not accounted for in "maxQueryLength"

Callers 5

_logSlowMethod · 0.85
_logLargeRequestMethod · 0.85
_logNormalRequestMethod · 0.85
_logLargeErrorRequestMethod · 0.85
_logErrorRequestMethod · 0.85

Calls 3

getBatchStatementInfoFunction · 0.85
getParametersInfoFunction · 0.85
isPreparedMethod · 0.65

Tested by

no test coverage detected