/ DOS Access Method opening routine. */ New method now that this routine is called recursively (last table */ first in reverse order): index blocks are immediately linked to */ join block of next table if it exists or else are discarted. */ /
| 2127 | /* join block of next table if it exists or else are discarted. */ |
| 2128 | /***********************************************************************/ |
| 2129 | bool TDBDOS::OpenDB(PGLOBAL g) |
| 2130 | { |
| 2131 | if (trace(1)) |
| 2132 | htrc("DOS OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", |
| 2133 | this, Tdb_No, Use, Mode); |
| 2134 | |
| 2135 | if (Use == USE_OPEN) { |
| 2136 | /*******************************************************************/ |
| 2137 | /* Table already open, just replace it at its beginning. */ |
| 2138 | /*******************************************************************/ |
| 2139 | if (!To_Kindex) { |
| 2140 | Txfp->Rewind(); // see comment in Work.log |
| 2141 | |
| 2142 | if (SkipHeader(g)) |
| 2143 | return true; |
| 2144 | |
| 2145 | } else |
| 2146 | /*****************************************************************/ |
| 2147 | /* Table is to be accessed through a sorted index table. */ |
| 2148 | /*****************************************************************/ |
| 2149 | To_Kindex->Reset(); |
| 2150 | |
| 2151 | ResetBlockFilter(g); |
| 2152 | return false; |
| 2153 | } // endif use |
| 2154 | |
| 2155 | if (Mode == MODE_DELETE && !Next && Txfp->GetAmType() != TYPE_AM_DOS |
| 2156 | #if defined(BSON_SUPPORT) |
| 2157 | && Txfp->GetAmType() != TYPE_AM_BIN |
| 2158 | #endif // BSON_SUPPORT |
| 2159 | && Txfp->GetAmType() != TYPE_AM_MGO) { |
| 2160 | // Delete all lines. Not handled in MAP or block mode |
| 2161 | Txfp = new(g) DOSFAM((PDOSDEF)To_Def); |
| 2162 | Txfp->SetTdbp(this); |
| 2163 | } else if (Txfp->Blocked && (Mode == MODE_DELETE || |
| 2164 | (Mode == MODE_UPDATE && UseTemp() != TMP_NO))) { |
| 2165 | /*******************************************************************/ |
| 2166 | /* Delete is not currently handled in block mode neither Update */ |
| 2167 | /* when using a temporary file. */ |
| 2168 | /*******************************************************************/ |
| 2169 | if (Txfp->GetAmType() == TYPE_AM_MAP && Mode == MODE_DELETE) |
| 2170 | Txfp = new(g) MAPFAM((PDOSDEF)To_Def); |
| 2171 | #if defined(GZ_SUPPORT) |
| 2172 | else if (Txfp->GetAmType() == TYPE_AM_GZ) |
| 2173 | Txfp = new(g) GZFAM((PDOSDEF)To_Def); |
| 2174 | #endif // GZ_SUPPORT |
| 2175 | else // if (Txfp->GetAmType() != TYPE_AM_DOS) ??? |
| 2176 | Txfp = new(g) DOSFAM((PDOSDEF)To_Def); |
| 2177 | |
| 2178 | Txfp->SetTdbp(this); |
| 2179 | } // endif Mode |
| 2180 | |
| 2181 | /*********************************************************************/ |
| 2182 | /* Open according to logical input/output mode required. */ |
| 2183 | /* Use conventionnal input/output functions. */ |
| 2184 | /* Treat files as binary in Delete mode (for line moving) */ |
| 2185 | /*********************************************************************/ |
| 2186 | if (Txfp->OpenTableFile(g)) |
nothing calls this directly
no test coverage detected