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

Method parseMetadata

src/dsql/DsqlRequests.cpp:230–320  ·  view source on GitHub ↗

Parse the message of a request.

Source from the content-addressed store, hash-verified

228
229// Parse the message of a request.
230USHORT DsqlRequest::parseMetadata(IMessageMetadata* meta, const Array<dsql_par*>& parameters_list)
231{
232 HalfStaticArray<const dsql_par*, 16> parameters;
233
234 for (FB_SIZE_T i = 0; i < parameters_list.getCount(); ++i)
235 {
236 dsql_par* param = parameters_list[i];
237
238 if (param->par_index)
239 {
240 if (param->par_index > parameters.getCount())
241 parameters.grow(param->par_index);
242 fb_assert(!parameters[param->par_index - 1]);
243 parameters[param->par_index - 1] = param;
244 }
245 }
246
247 // If there's no metadata, then the format of the current message buffer
248 // is identical to the format of the previous one.
249
250 if (!meta)
251 return parameters.getCount();
252
253 FbLocalStatus st;
254 unsigned count = meta->getCount(&st);
255 checkD(&st);
256
257 unsigned count2 = parameters.getCount();
258
259 if (count != count2)
260 {
261 ERRD_post(Arg::Gds(isc_dsql_sqlda_err) <<
262 Arg::Gds(isc_dsql_wrong_param_num) <<Arg::Num(count2) << Arg::Num(count));
263 }
264
265 unsigned offset = 0;
266
267 for (USHORT index = 0; index < count; index++)
268 {
269 unsigned sqlType = meta->getType(&st, index);
270 checkD(&st);
271 unsigned sqlLength = meta->getLength(&st, index);
272 checkD(&st);
273
274 dsc desc;
275 desc.dsc_flags = 0;
276
277 unsigned dataOffset, nullOffset, dtype, dlength;
278 offset = fb_utils::sqlTypeToDsc(offset, sqlType, sqlLength,
279 &dtype, &dlength, &dataOffset, &nullOffset);
280 desc.dsc_dtype = dtype;
281 desc.dsc_length = dlength;
282
283 desc.dsc_scale = meta->getScale(&st, index);
284 checkD(&st);
285 desc.dsc_sub_type = meta->getSubType(&st, index);
286 checkD(&st);
287 unsigned textType = meta->getCharSet(&st, index);

Callers 1

openMethod · 0.45

Calls 15

checkDFunction · 0.85
ERRD_postFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
sqlTypeToDscFunction · 0.85
setTextTypeMethod · 0.80
isTextMethod · 0.80
getTextTypeMethod · 0.80
getCountMethod · 0.45
growMethod · 0.45
getTypeMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected