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

Method OpenDB

storage/connect/tabmul.cpp:373–421  ·  view source on GitHub ↗

/ MUL Access Method opening routine. */ Open first file, other will be opened sequencially when reading. */ /

Source from the content-addressed store, hash-verified

371/* Open first file, other will be opened sequencially when reading. */
372/***********************************************************************/
373bool TDBMUL::OpenDB(PGLOBAL g)
374 {
375 if (trace(1))
376 htrc("MUL OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n",
377 this, Tdb_No, Use, To_Key_Col, Mode);
378
379 if (Use == USE_OPEN) {
380 /*******************************************************************/
381 /* Table already open, replace it at its beginning. */
382 /*******************************************************************/
383 if (Filenames[iFile = 0]) {
384 Tdbp->CloseDB(g);
385 Tdbp->SetUse(USE_READY);
386 Tdbp->SetFile(g, Filenames[iFile = 0]);
387 Tdbp->ResetSize();
388 Rows = 0;
389 ResetDB();
390 return Tdbp->OpenDB(g); // Re-open with new file name
391 } else
392 return false;
393
394 } // endif use
395
396 /*********************************************************************/
397 /* We need to calculate MaxSize before opening the query. */
398 /*********************************************************************/
399 if (GetMaxSize(g) < 0)
400 return true;
401
402 /*********************************************************************/
403 /* Open the first table file of the list. */
404 /*********************************************************************/
405//if (!Filenames && InitFileNames(g)) // was done in GetMaxSize
406// return true;
407
408 if (Filenames[iFile = 0]) {
409 Tdbp->SetFile(g, Filenames[0]);
410 Tdbp->SetMode(Mode);
411 Tdbp->ResetDB();
412 Tdbp->ResetSize();
413
414 if (Tdbp->OpenDB(g))
415 return true;
416
417 } // endif *Filenames
418
419 Use = USE_OPEN;
420 return false;
421 } // end of OpenDB
422
423/***********************************************************************/
424/* ReadDB: Data Base read routine for MUL access method. */

Callers 2

InitFileNamesMethod · 0.45
ReadDBMethod · 0.45

Calls 10

SetUseFunction · 0.85
PlugSubAllocFunction · 0.85
htrcFunction · 0.70
ResetDBFunction · 0.70
GetMaxSizeFunction · 0.70
CloseDBFunction · 0.70
CloseDBMethod · 0.45
SetFileMethod · 0.45
ResetSizeMethod · 0.45
ResetDBMethod · 0.45

Tested by

no test coverage detected