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

Method GetColumns

storage/connect/tabbson.cpp:168–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166} // end of BSONDISC constructor
167
168int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
169{
170 char filename[_MAX_PATH];
171 bool mgo = (GetTypeID(topt->type) == TAB_MONGO);
172 PBVAL bdp = NULL;
173
174 lvl = GetIntegerTableOption(g, topt, "Level", GetDefaultDepth());
175 lvl = GetIntegerTableOption(g, topt, "Depth", lvl);
176 sep = GetStringTableOption(g, topt, "Separator", ".");
177 sz = GetIntegerTableOption(g, topt, "Jsize", 1024);
178 limit = GetIntegerTableOption(g, topt, "Limit", 50);
179 strfy = GetStringTableOption(g, topt, "Stringify", NULL);
180
181 /*********************************************************************/
182 /* Open the input file. */
183 /*********************************************************************/
184 tdp = new(g) BSONDEF;
185 tdp->G = NULL;
186#if defined(ZIP_SUPPORT)
187 tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
188 tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false);
189#endif // ZIP_SUPPORT
190 tdp->Fn = GetStringTableOption(g, topt, "Filename", NULL);
191
192 if (!tdp->Fn && topt->http)
193 tdp->Fn = GetStringTableOption(g, topt, "Subtype", NULL);
194
195 if (!(tdp->Database = SetPath(g, db)))
196 return 0;
197
198 if ((tdp->Objname = GetStringTableOption(g, topt, "Object", NULL))) {
199 if (*tdp->Objname == '$') tdp->Objname++;
200 if (*tdp->Objname == '.') tdp->Objname++;
201 } // endif Objname
202
203 tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
204 tdp->Pretty = GetIntegerTableOption(g, topt, "Pretty", 2);
205 tdp->Xcol = GetStringTableOption(g, topt, "Expand", NULL);
206 tdp->Accept = GetBooleanTableOption(g, topt, "Accept", false);
207 tdp->Uri = (dsn && *dsn ? dsn : NULL);
208
209 if (!tdp->Fn && !tdp->Uri) {
210 safe_strcpy(g->Message, sizeof(g->Message), MSG(MISSING_FNAME));
211 return 0;
212 } else
213 topt->subtype = NULL;
214
215 if (tdp->Fn) {
216 // We used the file name relative to recorded datapath
217 PlugSetPath(filename, tdp->Fn, tdp->GetPath());
218 tdp->Fn = PlugDup(g, filename);
219 } // endif Fn
220
221 if (trace(1))
222 htrc("File %s objname=%s pretty=%d lvl=%d\n",
223 tdp->Fn, tdp->Objname, tdp->Pretty, lvl);
224
225 if (tdp->Uri) {

Callers 2

BSONColumnsFunction · 0.45
ParseJpathMethod · 0.45

Calls 15

GetTypeIDFunction · 0.85
GetIntegerTableOptionFunction · 0.85
GetDefaultDepthFunction · 0.85
GetStringTableOptionFunction · 0.85
GetBooleanTableOptionFunction · 0.85
SetPathFunction · 0.85
safe_strcpyFunction · 0.85
PlugDupFunction · 0.85
PlugInitFunction · 0.85
GetKeyMethod · 0.80
GetVlpMethod · 0.80
PlugSetPathFunction · 0.70

Tested by

no test coverage detected