/ PROXY Access Method opening routine. */ /
| 547 | /* PROXY Access Method opening routine. */ |
| 548 | /***********************************************************************/ |
| 549 | bool TDBPRX::OpenDB(PGLOBAL g) |
| 550 | { |
| 551 | if (Use == USE_OPEN) { |
| 552 | /*******************************************************************/ |
| 553 | /* Table already open, just replace it at its beginning. */ |
| 554 | /*******************************************************************/ |
| 555 | return Tdbp->OpenDB(g); |
| 556 | } // endif use |
| 557 | |
| 558 | if (InitTable(g)) |
| 559 | return true; |
| 560 | else if (Mode != MODE_READ && (Read_Only || Tdbp->IsReadOnly())) { |
| 561 | strcpy(g->Message, "Cannot modify a read only table"); |
| 562 | return true; |
| 563 | } // endif tp |
| 564 | |
| 565 | /*********************************************************************/ |
| 566 | /* Check and initialize the subtable columns. */ |
| 567 | /*********************************************************************/ |
| 568 | for (PCOL cp = Columns; cp; cp = cp->GetNext()) |
| 569 | if (((PPRXCOL)cp)->Init(g, Tdbp)) |
| 570 | return true; |
| 571 | |
| 572 | /*********************************************************************/ |
| 573 | /* In Update mode, the updated column blocks must be distinct from */ |
| 574 | /* the read column blocks. So make a copy of the TDB and allocate */ |
| 575 | /* its column blocks in mode write (required by XML tables). */ |
| 576 | /*********************************************************************/ |
| 577 | if (Mode == MODE_UPDATE) { |
| 578 | PTDB utp; |
| 579 | |
| 580 | if (!(utp= Tdbp->Duplicate(g))) { |
| 581 | snprintf(g->Message, sizeof(g->Message), MSG(INV_UPDT_TABLE), Tdbp->GetName()); |
| 582 | return true; |
| 583 | } // endif tp |
| 584 | |
| 585 | for (PCOL cp = To_SetCols; cp; cp = cp->GetNext()) |
| 586 | if (((PPRXCOL)cp)->Init(g, utp)) |
| 587 | return true; |
| 588 | |
| 589 | } else if (Mode == MODE_DELETE) |
| 590 | Tdbp->SetNext(Next); |
| 591 | |
| 592 | /*********************************************************************/ |
| 593 | /* Physically open the object table. */ |
| 594 | /*********************************************************************/ |
| 595 | if (Tdbp->OpenDB(g)) |
| 596 | return true; |
| 597 | |
| 598 | Tdbp->SetNext(NULL); |
| 599 | Use = USE_OPEN; |
| 600 | return false; |
| 601 | } // end of OpenDB |
| 602 | |
| 603 | /***********************************************************************/ |
| 604 | /* Data Base read routine for PROY access method. */ |