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

Method GetAllSizes

storage/connect/xindex.cpp:1421–1580  ·  view source on GitHub ↗

/ Get Ndif and Num_K from the index file. */ /

Source from the content-addressed store, hash-verified

1419/* Get Ndif and Num_K from the index file. */
1420/***********************************************************************/
1421bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk)
1422 {
1423 PCSZ ftype;
1424 char fn[_MAX_PATH];
1425 int nv[NZ], id = -1; // n
1426//bool estim = false;
1427 bool rc = true;
1428 PDOSDEF defp = (PDOSDEF)Tdbp->To_Def;
1429
1430// ndif = numk = 0;
1431 numk = 0;
1432
1433#if 0
1434 /*********************************************************************/
1435 /* Get the estimated table size. */
1436 /* Note: for fixed tables we must use cardinality to avoid the call */
1437 /* to MaxBlkSize that could reduce the cardinality value. */
1438 /*********************************************************************/
1439 if (Tdbp->Cardinality(NULL)) {
1440 // For DBF tables, Cardinality includes bad or soft deleted lines
1441 // that are not included in the index, and can be larger then the
1442 // index size.
1443 estim = (Tdbp->Ftype == RECFM_DBF);
1444 n = Tdbp->Cardinality(g); // n is exact table size
1445 } else {
1446 // Variable table not optimized
1447 estim = true; // n is an estimate of the size
1448 n = Tdbp->GetMaxSize(g);
1449 } // endif Cardinality
1450
1451 if (n <= 0)
1452 return !(n == 0); // n < 0 error, n = 0 void table
1453
1454 /*********************************************************************/
1455 /* Check the key part number. */
1456 /*********************************************************************/
1457 if (!Nk) {
1458 strcpy(g->Message, MSG(NO_KEY_COL));
1459 return true; // Error
1460 } // endif Nk
1461#endif // 0
1462
1463 switch (Tdbp->Ftype) {
1464 case RECFM_VAR: ftype = ".dnx"; break;
1465 case RECFM_FIX: ftype = ".fnx"; break;
1466 case RECFM_BIN: ftype = ".bnx"; break;
1467 case RECFM_VCT: ftype = ".vnx"; break;
1468 case RECFM_CSV: ftype = ".cnx"; break;
1469 case RECFM_DBF: ftype = ".dbx"; break;
1470 default:
1471 snprintf(g->Message, sizeof(g->Message), MSG(INVALID_FTYPE), Tdbp->Ftype);
1472 return true;
1473 } // endswitch Ftype
1474
1475 if (defp->SepIndex()) {
1476 // Index was saved in a separate file
1477#if defined(_WIN32)
1478 char drive[_MAX_DRIVE];

Callers 1

CardinalityMethod · 0.80

Calls 15

_splitpathFunction · 0.85
safe_strcatFunction · 0.85
_makepathFunction · 0.85
PlugRemoveTypeFunction · 0.85
SeekMethod · 0.80
PlugSetPathFunction · 0.70
htrcFunction · 0.70
CardinalityMethod · 0.45
GetMaxSizeMethod · 0.45
GetNameMethod · 0.45
GetPathMethod · 0.45
OpenMethod · 0.45

Tested by

no test coverage detected