/ Data Base indexed read routine for ODBC access method. */ /
| 710 | /* Data Base indexed read routine for ODBC access method. */ |
| 711 | /***********************************************************************/ |
| 712 | bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) |
| 713 | { |
| 714 | char c = Quote ? *Quote : 0; |
| 715 | int oldlen = Query->GetLength(); |
| 716 | PHC hc = To_Def->GetHandler(); |
| 717 | |
| 718 | if (!(kr || hc->end_range) || op == OP_NEXT || |
| 719 | Mode == MODE_UPDATE || Mode == MODE_DELETE) { |
| 720 | if (!kr && Mode == MODE_READX) { |
| 721 | // This is a false indexed read |
| 722 | Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns); |
| 723 | Mode = MODE_READ; |
| 724 | return (Rows < 0); |
| 725 | } // endif key |
| 726 | |
| 727 | return false; |
| 728 | } else { |
| 729 | if (hc->MakeKeyWhere(g, Query, op, c, kr)) |
| 730 | return true; |
| 731 | |
| 732 | if (To_CondFil) { |
| 733 | if (To_CondFil->Idx != hc->active_index) { |
| 734 | To_CondFil->Idx = hc->active_index; |
| 735 | To_CondFil->Body= (char*)PlugSubAlloc(g, NULL, 0); |
| 736 | *To_CondFil->Body= 0; |
| 737 | |
| 738 | if ((To_CondFil = hc->CheckCond(g, To_CondFil, Cond))) |
| 739 | PlugSubAlloc(g, NULL, strlen(To_CondFil->Body) + 1); |
| 740 | |
| 741 | } // endif active_index |
| 742 | |
| 743 | if (To_CondFil) |
| 744 | if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) { |
| 745 | strcpy(g->Message, "Readkey: Out of memory"); |
| 746 | return true; |
| 747 | } // endif Append |
| 748 | |
| 749 | } // endif To_Condfil |
| 750 | |
| 751 | Mode = MODE_READ; |
| 752 | } // endif's op |
| 753 | |
| 754 | if (trace(33)) |
| 755 | htrc("ODBC ReadKey: Query=%s\n", Query->GetStr()); |
| 756 | |
| 757 | Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns); |
| 758 | Query->Truncate(oldlen); |
| 759 | return (Rows < 0); |
| 760 | } // end of ReadKey |
| 761 | |
| 762 | /***********************************************************************/ |
| 763 | /* VRDNDOS: Data Base read routine for odbc access method. */ |
nothing calls this directly
no test coverage detected