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

Method GetBlockValues

storage/connect/tabdos.cpp:1015–1216  ·  view source on GitHub ↗

/ Read the Min/Max values for this table. */ The problem here is to avoid name duplication, because more than */ one data file can have the same name (but different types) and/or */ the same data file can be used with different block sizes. This is */ why we use Ofn that defaults to the file name but can be set to a */ different name if necessary.

Source from the content-addressed store, hash-verified

1013/* different name if necessary. */
1014/***********************************************************************/
1015bool TDBDOS::GetBlockValues(PGLOBAL g)
1016 {
1017 char filename[_MAX_PATH];
1018 int i, lg, n[NZ];
1019 int nrec, block = 0, last = 0;
1020 int len;
1021 bool newblk = false;
1022 size_t ndv, nbm, nbk, blk;
1023 FILE *opfile;
1024 PCOLDEF cdp;
1025 PDOSDEF defp = (PDOSDEF)To_Def;
1026 PDBUSER dup = PlgGetUser(g);
1027
1028 (void) defp->GetCat(); // XXX Should be removed?
1029
1030
1031#if 0
1032 if (Mode == MODE_INSERT && Txfp->GetAmType() == TYPE_AM_DOS)
1033 return false;
1034#endif // _WIN32
1035
1036 if (defp->Optimized || !(dup->Check & CHK_OPT))
1037 return false; // Already done or to be redone
1038
1039 if (Ftype == RECFM_VAR || defp->Compressed == 2) {
1040 /*******************************************************************/
1041 /* Variable length file that can be read by block. */
1042 /*******************************************************************/
1043 nrec = (defp->GetElemt()) ? defp->GetElemt() : 1;
1044
1045 if (nrec > 1) {
1046 // The table can be declared optimized if it is void.
1047 // This is useful to handle Insert in optimized mode.
1048 char filename[_MAX_PATH];
1049 int h;
1050 int flen = -1;
1051
1052 PlugSetPath(filename, defp->Fn, GetPath());
1053 h = open(filename, O_RDONLY);
1054 flen = (h == -1 && errno == ENOENT) ? 0 : _filelength(h);
1055
1056 if (h != -1)
1057 close(h);
1058
1059 if (!flen) {
1060 defp->SetOptimized(1);
1061 return false;
1062 } // endif flen
1063
1064 } else
1065 return false; // Not optimisable
1066
1067 cdp = defp->GetCols();
1068 i = 1;
1069 } else {
1070 /*******************************************************************/
1071 /* Fixed length file. Opt file exists only for clustered columns. */
1072 /*******************************************************************/

Callers 3

GetTableMethod · 0.80
GetTableMethod · 0.80
GetTableMethod · 0.80

Calls 12

PlgGetUserFunction · 0.85
_filelengthFunction · 0.85
PlugSubAllocFunction · 0.85
GetCatMethod · 0.80
GetOptFileNameMethod · 0.80
SetMinMethod · 0.80
SetMaxMethod · 0.80
RemoveOptValuesMethod · 0.80
PlugSetPathFunction · 0.70
CardinalityFunction · 0.70
GetAmTypeMethod · 0.45
GetNextMethod · 0.45

Tested by

no test coverage detected