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

Method GetTable

storage/connect/tabbson.cpp:1237–1349  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1235/* GetTable: makes a new Table Description Block. */
1236/***********************************************************************/
1237PTDB BSONDEF::GetTable(PGLOBAL g, MODE m)
1238{
1239 if (trace(1))
1240 htrc("BSON GetTable Pretty=%d Uri=%s\n", Pretty, SVP(Uri));
1241
1242 if (Catfunc == FNC_COL)
1243 return new(g)TDBBCL(this);
1244
1245 PTDBASE tdbp;
1246 PTXF txfp = NULL;
1247
1248 // JSN not used for pretty=1 for insert or delete
1249 if (Pretty <= 0 || (Pretty == 1 && (m == MODE_READ || m == MODE_UPDATE))) {
1250 USETEMP tmp = UseTemp();
1251 bool map = Mapped && Pretty >= 0 && m != MODE_INSERT &&
1252 !(tmp != TMP_NO && m == MODE_UPDATE) &&
1253 !(tmp == TMP_FORCE && (m == MODE_UPDATE || m == MODE_DELETE));
1254
1255 if (Lrecl) {
1256 // Allocate the parse work memory
1257 G = PlugInit(NULL, (size_t)Lrecl * (Pretty < 0 ? 3 : 5));
1258 } else {
1259 safe_strcpy(g->Message, sizeof(g->Message), "LRECL is not defined");
1260 return NULL;
1261 } // endif Lrecl
1262
1263 if (Pretty < 0) { // BJsonfile
1264 txfp = new(g) BINFAM(this);
1265 } else if (Uri) {
1266 if (Driver && toupper(*Driver) == 'C') {
1267#if defined(CMGO_SUPPORT)
1268 txfp = new(g) CMGFAM(this);
1269#else
1270 snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "C");
1271 return NULL;
1272#endif
1273 } else if (Driver && toupper(*Driver) == 'J') {
1274#if defined(JAVA_SUPPORT)
1275 txfp = new(g) JMGFAM(this);
1276#else
1277 snprintf(g->Message, sizeof(g->Message), "Mongo %s Driver not available", "Java");
1278 return NULL;
1279#endif
1280 } else { // Driver not specified
1281#if defined(CMGO_SUPPORT)
1282 txfp = new(g) CMGFAM(this);
1283#elif defined(JAVA_SUPPORT)
1284 txfp = new(g) JMGFAM(this);
1285#else // !MONGO_SUPPORT
1286 snprintf(g->Message, sizeof(g->Message), MSG(NO_FEAT_SUPPORT), "MONGO");
1287 return NULL;
1288#endif // !MONGO_SUPPORT
1289 } // endif Driver
1290
1291 Pretty = 4; // Not a file
1292 } else if (Zipped) {
1293#if defined(ZIP_SUPPORT)
1294 if (m == MODE_READ || m == MODE_ANY || m == MODE_ALTER) {

Callers

nothing calls this directly

Calls 4

UseTempFunction · 0.85
PlugInitFunction · 0.85
safe_strcpyFunction · 0.85
htrcFunction · 0.70

Tested by

no test coverage detected