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

Method dumpData

examples/replication/fbSampleReplicator.cpp:312–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312bool ReplTransaction::dumpData(IReplicatedRecord* record)
313{
314 for (unsigned i = 0; i < record->getCount(); i++)
315 {
316 IReplicatedField* field = record->getField(i);
317 if (field == nullptr)
318 {
319 WriteLog(parent->log, "\t\tNO FIELD %u FOUND\n", i);
320 continue;
321 }
322 unsigned fieldType = field->getType();
323
324 WriteLog(parent->log, "\tfield %u (%s), type %u:\n", i, field->getName(), fieldType);
325
326 const void* fieldData = field->getData();
327 if (fieldData == nullptr)
328 {
329 WriteLog(parent->log, "\t\tNULL\n");
330 }
331 else
332 {
333 switch (fieldType)
334 {
335 case SQL_TEXT:
336 {
337 unsigned length = field->getLength();
338 unsigned charSet = field->getCharSet();
339
340 if (charSet == 1) // OCTETS
341 {
342 WriteLog(parent->log, "\t\tBINARY data length %u: ", length);
343 const unsigned char* data = reinterpret_cast<const unsigned char*>(fieldData);
344 for (unsigned j = 0; j < length; j++)
345 WriteLog(parent->log, "%02u", *data++);
346 WriteLog(parent->log, "\n");
347 }
348 else
349 WriteLog(parent->log, "\t\tTEXT with charset %u, length %u: \"%.*s\"\n", charSet, length, length, reinterpret_cast<const char*>(fieldData));
350
351 break;
352 }
353 case SQL_VARYING:
354 {
355 unsigned charSet = field->getCharSet();
356 const paramvary* data = static_cast<const paramvary*>(fieldData);
357
358 if (charSet == 1) // OCTETS
359 {
360 fprintf(parent->log, "\t\tVARBINARY data length %u: ", data->vary_length);
361 for (unsigned j = 0; j < data->vary_length; j++)
362 fprintf(parent->log, "%02u", data->vary_string[j]);
363 WriteLog(parent->log, "\n");
364 }
365 else
366 WriteLog(parent->log, "\t\tVARCHAR with charset %u, length %u: \"%.*s\"\n", charSet, data->vary_length, data->vary_length, data->vary_string);
367
368 break;
369 }

Callers

nothing calls this directly

Calls 15

blobClass · 0.85
getCountMethod · 0.45
getFieldMethod · 0.45
getTypeMethod · 0.45
getNameMethod · 0.45
getDataMethod · 0.45
getLengthMethod · 0.45
getCharSetMethod · 0.45
getScaleMethod · 0.45
getSubTypeMethod · 0.45
openBlobMethod · 0.45
getStateMethod · 0.45

Tested by

no test coverage detected