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

Method batch_create

src/remote/server/server.cpp:3576–3665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3574
3575
3576void rem_port::batch_create(P_BATCH_CREATE* batch, PACKET* sendL)
3577{
3578 LocalStatus ls;
3579 CheckStatusWrapper status_vector(&ls);
3580 Rsr* statement;
3581 getHandle(statement, batch->p_batch_statement);
3582 statement->checkIface();
3583
3584 // Check for previously opened batch for the statement
3585 if (statement->rsr_batch)
3586 Arg::Gds(isc_batch_open).raise();
3587
3588 const ULONG blr_length = batch->p_batch_blr.cstr_length;
3589 const UCHAR* blr = batch->p_batch_blr.cstr_address;
3590 if (!blr)
3591 (Arg::Gds(isc_random) << "Missing required format info in createBatch()").raise(); // signals internal protocol error
3592 InternalMessageBuffer msgBuffer(blr_length, blr, batch->p_batch_msglen, NULL);
3593
3594 // Flush out any previous format information
3595 // that might be hanging around from an earlier execution.
3596
3597 delete statement->rsr_bind_format;
3598 statement->rsr_bind_format = PARSE_msg_format(blr, blr_length);
3599
3600 // If we know the length of the message, make sure there is a buffer
3601 // large enough to hold it.
3602
3603 if (!(statement->rsr_format = statement->rsr_bind_format))
3604 (Arg::Gds(isc_random) << "Error parsing message format in createBatch()").raise();
3605
3606 RMessage* message = statement->rsr_buffer;
3607 if (!message || statement->rsr_format->fmt_length > statement->rsr_fmt_length)
3608 {
3609 RMessage* const org_message = message;
3610 const ULONG org_length = message ? statement->rsr_fmt_length : 0;
3611 statement->rsr_fmt_length = statement->rsr_format->fmt_length;
3612 statement->rsr_buffer = message = FB_NEW RMessage(statement->rsr_fmt_length);
3613 statement->rsr_message = message;
3614 message->msg_next = message;
3615 if (org_length)
3616 {
3617 // dimitr: the original buffer might have something useful inside
3618 // (filled by a prior xdr_sql_message() call, for example),
3619 // so its contents must be preserved (see CORE-3730)
3620 memcpy(message->msg_buffer, org_message->msg_buffer, org_length);
3621 }
3622 REMOTE_release_messages(org_message);
3623 }
3624
3625 ClumpletWriter wrt(ClumpletReader::WideTagged, MAX_DPB_SIZE,
3626 batch->p_batch_pb.cstr_address, batch->p_batch_pb.cstr_length);
3627 if (wrt.getBufferLength() && (wrt.getBufferTag() != IBatch::VERSION1))
3628 (Arg::Gds(isc_batch_param_version) << Arg::Num(wrt.getBufferTag()) << Arg::Num(IBatch::VERSION1)).raise();
3629 statement->rsr_batch_flags = (wrt.find(IBatch::TAG_RECORD_COUNTS) && wrt.getInt()) ?
3630 (1 << IBatch::TAG_RECORD_COUNTS) : 0;
3631 if (wrt.find(IBatch::TAG_BLOB_POLICY) && (wrt.getInt() != IBatch::BLOB_STREAM))
3632 {
3633 // we always send blobs in a stream therefore change policy

Callers 1

process_packetFunction · 0.80

Calls 15

send_responseMethod · 0.95
GdsClass · 0.85
PARSE_msg_formatFunction · 0.85
REMOTE_release_messagesFunction · 0.85
NumClass · 0.85
checkIfaceMethod · 0.80
getBufferTagMethod · 0.80
deleteClumpletMethod · 0.80
RMessageClass · 0.50
checkFunction · 0.50
raiseMethod · 0.45
getBufferLengthMethod · 0.45

Tested by

no test coverage detected