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

Method GetTable

storage/connect/tabjson.cpp:685–809  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

683/* GetTable: makes a new Table Description Block. */
684/***********************************************************************/
685PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
686{
687 if (trace(1))
688 htrc("JSON GetTable Pretty=%d Uri=%s\n", Pretty, SVP(Uri));
689
690 if (Catfunc == FNC_COL)
691 return new(g)TDBJCL(this);
692
693 PTDBASE tdbp;
694 PTXF txfp = NULL;
695
696 // JSN not used for pretty=1 for insert or delete
697 if (Pretty <= 0 || (Pretty == 1 && (m == MODE_READ || m == MODE_UPDATE))) {
698 USETEMP tmp = UseTemp();
699 bool map = Mapped && Pretty >= 0 && m != MODE_INSERT &&
700 !(tmp != TMP_NO && m == MODE_UPDATE) &&
701 !(tmp == TMP_FORCE &&
702 (m == MODE_UPDATE || m == MODE_DELETE));
703
704 if (Uri) {
705 if (Driver && toupper(*Driver) == 'C') {
706#if defined(CMGO_SUPPORT)
707 txfp = new(g) CMGFAM(this);
708#else
709 snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C");
710 return NULL;
711#endif
712 } else if (Driver && toupper(*Driver) == 'J') {
713#if defined(JAVA_SUPPORT)
714 txfp = new(g) JMGFAM(this);
715#else
716 snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java");
717 return NULL;
718#endif
719 } else { // Driver not specified
720#if defined(CMGO_SUPPORT)
721 txfp = new(g) CMGFAM(this);
722#elif defined(JAVA_SUPPORT)
723 txfp = new(g) JMGFAM(this);
724#else // !MONGO_SUPPORT
725 snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO");
726 return NULL;
727#endif // !MONGO_SUPPORT
728 } // endif Driver
729
730 Pretty = 4; // Not a file
731 } else if (Zipped) {
732#if defined(ZIP_SUPPORT)
733 if (m == MODE_READ || m == MODE_ANY || m == MODE_ALTER) {
734 txfp = new(g) UNZFAM(this);
735 } else if (m == MODE_INSERT) {
736 txfp = new(g) ZIPFAM(this);
737 } else {
738 safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP");
739 return NULL;
740 } // endif's m
741#else // !ZIP_SUPPORT
742 snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "ZIP");

Callers

nothing calls this directly

Calls 6

UseTempFunction · 0.85
safe_strcpyFunction · 0.85
PlugSubAllocFunction · 0.85
PlugSubSetFunction · 0.85
PlugInitFunction · 0.85
htrcFunction · 0.70

Tested by

no test coverage detected