MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / parse

Method parse

src/common/StatementMetadata.cpp:239–412  ·  view source on GitHub ↗

Parse an info response buffer.

Source from the content-addressed store, hash-verified

237
238// Parse an info response buffer.
239void StatementMetadata::parse(unsigned bufferLength, const UCHAR* buffer)
240{
241 const UCHAR* bufferEnd = buffer + bufferLength;
242 Parameters* parameters = NULL;
243 bool finish = false;
244 UCHAR c;
245
246 while (!finish && buffer < bufferEnd && (c = *buffer++) != isc_info_end)
247 {
248 switch (c)
249 {
250 case isc_info_sql_stmt_type:
251 type = getNumericInfo(&buffer, bufferEnd);
252 break;
253
254 case isc_info_sql_stmt_flags:
255 flags = getNumericInfo(&buffer, bufferEnd);
256 break;
257
258 case isc_info_sql_get_plan:
259 case isc_info_sql_explain_plan:
260 {
261 string* plan = (c == isc_info_sql_explain_plan ? &detailedPlan : &legacyPlan);
262 getStringInfo(&buffer, bufferEnd, plan);
263 break;
264 }
265
266 case isc_info_sql_select:
267 parameters = outputParameters;
268 break;
269
270 case isc_info_sql_bind:
271 parameters = inputParameters;
272 break;
273
274 case isc_info_sql_num_variables:
275 case isc_info_sql_describe_vars:
276 {
277 if (!parameters)
278 {
279 finish = true;
280 break;
281 }
282
283 getNumericInfo(&buffer, bufferEnd); // skip the message index
284
285 if (c == isc_info_sql_num_variables)
286 continue;
287
288 Parameters::Item temp(*getDefaultMemoryPool());
289 Parameters::Item* param = &temp;
290 bool finishDescribe = false;
291
292 // Loop over the variables being described.
293 while (!finishDescribe)
294 {
295 fb_assert(buffer < bufferEnd);
296

Callers

nothing calls this directly

Calls 6

getNumericInfoFunction · 0.85
getStringInfoFunction · 0.85
getDefaultMemoryPoolFunction · 0.85
makeOffsetsMethod · 0.80
getCountMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected