MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getSlice

Method getSlice

src/remote/client/interface.cpp:5796–5874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5794
5795
5796int Attachment::getSlice(CheckStatusWrapper* status, ITransaction* apiTra, ISC_QUAD* array_id,
5797 unsigned int sdl_length, const unsigned char* sdl,
5798 unsigned int param_length, const unsigned char* param,
5799 int slice_length, unsigned char* slice)
5800{
5801/**************************************
5802 *
5803 * g d s _ g e t _ s l i c e
5804 *
5805 **************************************
5806 *
5807 * Functional description
5808 * Snatch a slice of an array.
5809 *
5810 **************************************/
5811 try
5812 {
5813 reset(status);
5814
5815 CHECK_HANDLE(rdb, isc_bad_db_handle);
5816 rem_port* port = rdb->rdb_port;
5817 RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
5818
5819 Rtr* transaction = remoteTransaction(apiTra);
5820 CHECK_HANDLE(transaction, isc_bad_trans_handle);
5821
5822 // Validate data length
5823
5824 CHECK_LENGTH(port, sdl_length);
5825 CHECK_LENGTH(port, param_length);
5826
5827 // Parse the sdl in case blr_d_float must be converted to blr_double
5828
5829 const UCHAR* new_sdl = sdl;
5830
5831 // CVC: Modified this horrible idea: don't touch input parameters!
5832 // The modified (perhaps) sdl is send to the remote connection. The
5833 // original sdl is used to process the slice data when it is received.
5834 // (This is why both 'new_sdl' and 'sdl' are saved in the packet.)
5835 HalfStaticArray<UCHAR, 128> sdl_buffer;
5836 UCHAR* old_sdl = sdl_buffer.getBuffer(sdl_length);
5837 memcpy(old_sdl, sdl, sdl_length);
5838
5839 PACKET* packet = &rdb->rdb_packet;
5840 packet->p_operation = op_get_slice;
5841 P_SLC* data = &packet->p_slc;
5842 data->p_slc_transaction = transaction->rtr_id;
5843 data->p_slc_id = *array_id;
5844 data->p_slc_length = slice_length;
5845 data->p_slc_sdl.cstr_length = sdl_length;
5846 data->p_slc_sdl.cstr_address = const_cast<UCHAR*>(new_sdl);
5847 data->p_slc_parameters.cstr_length = param_length;
5848 data->p_slc_parameters.cstr_address = const_cast<UCHAR*>(param);
5849
5850 data->p_slc_slice.lstr_length = 0;
5851 data->p_slc_slice.lstr_address = slice;
5852
5853 P_SLR* response = &packet->p_slr;

Callers 1

get_sliceMethod · 0.45

Calls 8

CHECK_HANDLEFunction · 0.85
CHECK_LENGTHFunction · 0.85
send_packetFunction · 0.85
receive_packetFunction · 0.85
REMOTE_check_responseFunction · 0.85
resetFunction · 0.70
getBufferMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected