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

Method GetTable

storage/connect/tabfmt.cpp:510–602  ·  view source on GitHub ↗

/ GetTable: makes a new Table Description Block. */ /

Source from the content-addressed store, hash-verified

508/* GetTable: makes a new Table Description Block. */
509/***********************************************************************/
510PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode)
511 {
512 PTDBASE tdbp;
513
514 if (Catfunc != FNC_COL) {
515 USETEMP tmp = UseTemp();
516 bool map = Mapped && mode != MODE_INSERT &&
517 !(tmp != TMP_NO && mode == MODE_UPDATE) &&
518 !(tmp == TMP_FORCE &&
519 (mode == MODE_UPDATE || mode == MODE_DELETE));
520 PTXF txfp;
521
522 /*******************************************************************/
523 /* Allocate a file processing class of the proper type. */
524 /*******************************************************************/
525 if (Zipped) {
526#if defined(ZIP_SUPPORT)
527 if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) {
528 txfp = new(g) UNZFAM(this);
529 } else if (mode == MODE_INSERT) {
530 txfp = new(g) ZIPFAM(this);
531 } else {
532 safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP");
533 return NULL;
534 } // endif's mode
535#else // !ZIP_SUPPORT
536 safe_strcpy(g->Message, sizeof(g->Message), "ZIP not supported");
537 return NULL;
538#endif // !ZIP_SUPPORT
539 } else if (map) {
540 // Should be now compatible with UNIX
541 txfp = new(g) MAPFAM(this);
542 } else if (Compressed) {
543#if defined(GZ_SUPPORT)
544 if (Compressed == 1)
545 txfp = new(g) GZFAM(this);
546 else
547 txfp = new(g) ZLBFAM(this);
548
549#else // !GZ_SUPPORT
550 safe_strcpy(g->Message, sizeof(g->Message), "Compress not supported");
551 return NULL;
552#endif // !GZ_SUPPORT
553 } else
554 txfp = new(g) DOSFAM(this);
555
556 /*******************************************************************/
557 /* Allocate a TDB of the proper type. */
558 /* Column blocks will be allocated only when needed. */
559 /*******************************************************************/
560 if (!Fmtd)
561 tdbp = new(g) TDBCSV(this, txfp);
562 else
563 tdbp = new(g) TDBFMT(this, txfp);
564
565 if (Multiple)
566 tdbp = new(g) TDBMUL(tdbp);
567 else

Callers

nothing calls this directly

Calls 5

UseTempFunction · 0.85
safe_strcpyFunction · 0.85
PushWarningFunction · 0.85
IsOptimizedFunction · 0.85
GetBlockValuesMethod · 0.80

Tested by

no test coverage detected