MCPcopy Create free account
hub / github.com/MariaDB/server / BINCOL

Method BINCOL

storage/connect/tabfix.cpp:380–441  ·  view source on GitHub ↗

/ BINCOL public constructor. */ /

Source from the content-addressed store, hash-verified

378/* BINCOL public constructor. */
379/***********************************************************************/
380BINCOL::BINCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PCSZ am)
381 : DOSCOL(g, cdp, tp, cp, i, am)
382 {
383 char c, *fmt = cdp->GetFmt();
384
385 Fmt = GetDomain() ? 'C' : 'X';
386 Buff = NULL;
387 Eds = ((PTDBFIX)tp)->Teds;
388 N = 0;
389 M = GetTypeSize(Buf_Type, sizeof(longlong));
390 Lim = 0;
391
392 if (fmt) {
393 for (N = 0, i = 0; fmt[i]; i++) {
394 c = toupper(fmt[i]);
395
396 if (isdigit(c))
397 N = (N * 10 + (c - '0'));
398 else if (c == 'L' || c == 'B' || c == 'H')
399 Eds = c;
400 else
401 Fmt = c;
402
403 } // endfor i
404
405 // M is the size of the source value
406 switch (Fmt) {
407 case 'C': Eds = 0; break;
408 case 'X': break;
409 case 'S': M = sizeof(short); break;
410 case 'T': M = sizeof(char); break;
411 case 'I': M = sizeof(int); break;
412 case 'G': M = sizeof(longlong); break;
413 case 'R': // Real
414 case 'F': M = sizeof(float); break;
415 case 'D': M = sizeof(double); break;
416 default:
417 snprintf(g->Message, sizeof(g->Message), MSG(BAD_BIN_FMT), Fmt, Name);
418 throw 11;
419 } // endswitch Fmt
420
421 } else if (IsTypeChar(Buf_Type))
422 Eds = 0;
423
424 if (Eds) {
425 // This is a byte order specification
426 if (!N)
427 N = M;
428
429 if (Eds != 'L' && Eds != 'B')
430 Eds = Endian;
431
432 if (N != M || Eds != Endian || IsTypeChar(Buf_Type)) {
433 Buff = (char*)PlugSubAlloc(g, NULL, M);
434 memset(Buff, 0, M);
435 Lim = MY_MIN(N, M);
436 } else
437 Eds = 0; // New format is a no op

Callers

nothing calls this directly

Calls 4

GetDomainFunction · 0.85
GetTypeSizeFunction · 0.85
IsTypeCharFunction · 0.85
PlugSubAllocFunction · 0.85

Tested by

no test coverage detected