/ PRXCOL initialization routine. */ Look for the matching column in the object table. */ /
| 697 | /* Look for the matching column in the object table. */ |
| 698 | /***********************************************************************/ |
| 699 | bool PRXCOL::Init(PGLOBAL g, PTDB tp) |
| 700 | { |
| 701 | if (!tp) |
| 702 | tp = ((PTDBPRX)To_Tdb)->Tdbp; |
| 703 | |
| 704 | if (!(Colp = tp->ColDB(g, Name, 0)) && Colnum) |
| 705 | Colp = tp->ColDB(g, NULL, Colnum); |
| 706 | |
| 707 | if (Colp) { |
| 708 | MODE mode = To_Tdb->GetMode(); |
| 709 | |
| 710 | // Needed for MYSQL subtables |
| 711 | ((COLBLK*)Colp)->SetName(Decode(g, Colp->GetName())); |
| 712 | |
| 713 | // May not have been done elsewhere |
| 714 | Colp->InitValue(g); |
| 715 | To_Val = Colp->GetValue(); |
| 716 | |
| 717 | if (mode == MODE_INSERT || mode == MODE_UPDATE) |
| 718 | if (Colp->SetBuffer(g, Colp->GetValue(), true, false)) |
| 719 | return true; |
| 720 | |
| 721 | // this may be needed by some tables (which?) |
| 722 | Colp->SetColUse(ColUse); |
| 723 | } else { |
| 724 | snprintf(g->Message, sizeof(g->Message), MSG(NO_MATCHING_COL), Name, tp->GetName()); |
| 725 | return true; |
| 726 | } // endif Colp |
| 727 | |
| 728 | return false; |
| 729 | } // end of Init |
| 730 | |
| 731 | /***********************************************************************/ |
| 732 | /* Reset the column descriptor to non evaluated yet. */ |