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

Method putSlice

src/remote/client/interface.cpp:6203–6273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6201
6202
6203void Attachment::putSlice(CheckStatusWrapper* status, ITransaction* apiTra, ISC_QUAD* id,
6204 unsigned int sdl_length, const unsigned char* sdl,
6205 unsigned int param_length, const unsigned char* param,
6206 int sliceLength, unsigned char* slice)
6207{
6208/**************************************
6209 *
6210 * g d s _ p u t _ s l i c e
6211 *
6212 **************************************
6213 *
6214 * Functional description
6215 * Store a slice of an array.
6216 *
6217 **************************************/
6218 try
6219 {
6220 reset(status);
6221
6222 CHECK_HANDLE(rdb, isc_bad_db_handle);
6223 rem_port* port = rdb->rdb_port;
6224 RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION);
6225
6226 Rtr* transaction = remoteTransaction(apiTra);
6227 CHECK_HANDLE(transaction, isc_bad_trans_handle);
6228
6229 // Validate data length
6230
6231 CHECK_LENGTH(port, sdl_length);
6232 CHECK_LENGTH(port, param_length);
6233
6234 // Parse the sdl in case blr_d_float must be converted to blr_double
6235
6236 const UCHAR* new_sdl = sdl;
6237
6238 // CVC: Modified this horrible idea: don't touch input parameters!
6239 // The modified (perhaps) sdl is sent to the remote connection. The
6240 // original sdl is used to process the slice data before it is sent.
6241 // (This is why both 'new_sdl' and 'sdl' are saved in the packet.)
6242 HalfStaticArray<UCHAR, 128> sdl_buffer;
6243 UCHAR* old_sdl = sdl_buffer.getBuffer(sdl_length);
6244 memcpy(old_sdl, sdl, sdl_length);
6245
6246 PACKET* packet = &rdb->rdb_packet;
6247 packet->p_operation = op_put_slice;
6248 P_SLC* data = &packet->p_slc;
6249 data->p_slc_transaction = transaction->rtr_id;
6250 data->p_slc_id = *id;
6251 data->p_slc_length = sliceLength;
6252 data->p_slc_sdl.cstr_length = sdl_length;
6253 data->p_slc_sdl.cstr_address = const_cast<UCHAR*>(new_sdl);
6254 data->p_slc_parameters.cstr_length = param_length;
6255 data->p_slc_parameters.cstr_address = const_cast<UCHAR*>(param);
6256 data->p_slc_slice.lstr_length = sliceLength;
6257 data->p_slc_slice.lstr_address = slice;
6258
6259 P_SLR* response = &packet->p_slr;
6260 response->p_slr_sdl = old_sdl; //const_cast<UCHAR*>(sdl);

Callers 1

put_sliceMethod · 0.45

Calls 6

CHECK_HANDLEFunction · 0.85
CHECK_LENGTHFunction · 0.85
send_and_receiveFunction · 0.85
resetFunction · 0.70
getBufferMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected