mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Move transactRequest, createBlob, openBlob, getSlice, putSlice and ddl from ITransaction to IAttachment.
It's better to have one standard than two, and "ddl" was broken from API POV. So make the IAttachment always the caller, explicit or implicit (via IStatement or IRequest), and pass the ITransaction as parameter.
This commit is contained in:
parent
476ce7483e
commit
166c41c5b1
@ -117,30 +117,8 @@ public:
|
||||
virtual void FB_CARG getInfo(Status* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer) = 0;
|
||||
virtual IBlob* FB_CARG createBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
IAttachment* att = 0) = 0;
|
||||
virtual IBlob* FB_CARG openBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
IAttachment* att = 0) = 0;
|
||||
virtual int FB_CARG getSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdlLength, const unsigned char* sdl,
|
||||
unsigned int paramLength, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
IAttachment* att = 0) = 0;
|
||||
virtual void FB_CARG putSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdlLength, const unsigned char* sdl,
|
||||
unsigned int paramLength, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
IAttachment* att = 0) = 0;
|
||||
virtual void FB_CARG transactRequest(Status* status,
|
||||
unsigned int blrLength, const unsigned char* blr,
|
||||
unsigned int inMsgLength, const unsigned char* inMsg,
|
||||
unsigned int outMsgLength, unsigned char* outMsg,
|
||||
IAttachment* att = 0) = 0;
|
||||
virtual void FB_CARG prepare(Status* status,
|
||||
unsigned int msgLength = 0, const unsigned char* message = 0) = 0;
|
||||
virtual void FB_CARG ddl(Status* status, unsigned int length, const unsigned char* ddlCommand) = 0;
|
||||
virtual void FB_CARG commit(Status* status) = 0;
|
||||
virtual void FB_CARG commitRetaining(Status* status) = 0;
|
||||
virtual void FB_CARG rollback(Status* status) = 0;
|
||||
@ -209,6 +187,24 @@ public:
|
||||
virtual ITransaction* FB_CARG reconnectTransaction(Status* status, unsigned int length, const unsigned char* id) = 0;
|
||||
virtual IStatement* FB_CARG allocateStatement(Status* status) = 0;
|
||||
virtual IRequest* FB_CARG compileRequest(Status* status, unsigned int blrLength, const unsigned char* blr) = 0;
|
||||
virtual void FB_CARG transactRequest(Status* status, ITransaction* transaction,
|
||||
unsigned int blrLength, const unsigned char* blr,
|
||||
unsigned int inMsgLength, const unsigned char* inMsg,
|
||||
unsigned int outMsgLength, unsigned char* outMsg) = 0;
|
||||
virtual IBlob* FB_CARG createBlob(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0) = 0;
|
||||
virtual IBlob* FB_CARG openBlob(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0) = 0;
|
||||
virtual int FB_CARG getSlice(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdlLength, const unsigned char* sdl,
|
||||
unsigned int paramLength, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice) = 0;
|
||||
virtual void FB_CARG putSlice(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdlLength, const unsigned char* sdl,
|
||||
unsigned int paramLength, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice) = 0;
|
||||
virtual void FB_CARG ddl(Status* status, ITransaction* transaction, unsigned int length,
|
||||
const unsigned char* dyn) = 0;
|
||||
virtual ITransaction* FB_CARG execute(Status* status, ITransaction* transaction,
|
||||
unsigned int length, const char* string, unsigned int dialect,
|
||||
unsigned int inMsgType, const MessageBuffer* inMsgBuffer,
|
||||
|
@ -234,6 +234,24 @@ public:
|
||||
virtual Firebird::ITransaction* FB_CARG reconnectTransaction(Status* status, unsigned int length, const unsigned char* id);
|
||||
virtual Firebird::IStatement* FB_CARG allocateStatement(Status* status);
|
||||
virtual Firebird::IRequest* FB_CARG compileRequest(Status* status, unsigned int blr_length, const unsigned char* blr);
|
||||
virtual void FB_CARG transactRequest(Status* status, Firebird::ITransaction* transaction,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg);
|
||||
virtual Firebird::IBlob* FB_CARG createBlob(Status* status, Firebird::ITransaction* transaction,
|
||||
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
|
||||
virtual Firebird::IBlob* FB_CARG openBlob(Status* status, Firebird::ITransaction* transaction,
|
||||
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
|
||||
virtual int FB_CARG getSlice(Status* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice);
|
||||
virtual void FB_CARG putSlice(Status* status, Firebird::ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice);
|
||||
virtual void FB_CARG ddl(Status* status, Firebird::ITransaction* transaction,
|
||||
unsigned int length, const unsigned char* dyn);
|
||||
virtual Firebird::ITransaction* FB_CARG execute(Status* status, Firebird::ITransaction* transaction,
|
||||
unsigned int length, const char* string, unsigned int dialect,
|
||||
unsigned int in_msg_type, const Firebird::MessageBuffer* inMsgBuffer,
|
||||
|
@ -623,7 +623,7 @@ void InternalBlob::open(thread_db* tdbb, Transaction& tran, const dsc& desc, con
|
||||
const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL;
|
||||
|
||||
m_blob = reinterpret_cast<Jrd::blb*>(
|
||||
transaction->openBlob(&status, &m_blob_id, bpb_len, bpb_buff, att));
|
||||
att->openBlob(&status, transaction, &m_blob_id, bpb_len, bpb_buff));
|
||||
}
|
||||
|
||||
if (!status.isSuccess())
|
||||
@ -648,8 +648,8 @@ void InternalBlob::create(thread_db* tdbb, Transaction& tran, dsc& desc, const U
|
||||
const USHORT bpb_len = bpb ? bpb->getCount() : 0;
|
||||
const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL;
|
||||
|
||||
m_blob = reinterpret_cast<Jrd::blb*>(transaction->createBlob(&status, &m_blob_id,
|
||||
bpb_len, bpb_buff, att));
|
||||
m_blob = reinterpret_cast<Jrd::blb*>(att->createBlob(&status, transaction, &m_blob_id,
|
||||
bpb_len, bpb_buff));
|
||||
memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id));
|
||||
}
|
||||
|
||||
|
@ -2030,8 +2030,8 @@ Firebird::IRequest* Attachment::compileRequest(Status* user_status,
|
||||
}
|
||||
|
||||
|
||||
Firebird::IBlob* jrd_tra::createBlob(Status* user_status, ISC_QUAD* blob_id,
|
||||
unsigned int bpb_length, const unsigned char* bpb, Firebird::IAttachment* apiAtt)
|
||||
IBlob* Attachment::createBlob(Status* user_status, ITransaction* tra, ISC_QUAD* blob_id,
|
||||
unsigned int bpb_length, const unsigned char* bpb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2049,12 +2049,12 @@ Firebird::IBlob* jrd_tra::createBlob(Status* user_status, ISC_QUAD* blob_id,
|
||||
{
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
validateHandle(tdbb, reinterpret_cast<Attachment*>(apiAtt));
|
||||
}
|
||||
|
||||
validateHandle(tdbb, this);
|
||||
|
||||
if (!tra)
|
||||
status_exception::raise(Arg::Gds(isc_bad_trans_handle));
|
||||
validateHandle(tdbb, reinterpret_cast<jrd_tra*>(tra));
|
||||
|
||||
DatabaseContextHolder dbbHolder(tdbb);
|
||||
check_database(tdbb);
|
||||
|
||||
@ -2488,7 +2488,8 @@ void Attachment::getInfo(Status* user_status, unsigned int item_length, const un
|
||||
}
|
||||
|
||||
|
||||
void jrd_tra::ddl(Status* status, unsigned int /*length*/, const unsigned char* /*ddlCommand*/)
|
||||
void Attachment::ddl(Status* status, ITransaction* /*tra*/, unsigned int /*length*/,
|
||||
const unsigned char* /*dyn*/)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2753,9 +2754,9 @@ unsigned int blb::getSegment(Status* user_status, unsigned int buffer_length, un
|
||||
}
|
||||
|
||||
|
||||
int jrd_tra::getSlice(Status* user_status, ISC_QUAD* array_id, unsigned int /*sdl_length*/,
|
||||
const unsigned char* sdl, unsigned int param_length, const unsigned char* param,
|
||||
int slice_length, unsigned char* slice, Firebird::IAttachment* apiAtt)
|
||||
int Attachment::getSlice(Status* user_status, ITransaction* tra, ISC_QUAD* array_id,
|
||||
unsigned int /*sdl_length*/, const unsigned char* sdl, unsigned int param_length,
|
||||
const unsigned char* param, int slice_length, unsigned char* slice)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2773,12 +2774,12 @@ int jrd_tra::getSlice(Status* user_status, ISC_QUAD* array_id, unsigned int /*sd
|
||||
{
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
validateHandle(tdbb, reinterpret_cast<Attachment*>(apiAtt));
|
||||
}
|
||||
|
||||
validateHandle(tdbb, this);
|
||||
|
||||
if (!tra)
|
||||
status_exception::raise(Arg::Gds(isc_bad_trans_handle));
|
||||
validateHandle(tdbb, reinterpret_cast<jrd_tra*>(tra));
|
||||
|
||||
DatabaseContextHolder dbbHolder(tdbb);
|
||||
check_database(tdbb);
|
||||
|
||||
@ -2812,8 +2813,8 @@ int jrd_tra::getSlice(Status* user_status, ISC_QUAD* array_id, unsigned int /*sd
|
||||
}
|
||||
|
||||
|
||||
Firebird::IBlob* jrd_tra::openBlob(Status* user_status, ISC_QUAD* blob_id, unsigned int bpb_length,
|
||||
const unsigned char* bpb, Firebird::IAttachment* apiAtt)
|
||||
IBlob* Attachment::openBlob(Status* user_status, ITransaction* tra, ISC_QUAD* blob_id,
|
||||
unsigned int bpb_length, const unsigned char* bpb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2831,12 +2832,12 @@ Firebird::IBlob* jrd_tra::openBlob(Status* user_status, ISC_QUAD* blob_id, unsig
|
||||
{
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
validateHandle(tdbb, reinterpret_cast<Attachment*>(apiAtt));
|
||||
}
|
||||
|
||||
validateHandle(tdbb, this);
|
||||
|
||||
if (!tra)
|
||||
status_exception::raise(Arg::Gds(isc_bad_trans_handle));
|
||||
validateHandle(tdbb, reinterpret_cast<jrd_tra*>(tra));
|
||||
|
||||
DatabaseContextHolder dbbHolder(tdbb);
|
||||
check_database(tdbb);
|
||||
|
||||
@ -2844,7 +2845,7 @@ Firebird::IBlob* jrd_tra::openBlob(Status* user_status, ISC_QUAD* blob_id, unsig
|
||||
{
|
||||
jrd_tra* const transaction = find_transaction(tdbb, isc_segstr_wrong_db);
|
||||
blob = BLB_open2(tdbb, transaction, reinterpret_cast<bid*>(blob_id),
|
||||
bpb_length, bpb, true);
|
||||
bpb_length, bpb, true);
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -2945,9 +2946,9 @@ void blb::putSegment(Status* user_status, unsigned int buffer_length, const unsi
|
||||
}
|
||||
|
||||
|
||||
void jrd_tra::putSlice(Status* user_status, ISC_QUAD* array_id, unsigned int /*sdlLength*/,
|
||||
const unsigned char* sdl, unsigned int paramLength, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice, Firebird::IAttachment* apiAtt)
|
||||
void Attachment::putSlice(Status* user_status, ITransaction* tra, ISC_QUAD* array_id,
|
||||
unsigned int /*sdlLength*/, const unsigned char* sdl, unsigned int paramLength,
|
||||
const unsigned char* param, int sliceLength, unsigned char* slice)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2963,21 +2964,20 @@ void jrd_tra::putSlice(Status* user_status, ISC_QUAD* array_id, unsigned int /*s
|
||||
{
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
validateHandle(tdbb, reinterpret_cast<Attachment*>(apiAtt));
|
||||
}
|
||||
|
||||
validateHandle(tdbb, this);
|
||||
|
||||
if (!tra)
|
||||
status_exception::raise(Arg::Gds(isc_bad_trans_handle));
|
||||
validateHandle(tdbb, reinterpret_cast<jrd_tra*>(tra));
|
||||
|
||||
DatabaseContextHolder dbbHolder(tdbb);
|
||||
check_database(tdbb);
|
||||
|
||||
try
|
||||
{
|
||||
jrd_tra* const transaction = find_transaction(tdbb, isc_segstr_wrong_db);
|
||||
|
||||
BLB_put_slice(tdbb, transaction, reinterpret_cast<bid*>(array_id),
|
||||
sdl, paramLength, param, sliceLength, slice);
|
||||
sdl, paramLength, param, sliceLength, slice);
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
@ -3895,11 +3895,10 @@ Firebird::ITransaction* Attachment::startTransaction(Status* user_status,
|
||||
}
|
||||
|
||||
|
||||
void jrd_tra::transactRequest(Status* user_status,
|
||||
void Attachment::transactRequest(Status* user_status, ITransaction* tra,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg,
|
||||
Firebird::IAttachment* apiAtt)
|
||||
unsigned int out_msg_length, unsigned char* out_msg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3915,19 +3914,18 @@ void jrd_tra::transactRequest(Status* user_status,
|
||||
{
|
||||
ThreadContextHolder tdbb(user_status);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
validateHandle(tdbb, reinterpret_cast<Attachment*>(apiAtt));
|
||||
}
|
||||
|
||||
validateHandle(tdbb, this);
|
||||
|
||||
if (!tra)
|
||||
status_exception::raise(Arg::Gds(isc_bad_trans_handle));
|
||||
validateHandle(tdbb, reinterpret_cast<jrd_tra*>(tra));
|
||||
|
||||
DatabaseContextHolder dbbHolder(tdbb);
|
||||
check_database(tdbb);
|
||||
|
||||
try
|
||||
{
|
||||
Database* const dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_tra* const transaction = find_transaction(tdbb, isc_req_wrong_db);
|
||||
|
||||
const MessageNode* inMessage = NULL;
|
||||
|
@ -319,30 +319,8 @@ public:
|
||||
virtual void FB_CARG getInfo(Status* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer);
|
||||
virtual Firebird::IBlob* FB_CARG createBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual Firebird::IBlob* FB_CARG openBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual int FB_CARG getSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG putSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG transactRequest(Status* status,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG prepare(Status* status,
|
||||
unsigned int msg_length = 0, const unsigned char* message = 0);
|
||||
virtual void FB_CARG ddl(Status* status, unsigned int length, const unsigned char* ddlCommand);
|
||||
virtual void FB_CARG commit(Status* status);
|
||||
virtual void FB_CARG commitRetaining(Status* status);
|
||||
virtual void FB_CARG rollback(Status* status);
|
||||
|
@ -176,30 +176,8 @@ public:
|
||||
virtual void FB_CARG getInfo(Status* status,
|
||||
unsigned int itemsLength, const unsigned char* items,
|
||||
unsigned int bufferLength, unsigned char* buffer);
|
||||
virtual Firebird::IBlob* FB_CARG createBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual Firebird::IBlob* FB_CARG openBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpbLength = 0, const unsigned char* bpb = 0,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual int FB_CARG getSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG putSlice(Status* status, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG transactRequest(Status* status,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg,
|
||||
Firebird::IAttachment* att = 0);
|
||||
virtual void FB_CARG prepare(Status* status,
|
||||
unsigned int msg_length = 0, const unsigned char* message = 0);
|
||||
virtual void FB_CARG ddl(Status* status, unsigned int length, const unsigned char* ddlCommand);
|
||||
virtual void FB_CARG commit(Status* status);
|
||||
virtual void FB_CARG commitRetaining(Status* status);
|
||||
virtual void FB_CARG rollback(Status* status);
|
||||
@ -364,6 +342,24 @@ public:
|
||||
virtual Firebird::ITransaction* FB_CARG reconnectTransaction(Status* status, unsigned int length, const unsigned char* id);
|
||||
virtual Firebird::IStatement* FB_CARG allocateStatement(Status* status);
|
||||
virtual Firebird::IRequest* FB_CARG compileRequest(Status* status, unsigned int blr_length, const unsigned char* blr);
|
||||
virtual void FB_CARG transactRequest(Status* status, ITransaction* transaction,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg);
|
||||
virtual Firebird::IBlob* FB_CARG createBlob(Status* status, ITransaction* transaction,
|
||||
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
|
||||
virtual Firebird::IBlob* FB_CARG openBlob(Status* status, ITransaction* transaction,
|
||||
ISC_QUAD* id, unsigned int bpbLength = 0, const unsigned char* bpb = 0);
|
||||
virtual int FB_CARG getSlice(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice);
|
||||
virtual void FB_CARG putSlice(Status* status, ITransaction* transaction, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice);
|
||||
virtual void FB_CARG ddl(Status* status, ITransaction* transaction, unsigned int length,
|
||||
const unsigned char* dyn);
|
||||
virtual Firebird::ITransaction* FB_CARG execute(Status* status, Firebird::ITransaction* transaction,
|
||||
unsigned int length, const char* string, unsigned int dialect,
|
||||
unsigned int in_msg_type, const MessageBuffer* inMsgBuffer,
|
||||
@ -1008,9 +1004,8 @@ Firebird::IRequest* Attachment::compileRequest(Status* status,
|
||||
}
|
||||
|
||||
|
||||
Firebird::IBlob* Transaction::createBlob(Status* status, ISC_QUAD* blob_id,
|
||||
unsigned int bpb_length, const unsigned char* bpb,
|
||||
Firebird::IAttachment* apiAtt)
|
||||
IBlob* Attachment::createBlob(Status* status, ITransaction* apiTra, ISC_QUAD* blob_id,
|
||||
unsigned int bpb_length, const unsigned char* bpb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1026,20 +1021,12 @@ Firebird::IBlob* Transaction::createBlob(Status* status, ISC_QUAD* blob_id,
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
Attachment* att = reinterpret_cast<Attachment*>(apiAtt);
|
||||
if (att->getRdb() != rdb)
|
||||
{
|
||||
Arg::Gds(isc_trareqmis).raise();
|
||||
}
|
||||
}
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
PACKET* packet = &rdb->rdb_packet;
|
||||
packet->p_operation = op_create_blob;
|
||||
@ -1222,7 +1209,8 @@ void Attachment::getInfo(Status* status,
|
||||
}
|
||||
|
||||
|
||||
void Transaction::ddl(Status* status, unsigned int length, const unsigned char* ddlCommand)
|
||||
void Attachment::ddl(Status* status, ITransaction* apiTra, unsigned int length,
|
||||
const unsigned char* dyn)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1237,12 +1225,13 @@ void Transaction::ddl(Status* status, unsigned int length, const unsigned char*
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
|
||||
unsupported();
|
||||
}
|
||||
@ -1255,7 +1244,7 @@ void Transaction::ddl(Status* status, unsigned int length, const unsigned char*
|
||||
ddl->p_ddl_database = rdb->rdb_id;
|
||||
ddl->p_ddl_transaction = transaction->rtr_id;
|
||||
ddl->p_ddl_blr.cstr_length = length;
|
||||
ddl->p_ddl_blr.cstr_address = ddlCommand;
|
||||
ddl->p_ddl_blr.cstr_address = dyn;
|
||||
|
||||
send_and_receive(status, rdb, packet);
|
||||
}
|
||||
@ -2814,10 +2803,10 @@ unsigned int Blob::getSegment(Status* status, unsigned int buffer_length, unsign
|
||||
}
|
||||
|
||||
|
||||
int Transaction::getSlice(Status* status, ISC_QUAD* array_id,
|
||||
int Attachment::getSlice(Status* status, ITransaction* apiTra, ISC_QUAD* array_id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int slice_length, unsigned char* slice, Firebird::IAttachment* apiAtt)
|
||||
int slice_length, unsigned char* slice)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2833,20 +2822,12 @@ int Transaction::getSlice(Status* status, ISC_QUAD* array_id,
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
Attachment* att = reinterpret_cast<Attachment*>(apiAtt);
|
||||
if (att->getRdb() != rdb)
|
||||
{
|
||||
Arg::Gds(isc_trareqmis).raise();
|
||||
}
|
||||
}
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
|
||||
unsupported();
|
||||
@ -2906,9 +2887,8 @@ int Transaction::getSlice(Status* status, ISC_QUAD* array_id,
|
||||
}
|
||||
|
||||
|
||||
Firebird::IBlob* Transaction::openBlob(Status* status, ISC_QUAD* id,
|
||||
unsigned int bpb_length, const unsigned char* bpb,
|
||||
Firebird::IAttachment* apiAtt)
|
||||
IBlob* Attachment::openBlob(Status* status, ITransaction* apiTra, ISC_QUAD* id,
|
||||
unsigned int bpb_length, const unsigned char* bpb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2924,20 +2904,12 @@ Firebird::IBlob* Transaction::openBlob(Status* status, ISC_QUAD* id,
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
Attachment* att = reinterpret_cast<Attachment*>(apiAtt);
|
||||
if (att->getRdb() != rdb)
|
||||
{
|
||||
Arg::Gds(isc_trareqmis).raise();
|
||||
}
|
||||
}
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
PACKET* packet = &rdb->rdb_packet;
|
||||
packet->p_operation = op_open_blob;
|
||||
@ -3112,11 +3084,10 @@ void Blob::putSegment(Status* status, unsigned int segment_length, const unsigne
|
||||
}
|
||||
|
||||
|
||||
void Transaction::putSlice(Status* status, ISC_QUAD* id,
|
||||
void Attachment::putSlice(Status* status, ITransaction* apiTra, ISC_QUAD* id,
|
||||
unsigned int sdl_length, const unsigned char* sdl,
|
||||
unsigned int param_length, const unsigned char* param,
|
||||
int sliceLength, unsigned char* slice,
|
||||
Firebird::IAttachment* apiAtt)
|
||||
int sliceLength, unsigned char* slice)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3132,20 +3103,12 @@ void Transaction::putSlice(Status* status, ISC_QUAD* id,
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
Attachment* att = reinterpret_cast<Attachment*>(apiAtt);
|
||||
if (att->getRdb() != rdb)
|
||||
{
|
||||
Arg::Gds(isc_trareqmis).raise();
|
||||
}
|
||||
}
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
if (rdb->rdb_port->port_protocol < PROTOCOL_VERSION4) {
|
||||
unsupported();
|
||||
@ -4225,11 +4188,10 @@ Firebird::ITransaction* Attachment::startTransaction(Status* status,
|
||||
}
|
||||
|
||||
|
||||
void Transaction::transactRequest(Status* status,
|
||||
void Attachment::transactRequest(Status* status, ITransaction* apiTra,
|
||||
unsigned int blr_length, const unsigned char* blr,
|
||||
unsigned int in_msg_length, const unsigned char* in_msg,
|
||||
unsigned int out_msg_length, unsigned char* out_msg,
|
||||
Firebird::IAttachment* apiAtt)
|
||||
unsigned int out_msg_length, unsigned char* out_msg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4245,20 +4207,12 @@ void Transaction::transactRequest(Status* status,
|
||||
{
|
||||
reset(status);
|
||||
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
Rdb* rdb = transaction->rtr_rdb;
|
||||
CHECK_HANDLE(rdb, isc_bad_db_handle);
|
||||
rem_port* port = rdb->rdb_port;
|
||||
RefMutexGuard portGuard(*port->port_sync);
|
||||
|
||||
if (apiAtt)
|
||||
{
|
||||
Attachment* att = reinterpret_cast<Attachment*>(apiAtt);
|
||||
if (att->getRdb() != rdb)
|
||||
{
|
||||
Arg::Gds(isc_trareqmis).raise();
|
||||
}
|
||||
}
|
||||
Rtr* transaction = apiTra ? ((Transaction*) apiTra)->getTransaction() : NULL;
|
||||
CHECK_HANDLE(transaction, isc_bad_trans_handle);
|
||||
|
||||
// bag it if the protocol doesn't support it...
|
||||
|
||||
|
@ -2264,7 +2264,7 @@ ISC_STATUS API_ROUTINE isc_ddl(ISC_STATUS* user_status,
|
||||
FB_API_HANDLE* db_handle,
|
||||
FB_API_HANDLE* tra_handle,
|
||||
SSHORT length,
|
||||
const UCHAR* ddl)
|
||||
const UCHAR* dyn)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2284,7 +2284,7 @@ ISC_STATUS API_ROUTINE isc_ddl(ISC_STATUS* user_status,
|
||||
YEntry entryGuard(status, attachment);
|
||||
Transaction transaction = findTransaction(tra_handle, attachment);
|
||||
|
||||
transaction->providerInterface->ddl(&status, length, ddl);
|
||||
attachment->providerInterface->ddl(&status, transaction->providerInterface, length, dyn);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -3850,11 +3850,12 @@ ISC_STATUS API_ROUTINE isc_get_slice(ISC_STATUS* user_status,
|
||||
YEntry entryGuard(status, attachment);
|
||||
Transaction transaction = findTransaction(tra_handle, attachment);
|
||||
|
||||
int length = transaction->providerInterface->getSlice(&status, array_id, sdl_length, sdl, param_length, param, slice_length, slice);
|
||||
int length = attachment->providerInterface->getSlice(&status,
|
||||
transaction->providerInterface, array_id, sdl_length, sdl,
|
||||
param_length, param, slice_length, slice);
|
||||
|
||||
if (status.isSuccess() && return_length)
|
||||
{
|
||||
*return_length = length;
|
||||
}
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4070,9 +4071,9 @@ ISC_STATUS API_ROUTINE isc_put_slice(ISC_STATUS* user_status,
|
||||
YEntry entryGuard(status, attachment);
|
||||
Transaction transaction = findTransaction(tra_handle, attachment);
|
||||
|
||||
transaction->providerInterface->putSlice(&status, array_id, sdl_length, sdl,
|
||||
param_length, reinterpret_cast<const unsigned char*>(param),
|
||||
slice_length, slice);
|
||||
attachment->providerInterface->putSlice(&status, transaction->providerInterface, array_id,
|
||||
sdl_length, sdl, param_length, reinterpret_cast<const unsigned char*>(param),
|
||||
slice_length, slice);
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -4950,10 +4951,10 @@ ISC_STATUS API_ROUTINE isc_transact_request(ISC_STATUS* user_status,
|
||||
YEntry entryGuard(status, attachment);
|
||||
Transaction transaction = findTransaction(tra_handle, attachment);
|
||||
|
||||
transaction->providerInterface->transactRequest(&status, blr_length, reinterpret_cast<unsigned char*>(blr),
|
||||
in_msg_length, reinterpret_cast<unsigned char*>(in_msg),
|
||||
out_msg_length, reinterpret_cast<unsigned char*>(out_msg),
|
||||
attachment->providerInterface);
|
||||
attachment->providerInterface->transactRequest(&status, transaction->providerInterface,
|
||||
blr_length, reinterpret_cast<unsigned char*>(blr),
|
||||
in_msg_length, reinterpret_cast<unsigned char*>(in_msg),
|
||||
out_msg_length, reinterpret_cast<unsigned char*>(out_msg));
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
@ -5487,8 +5488,10 @@ static ISC_STATUS open_blob(ISC_STATUS* user_status,
|
||||
Transaction transaction = findTransaction(tra_handle, attachment);
|
||||
|
||||
IBlob* blob_handle = createFlag ?
|
||||
transaction->providerInterface->createBlob(&status, blob_id, bpb_length, bpb, attachment->providerInterface) :
|
||||
transaction->providerInterface->openBlob(&status, blob_id, bpb_length, bpb, attachment->providerInterface);
|
||||
attachment->providerInterface->createBlob(&status, transaction->providerInterface,
|
||||
blob_id, bpb_length, bpb) :
|
||||
attachment->providerInterface->openBlob(&status, transaction->providerInterface,
|
||||
blob_id, bpb_length, bpb);
|
||||
|
||||
if (!status.isSuccess())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user