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

Method write

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

Source from the content-addressed store, hash-verified

136 }
137
138 write(encoder, streamId) {
139 //v1: <queryId>
140 // <n><value_1>....<value_n><consistency>
141 //v2: <queryId>
142 // <consistency><flags>[<n><value_1>...<value_n>][<result_page_size>][<paging_state>][<serial_consistency>]
143 //v3: <queryId>
144 // <consistency><flags>[<n>[name_1]<value_1>...[name_n]<value_n>][<result_page_size>][<paging_state>][<serial_consistency>][<timestamp>]
145 const frameWriter = new FrameWriter(types.opcodes.execute);
146 let headerFlags = this.options.isQueryTracing() ? types.frameFlags.tracing : 0;
147 if (this.options.getCustomPayload()) {
148 //The body may contain the custom payload
149 headerFlags |= types.frameFlags.customPayload;
150 frameWriter.writeCustomPayload(this.options.getCustomPayload());
151 }
152 frameWriter.writeShortBytes(this.queryId);
153 if(types.protocolVersion.supportsResultMetadataId(encoder.protocolVersion)) {
154 frameWriter.writeShortBytes(this.meta.resultId);
155 }
156 this.writeQueryParameters(frameWriter, encoder);
157
158 // Record the length of the body of the request before writing it
159 this.length = frameWriter.bodyLength;
160
161 return frameWriter.write(encoder.protocolVersion, streamId, headerFlags);
162 }
163
164 /**
165 * Writes v1 and v2 execute query parameters

Callers

nothing calls this directly

Calls 6

writeCustomPayloadMethod · 0.95
writeShortBytesMethod · 0.95
writeQueryParametersMethod · 0.95
writeMethod · 0.95
isQueryTracingMethod · 0.65
getCustomPayloadMethod · 0.65

Tested by

no test coverage detected