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

Method put

src/jrd/svc.cpp:2440–2489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2438
2439
2440ULONG Service::put(const UCHAR* buffer, ULONG length)
2441{
2442 MutexLockGuard guard(svc_stdin_mutex, FB_FUNCTION);
2443
2444 // check length correctness
2445 if (length > svc_stdin_size_requested && length > svc_stdin_preload_requested)
2446 {
2447 (Arg::Gds(isc_svc_bad_size)).raise();
2448 }
2449
2450 if (svc_stdin_size_requested) // service waits for data from us
2451 {
2452 svc_stdin_user_size = MIN(length, svc_stdin_size_requested);
2453 memcpy(svc_stdin_buffer, buffer, svc_stdin_user_size);
2454 // reset satisfied request
2455 ULONG blockSize = svc_stdin_size_requested;
2456 svc_stdin_size_requested = 0;
2457 // let data be used
2458 svc_stdin_semaphore.release();
2459
2460 if (length == 0)
2461 {
2462 return 0;
2463 }
2464
2465 // reset used block of data
2466 length -= svc_stdin_user_size;
2467 buffer += svc_stdin_user_size;
2468
2469 if (length == 0) // ask user to preload next block of data
2470 {
2471 if (!svc_stdin_preload)
2472 {
2473 svc_stdin_preload.reset(FB_NEW_POOL(getPool()) UCHAR[PRELOAD_BUFFER_SIZE]);
2474 }
2475
2476 svc_stdin_preload_requested = MIN(blockSize, PRELOAD_BUFFER_SIZE);
2477 return svc_stdin_preload_requested;
2478 }
2479 }
2480
2481 // Store data in preload buffer
2482 fb_assert(length <= PRELOAD_BUFFER_SIZE);
2483 fb_assert(length <= svc_stdin_preload_requested);
2484 fb_assert(svc_stdin_size_preload == 0);
2485
2486 memcpy(svc_stdin_preload, buffer, length);
2487 svc_stdin_size_preload = length;
2488 return 0;
2489}
2490
2491
2492ULONG Service::getBytes(UCHAR* buffer, ULONG size)

Callers 15

openBlobFunctionMethod · 0.45
getByNameMethod · 0.45
startSessionMethod · 0.45
prepareRecSourceMethod · 0.45
getStatementMethod · 0.45
evlSetContextFunction · 0.45
dsqlPassMethod · 0.45
updateActiveSnapshotsMethod · 0.45
cacheBufferFunction · 0.45
VIO_storeFunction · 0.45
PAR_descFunction · 0.45
setupDescMethod · 0.45

Calls 4

GdsClass · 0.85
raiseMethod · 0.45
releaseMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected