| 1722 | |
| 1723 | |
| 1724 | IRequest* Attachment::compileRequest(CheckStatusWrapper* status, |
| 1725 | unsigned int blr_length, const unsigned char* blr) |
| 1726 | { |
| 1727 | /************************************** |
| 1728 | * |
| 1729 | * g d s _ c o m p i l e |
| 1730 | * |
| 1731 | ************************************** |
| 1732 | * |
| 1733 | * Functional description |
| 1734 | * |
| 1735 | **************************************/ |
| 1736 | |
| 1737 | try |
| 1738 | { |
| 1739 | reset(status); |
| 1740 | |
| 1741 | // Check and validate handles, etc. |
| 1742 | |
| 1743 | CHECK_HANDLE(rdb, isc_bad_db_handle); |
| 1744 | rem_port* port = rdb->rdb_port; |
| 1745 | RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); |
| 1746 | |
| 1747 | // Validate data length |
| 1748 | |
| 1749 | CHECK_LENGTH(port, blr_length); |
| 1750 | |
| 1751 | // Parse the request in case blr_d_float must be converted to blr_double |
| 1752 | |
| 1753 | const UCHAR* new_blr = blr; |
| 1754 | |
| 1755 | // Make up a packet for the remote guy |
| 1756 | |
| 1757 | PACKET* packet = &rdb->rdb_packet; |
| 1758 | packet->p_operation = op_compile; |
| 1759 | P_CMPL* compile = &packet->p_cmpl; |
| 1760 | compile->p_cmpl_database = rdb->rdb_id; |
| 1761 | compile->p_cmpl_blr.cstr_length = blr_length; |
| 1762 | compile->p_cmpl_blr.cstr_address = new_blr; |
| 1763 | |
| 1764 | send_and_receive(status, rdb, packet); |
| 1765 | |
| 1766 | // Parse the request to find the messages |
| 1767 | |
| 1768 | RMessage* next; |
| 1769 | |
| 1770 | RMessage* message = PARSE_messages(blr, blr_length); |
| 1771 | USHORT max_msg = 0; |
| 1772 | for (next = message; next; next = next->msg_next) |
| 1773 | max_msg = MAX(max_msg, next->msg_number); |
| 1774 | |
| 1775 | // Allocate request block |
| 1776 | Rrq* request = FB_NEW Rrq(max_msg + 1); |
| 1777 | request->rrq_rdb = rdb; |
| 1778 | request->rrq_id = packet->p_resp.p_resp_object; |
| 1779 | request->rrq_max_msg = max_msg; |
| 1780 | SET_OBJECT(rdb, request, request->rrq_id); |
| 1781 | request->rrq_next = rdb->rdb_requests; |
no test coverage detected