/ FIX Access Method opening routine (also used by the BIN a.m.) */ 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. */ /
| 294 | /* join block of next table if it exists or else are discarted. */ |
| 295 | /***********************************************************************/ |
| 296 | bool TDBFIX::OpenDB(PGLOBAL g) |
| 297 | { |
| 298 | if (trace(1)) |
| 299 | htrc("FIX OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d Ftype=%d\n", |
| 300 | this, Tdb_No, Use, To_Key_Col, Mode, Ftype); |
| 301 | |
| 302 | if (Use == USE_OPEN) { |
| 303 | /*******************************************************************/ |
| 304 | /* Table already open, just replace it at its beginning. */ |
| 305 | /*******************************************************************/ |
| 306 | if (To_Kindex) |
| 307 | /*****************************************************************/ |
| 308 | /* Table is to be accessed through a sorted index table. */ |
| 309 | /*****************************************************************/ |
| 310 | To_Kindex->Reset(); |
| 311 | else |
| 312 | Txfp->Rewind(); // see comment in Work.log |
| 313 | |
| 314 | ResetBlockFilter(g); |
| 315 | return false; |
| 316 | } // endif use |
| 317 | |
| 318 | if (Mode == MODE_DELETE && Txfp->GetAmType() == TYPE_AM_MAP && |
| 319 | (!Next || UseTemp() == TMP_FORCE)) { |
| 320 | // Delete all lines or using temp. Not handled in MAP mode |
| 321 | Txfp = new(g) FIXFAM((PDOSDEF)To_Def); |
| 322 | Txfp->SetTdbp(this); |
| 323 | } // endif Mode |
| 324 | |
| 325 | /*********************************************************************/ |
| 326 | /* Call Cardinality to calculate Block in the case of Func queries. */ |
| 327 | /* and also in the case of multiple tables. */ |
| 328 | /*********************************************************************/ |
| 329 | if (Cardinality(g) < 0) |
| 330 | return true; |
| 331 | |
| 332 | /*********************************************************************/ |
| 333 | /* Open according to required logical input/output mode. */ |
| 334 | /* Use conventionnal input/output functions. */ |
| 335 | /* Treat fixed length text files as binary. */ |
| 336 | /*********************************************************************/ |
| 337 | if (Txfp->OpenTableFile(g)) |
| 338 | return true; |
| 339 | |
| 340 | Use = USE_OPEN; // Do it now in case we are recursively called |
| 341 | |
| 342 | /*********************************************************************/ |
| 343 | /* Initialize To_Line at the beginning of the block buffer. */ |
| 344 | /*********************************************************************/ |
| 345 | To_Line = Txfp->GetBuf(); // For WriteDB |
| 346 | |
| 347 | /*********************************************************************/ |
| 348 | /* Allocate the block filter tree if evaluation is possible. */ |
| 349 | /*********************************************************************/ |
| 350 | To_BlkFil = InitBlockFilter(g, To_Filter); |
| 351 | |
| 352 | if (trace(1)) |
| 353 | htrc("OpenFix: R%hd mode=%d BlkFil=%p\n", Tdb_No, Mode, To_BlkFil); |
nothing calls this directly
no test coverage detected