/ GetTable: makes a new Table Description Block. */ /
| 346 | /* GetTable: makes a new Table Description Block. */ |
| 347 | /***********************************************************************/ |
| 348 | PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) |
| 349 | { |
| 350 | // Mapping not used for insert |
| 351 | USETEMP tmp = UseTemp(); |
| 352 | bool map = Mapped && mode != MODE_INSERT && |
| 353 | !(tmp != TMP_NO && Recfm == RECFM_VAR |
| 354 | && mode == MODE_UPDATE) && |
| 355 | !(tmp == TMP_FORCE && |
| 356 | (mode == MODE_UPDATE || mode == MODE_DELETE)); |
| 357 | PTXF txfp = NULL; |
| 358 | PTDBASE tdbp; |
| 359 | |
| 360 | /*********************************************************************/ |
| 361 | /* Allocate table and file processing class of the proper type. */ |
| 362 | /* Column blocks will be allocated only when needed. */ |
| 363 | /*********************************************************************/ |
| 364 | if (Recfm == RECFM_DBF) { |
| 365 | if (Catfunc == FNC_NO) { |
| 366 | if (Zipped) { |
| 367 | if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { |
| 368 | txfp = new(g) UZDFAM(this); |
| 369 | } else { |
| 370 | safe_strcpy(g->Message, sizeof(g->Message), "Zipped DBF tables are read only"); |
| 371 | return NULL; |
| 372 | } // endif's mode |
| 373 | |
| 374 | } else if (map) |
| 375 | txfp = new(g) DBMFAM(this); |
| 376 | else |
| 377 | txfp = new(g) DBFFAM(this); |
| 378 | |
| 379 | tdbp = new(g) TDBFIX(this, txfp); |
| 380 | } else |
| 381 | tdbp = new(g) TDBDCL(this); // Catfunc should be 'C' |
| 382 | |
| 383 | } else if (Zipped) { |
| 384 | #if defined(ZIP_SUPPORT) |
| 385 | if (Recfm == RECFM_VAR) { |
| 386 | if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { |
| 387 | txfp = new(g) UNZFAM(this); |
| 388 | } else if (mode == MODE_INSERT) { |
| 389 | txfp = new(g) ZIPFAM(this); |
| 390 | } else { |
| 391 | safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); |
| 392 | return NULL; |
| 393 | } // endif's mode |
| 394 | |
| 395 | tdbp = new(g) TDBDOS(this, txfp); |
| 396 | } else { |
| 397 | if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { |
| 398 | txfp = new(g) UZXFAM(this); |
| 399 | } else if (mode == MODE_INSERT) { |
| 400 | txfp = new(g) ZPXFAM(this); |
| 401 | } else { |
| 402 | safe_strcpy(g->Message, sizeof(g->Message), "UPDATE/DELETE not supported for ZIP"); |
| 403 | return NULL; |
| 404 | } // endif's mode |
| 405 |
nothing calls this directly
no test coverage detected