/ JDBC 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. */ /
| 564 | /* join block of next table if it exists or else are discarted. */ |
| 565 | /***********************************************************************/ |
| 566 | bool TDBJDBC::OpenDB(PGLOBAL g) |
| 567 | { |
| 568 | bool rc = true; |
| 569 | |
| 570 | if (trace(1)) |
| 571 | htrc("JDBC OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", |
| 572 | this, Tdb_No, Use, Mode); |
| 573 | |
| 574 | if (Use == USE_OPEN) { |
| 575 | if (Mode == MODE_READ || Mode == MODE_READX) { |
| 576 | /*****************************************************************/ |
| 577 | /* Table already open, just replace it at its beginning. */ |
| 578 | /*****************************************************************/ |
| 579 | if (Memory == 1) { |
| 580 | if ((Qrp = Jcp->AllocateResult(g, this))) |
| 581 | Memory = 2; // Must be filled |
| 582 | else |
| 583 | Memory = 0; // Allocation failed, don't use it |
| 584 | |
| 585 | } else if (Memory == 2) |
| 586 | Memory = 3; // Ok to use memory result |
| 587 | |
| 588 | if (Memory < 3) { |
| 589 | // Method will depend on cursor type |
| 590 | if ((Rbuf = Query ? Jcp->Rewind(Query->GetStr()) : 0) < 0) |
| 591 | { |
| 592 | if (Mode != MODE_READX) { |
| 593 | Jcp->Close(); |
| 594 | return true; |
| 595 | } else |
| 596 | Rbuf = 0; |
| 597 | } |
| 598 | |
| 599 | } else |
| 600 | Rbuf = Qrp->Nblin; |
| 601 | |
| 602 | CurNum = 0; |
| 603 | Fpos = 0; |
| 604 | Curpos = 1; |
| 605 | } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) { |
| 606 | // new update coming from a trigger or procedure |
| 607 | Query = NULL; |
| 608 | SetCondFil(NULL); |
| 609 | Qrystr = To_Def->GetStringCatInfo(g, "Query_String", "?"); |
| 610 | } else { //if (Mode == MODE_INSERT) |
| 611 | } // endif Mode |
| 612 | |
| 613 | return false; |
| 614 | } // endif use |
| 615 | |
| 616 | /*********************************************************************/ |
| 617 | /* Open an JDBC connection for this table. */ |
| 618 | /* Note: this may not be the proper way to do. Perhaps it is better */ |
| 619 | /* to test whether a connection is already open for this datasource */ |
| 620 | /* and if so to allocate just a new result set. But this only for */ |
| 621 | /* drivers allowing concurency in getting results ??? */ |
| 622 | /*********************************************************************/ |
| 623 | if (!Jcp) |
nothing calls this directly
no test coverage detected