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

Method write

lib/requests.js:259–286  ·  view source on GitHub ↗
(encoder, streamId)

Source from the content-addressed store, hash-verified

257 }
258
259 write(encoder, streamId) {
260 //v1: <query><consistency>
261 //v2: <query>
262 // <consistency><flags>[<n><value_1>...<value_n>][<result_page_size>][<paging_state>][<serial_consistency>]
263 //v3: <query>
264 // <consistency><flags>[<n>[name_1]<value_1>...[name_n]<value_n>][<result_page_size>][<paging_state>][<serial_consistency>][<timestamp>]
265 const frameWriter = new FrameWriter(types.opcodes.query);
266 let headerFlags = this.options.isQueryTracing() ? types.frameFlags.tracing : 0;
267 if (this.options.getCustomPayload()) {
268 //The body may contain the custom payload
269 headerFlags |= types.frameFlags.customPayload;
270 frameWriter.writeCustomPayload(this.options.getCustomPayload());
271 }
272
273 frameWriter.writeLString(this.query);
274
275 if (!types.protocolVersion.supportsPaging(encoder.protocolVersion)) {
276 frameWriter.writeShort(this.consistency);
277 } else {
278 //Use the same fields as the execute writer
279 this.writeQueryParameters(frameWriter, encoder, true);
280 }
281
282 // Record the length of the body of the request before writing it
283 this.length = frameWriter.bodyLength;
284
285 return frameWriter.write(encoder.protocolVersion, streamId, headerFlags);
286 }
287}
288
289class PrepareRequest extends Request {

Callers

nothing calls this directly

Calls 7

writeCustomPayloadMethod · 0.95
writeLStringMethod · 0.95
writeShortMethod · 0.95
writeMethod · 0.95
writeQueryParametersMethod · 0.80
isQueryTracingMethod · 0.65
getCustomPayloadMethod · 0.65

Tested by

no test coverage detected