/ VRDNDOS: Data Base read routine for odbc access method. */ /
| 763 | /* VRDNDOS: Data Base read routine for odbc access method. */ |
| 764 | /***********************************************************************/ |
| 765 | int TDBODBC::ReadDB(PGLOBAL g) |
| 766 | { |
| 767 | int rc; |
| 768 | |
| 769 | if (trace(2)) |
| 770 | htrc("ODBC ReadDB: R%d Mode=%d\n", GetTdb_No(), Mode); |
| 771 | |
| 772 | if (Mode == MODE_UPDATE || Mode == MODE_DELETE) { |
| 773 | if (!Query && MakeCommand(g)) |
| 774 | return RC_FX; |
| 775 | |
| 776 | // Send the UPDATE/DELETE command to the remote table |
| 777 | if (!Ocp->ExecSQLcommand(Query->GetStr())) { |
| 778 | snprintf(g->Message, sizeof(g->Message), "%s: %d affected rows", TableName, AftRows); |
| 779 | |
| 780 | if (trace(1)) |
| 781 | htrc("%s\n", g->Message); |
| 782 | |
| 783 | PushWarning(g, this, 0); // 0 means a Note |
| 784 | return RC_EF; // Nothing else to do |
| 785 | } else |
| 786 | return RC_FX; // Error |
| 787 | |
| 788 | } // endif Mode |
| 789 | |
| 790 | /*********************************************************************/ |
| 791 | /* Now start the reading process. */ |
| 792 | /* Here is the place to fetch the line(s). */ |
| 793 | /*********************************************************************/ |
| 794 | if (Placed) { |
| 795 | if (Fpos && CurNum >= 0) |
| 796 | Rbuf = Ocp->Fetch((Curpos = Fpos)); |
| 797 | |
| 798 | rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX; |
| 799 | Placed = false; |
| 800 | } else { |
| 801 | if (Memory != 3) { |
| 802 | if (++CurNum >= Rbuf) { |
| 803 | Rbuf = Ocp->Fetch(); |
| 804 | Curpos = Fpos + 1; |
| 805 | CurNum = 0; |
| 806 | } // endif CurNum |
| 807 | |
| 808 | rc = (Rbuf > 0) ? RC_OK : (Rbuf == 0) ? RC_EF : RC_FX; |
| 809 | } else // Getting result from memory |
| 810 | rc = (Fpos < Qrp->Nblin) ? RC_OK : RC_EF; |
| 811 | |
| 812 | if (rc == RC_OK) { |
| 813 | if (Memory == 2) |
| 814 | Qrp->Nblin++; |
| 815 | |
| 816 | Fpos++; // Used for memory and pos |
| 817 | } // endif rc |
| 818 | |
| 819 | } // endif Placed |
| 820 | |
| 821 | if (trace(2)) |
| 822 | htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc); |
nothing calls this directly
no test coverage detected